Add Flask Session operations (Decode, Sign, Verify)#2208
Merged
GCHQDeveloper581 merged 4 commits intogchq:masterfrom Mar 7, 2026
Merged
Add Flask Session operations (Decode, Sign, Verify)#2208GCHQDeveloper581 merged 4 commits intogchq:masterfrom
GCHQDeveloper581 merged 4 commits intogchq:masterfrom
Conversation
GCHQDeveloper581
requested changes
Mar 3, 2026
Contributor
There was a problem hiding this comment.
Please could we have some more tests:
- Need a test for FlaskSessionSign (can pair with FlaskSessionVerify to do a round trip)
- Need to test sha256 as well as sha1
- Tests for failure modes (invalid token, invalid signature, etc)
I think there should also be an option to display the decoded timestamp - either a separate Operation, an option to one/both of Decode and Verify, or make it something Verify does. My slight preference would be for both an option on Decode and part of the normal output from Verify - that way it can be decoded even if the key/salt are unknown.
GCHQDeveloper581
approved these changes
Mar 7, 2026
Contributor
GCHQDeveloper581
left a comment
There was a problem hiding this comment.
Looks good! Thanks for your contribution.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds three new operations for working with Flask session cookies
(itsdangerous format):
session cookie into JSON, without requiring the secret key.
produces a valid Flask session cookie with HMAC signature.
session cookie and returns the decoded payload if valid.
These operations are useful for CTF challenges, penetration testing,
and debugging Flask applications.
New Operations
Testing
Tested against real Flask session cookies generated with Flask's
built-in SecureCookieSessionInterface.