Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Incorrect SQLite expire check #261

Merged

Conversation

dkulic
Copy link
Contributor

@dkulic dkulic commented May 30, 2024

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

Signed-off-by: Darko Kulic <darko.kulic@sicpa.com>
Copy link
Contributor

@andrewwhitehead andrewwhitehead left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@andrewwhitehead andrewwhitehead merged commit 19034c9 into openwallet-foundation:main Jun 5, 2024
30 checks passed
@dkulic dkulic deleted the fix/sqlite_expire_check branch June 6, 2024 16:06
jamshale pushed a commit to jamshale/aries-askar that referenced this pull request Aug 18, 2024
…xpire_check

fix: Incorrect SQLite expire check
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants