Repository navigation
fix(workcontext): reject noncanonical base64url token encodings - #850
Merged
Merged
Conversation
Require both token segments to match their unpadded base64url re-encoding in the shared decoder. Cover all four entrypoints and preserve empty-signature classification. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Fix: the shared Work Context decoder accepted nonzero unused base64 bits and embedded CR/LF that Authority's Python and TypeScript readers reject. Both token segments must now equal their unpadded base64url re-encoding. Existing protobuf canonicalization and foreign-JSON refusal remain in the same decoder, and empty signatures retain their signature-failure classification.
Reuses
decodeClaimsfor Decode, Verify, Authenticate and Inspect; no parallel validator or generated-file changes. Regression coverage checks canonical controls, unused bits, padding, CR, LF and CRLF on both segments through all four entrypoints. The test fails against the old decoder and passes with the fix.Validation:
go test -race -count=1 ./workcontext/...passed. Full localgo vet ./...andgo test -race -count=1 ./... -timeout 10mare in progress; CI supplies the Linux integration and additional repository gates. No deployment or proto-companion qualification was attempted.Closes the encoding-parity blocker for codefly-dev/authority#26, which will pin this PR head and run its shared 17 encoding cases in Go, Python and TypeScript. Coordinator owns review and merge of this PR.