hyperledger / aries-askar

Secure storage designed for Hyperledger Aries agents.
Apache License 2.0
58 stars 42 forks source link

fix: Incorrect SQLite expire check #261

Closed dkulic closed 1 month ago

dkulic commented 1 month ago

In SQLite comparison of expiry date is done using query

(expiry IS NULL OR expiry > DATETIME('now'))

but SQLite considers text strings for date and time comparisons by character order, not by their actual date/time value., so the check is not working correctly and askar returns the items stored even after expired.

The fix is easy, expiry should be first converted to DATETIME, in above query something like:

(expiry IS NULL OR DATETIME(expiry) > DATETIME('now'))

Fixes issue #260