Repository navigation
bugfix: authenticate session tokens and randomize CBC IVs. - #46
Merged
Merged
Conversation
Replace the public MD5 prefix and fixed CBC IV with a versioned token containing a random IV and an HMAC-SHA256 tag. Authenticate the header and ciphertext before decryption. Derive the MAC key once per configured encryption key and share cached key material with inheriting configurations. Cleanse keys when the configuration pool is released, and rebuild them on reload. Add independent token vectors, tamper and expiry checks, binary boundary coverage, key isolation and inheritance checks, and random-source failure injection. Load the fault injector before Test::Nginx initializes so it also works under Valgrind. Validation: all 89 Test::Nginx assertions pass normally and under Valgrind on nginx 1.31.8 with OpenSSL 3.5.7. Additional probes confirm key derivation is absent from the request path and key rotation works after reload. BREAKING CHANGE: Legacy session tokens are rejected. The configured IV is ignored; all nodes exchanging tokens must upgrade together, and existing sessions must be reissued.
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.
Replace the public MD5 prefix and fixed CBC IV with a versioned token containing a random IV and an HMAC-SHA256 tag. Derive the MAC key separately and authenticate the header and ciphertext before decryption.
Add independent token vectors, tamper and expiry checks, binary boundary coverage, and random-source failure injection. Load the fault injector before Test::Nginx initializes so it also works under Valgrind.
Validation: all 86 Test::Nginx assertions pass on nginx 1.31.8 with OpenSSL 3.5.8. The random-source failure test also passes under Valgrind.
BREAKING CHANGE: Legacy session tokens are rejected. The configured IV is ignored; all nodes exchanging tokens must upgrade together, and existing sessions must be reissued.