Repository navigation
Test that Token.sign forwards key_length - #6881
Open
renanmpimentel wants to merge 1 commit into
Open
renanmpimentel wants to merge 1 commit into
renanmpimentel wants to merge 1 commit into
Conversation
This branch has not been deployed
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
Add a test that
Phoenix.Token.sign/4forwards:key_lengthto the key generator. It compares deterministic tokens made with lengths 16 and 32, verifies the 16-byte token with the matching option, and checks that the mismatched length is rejected.Why
The documentation lists
:key_lengthas a signing option, but the existing token tests compare only:key_iterationsand:key_digest. Thekey defaultstest explicitly uses the default length (32), so discarding:key_lengthinsign/4leaves the entire existing suite green.The regression was applied in an isolated worktree:
sign/4discards:key_lengthThe permanent diff changes only
test/phoenix/token_test.exs.Verification
mix format --check-formatted test/phoenix/token_test.exs: passedmix compile --warnings-as-errors: passedmix test --warnings-as-errors: 1,112 passed, 33 excludedgit diff --check: passedOne earlier full run had a timing failure in the unrelated
crashed channel propagates exittest (200 ms assertion window); that test passed in isolation and the full suite passed on rerun.Found with Supertest, an audit method for test effectiveness.