fix(provider): validate peer chain before invoking SpiffeIdVerifier#449
Open
bcleenders wants to merge 1 commit into
Open
fix(provider): validate peer chain before invoking SpiffeIdVerifier#449bcleenders wants to merge 1 commit into
bcleenders wants to merge 1 commit into
Conversation
`SpiffeTrustManager` invoked the `SpiffeIdVerifier` before any cryptographic validation. The callback received an unvalidated, attacker-supplied chain despite the verifier's [API spec calling it `verifiedChain`](https://github.com/spiffe/java-spiffe/blob/55200fc8e6b01f9da5951c379e4f4187d7f920b7/java-spiffe-provider/src/main/java/io/spiffe/provider/SpiffeIdVerifier.java#L13). Validate the chain against the trust bundle first and only then invoke the verifier. This matches go-spiffe, where [the `Authorizer` only receives chains returned by `x509svid.ParseAndVerify`](https://github.com/spiffe/go-spiffe/blob/v2.8.1/spiffetls/tlsconfig/config.go#L193-L201) (`ParseAndVerify` first checks the certificates, afterwards `Authorizer` checks if the SPIFFE ID is authorized). Observable change: for a chain that is both untrusted and carries an unacceptable SPIFFE ID, the reported error is now the chain validation failure, rather than the verifier error. There is a small conflict on imports with spiffe#433 , so if you poke me after that one is merged, I'm happy to rebase. Signed-off-by: bcleenders <[email protected]>
bcleenders
force-pushed
the
fix/verifier-ordering-main
branch
from
July 22, 2026 12:05
077a494 to
f61791b
Compare
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.
SpiffeTrustManagerinvoked theSpiffeIdVerifierbefore any cryptographic validation.The callback received an unvalidated, attacker-supplied chain despite the verifier's API spec calling it
verifiedChain.Validate the chain against the trust bundle first and only then invoke the verifier.
This matches go-spiffe, where the
Authorizeronly receives chains returned byx509svid.ParseAndVerify(ParseAndVerifyfirst checks the certificates, afterwardsAuthorizerchecks if the SPIFFE ID is authorized).Observable change: for a chain that is both untrusted and carries an unacceptable SPIFFE ID, the reported error is now the chain validation failure, rather than the verifier error.
There is a small conflict on imports with #433 , so if you poke me after that one is merged, I'm happy to rebase.