Skip to content

reject expired sessions in FileStore::contains - #1279

Open
nishat-06 wants to merge 1 commit into
CrowCpp:masterfrom
nishat-06:filestore-reject-expired-session
Open

nishat-06 wants to merge 1 commit into
CrowCpp:masterfrom
nishat-06:filestore-reject-expired-session

Conversation

@nishat-06

Copy link
Copy Markdown
Contributor

Expired FileStore sessions are still accepted

FileStore only enforces expiry through handle_expired(), which evicts at most 3 sessions per load, and contains() never looks at the expiration time. Once more than 3 sessions have expired, a cookie for any expired session that isn't among the 3 oldest still passes contains() in SessionMiddleware::before_handle and gets loaded, so a leaked session id outlives its expiration. contains() now evicts and rejects a key whose tracked expiry has passed.

Repro: FileStore{dir, 0}, log in 8 sessions, wait 1s, request each with its cookie. On master one of them still returned the logged-in user; with the fix, none do. crow_filestore_rejects_expired_session fails on master and passes with the patch, and ctest is green.

This branch has not been deployed

No deployments
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.

1 participant