Repository navigation
Conversation
TrustResolver.hash(), the key of the trust_tree_chains cache, covered the
starting entity, the trust anchors' entity IDs, the entity types and the
hints mode, but not the trust anchors' keys. A chain resolved and verified
with one JWKS was therefore returned from the cache, without verification,
for the same trust anchor ID with a different JWKS that would not verify
it: after a re-pin, after the TAJWKSRefresher dropped a retired key, or for
a caller holding other keys for the same trust anchor.
The key now also covers each trust anchor's keys, as the sorted RFC 7638
SHA-256 thumbprints of its JWKS ("none" without keys).
Fixes go-oidfed#216
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QYDqsx3UGxpCKvCiUxShZq
Contributor
|
|
Overall Grade |
Security Reliability Complexity Hygiene |
Code Review Summary
| Analyzer | Status | Updated (UTC) | Details |
|---|---|---|---|
| Go | Nov 12, 2026 3:50p.m. | Review ↗ | |
| Code coverage | Nov 12, 2026 4:20p.m. | Review ↗ |
Important
AI Review is run only on demand for your team. We're only showing results of static analysis review right now. To trigger AI Review, comment @deepsourcebot review on this thread.
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.
Fixes #216.
TrustResolver.hash()is the key of thetrust_tree_chainscache. It now covers each trust anchor's keys as well as its entity ID. The keys enter as a fingerprint: the sorted RFC 7638 SHA-256 thumbprints of its JWKS, ornonewithout keys.Before this change, a chain resolved and verified with one JWKS was returned from the cache, without verification, for the same trust anchor ID with a different JWKS. This happened:
TAJWKSRefresherdropped a retired key;Changes:
trustanchor.go: unexported(*TrustAnchor).keysFingerprint(). A key whose thumbprint can't be computed contributes its JSON form instead, so it still changes the fingerprint.trustresolver.go:hash()includes the fingerprints.The hash input is internal, so nothing changes for callers. Cached chains stay valid as long as the trust anchors' keys are unchanged. When the keys change, the next resolution builds and verifies the chain again.
Test (
trustresolver_cache_key_test.go): resolve rp → ia → ta with the trust anchor's JWKS, which yields a chain. Then resolve with an unrelated JWKS for the same trust anchor ID, which must yield no chain. Then resolve with the real JWKS again, which yields a chain. The second step fails onmain, where the cached chain is returned, and passes with this change.go test ./...andgo test -race .pass.go vetreports the same five copylocks warnings as onmain.🤖 Generated with Claude Code
https://claude.ai/code/session_01QYDqsx3UGxpCKvCiUxShZq