Skip to content

fix(workcontext): reject noncanonical base64url token encodings - #850

Merged
antoinetoussaint-byte merged 1 commit into
mainfrom
fix/canonical-token-encoding
Oct 26, 2026
Merged

antoinetoussaint-byte merged 1 commit into
mainfrom
fix/canonical-token-encoding

Conversation

@antoinetoussaint-byte

Copy link
Copy Markdown
Contributor

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 decodeClaims for 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 local go vet ./... and go test -race -count=1 ./... -timeout 10m are 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.

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>
@antoinetoussaint-byte
antoinetoussaint-byte merged commit d1306db into main Oct 26, 2026
10 checks passed
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