Skip to content

Reject root-path leaf SPIFFE IDs in X509SvidValidator.verifyChain - #511

Open
cvas22 wants to merge 2 commits into
spiffe:mainfrom
cvas22:validate-leaf-path
Open

cvas22 wants to merge 2 commits into
spiffe:mainfrom
cvas22:validate-leaf-path

Conversation

@cvas22

@cvas22 cvas22 commented Nov 13, 2026

Copy link
Copy Markdown

Fixes #510

I moved the non-root path check from X509Svid into X509SvidProfile so validateLeaf runs it too. That way SpiffeTrustManager rejects a peer leaf like spiffe://example.org the same way X509Svid.parse already does, and the error message stays the same. Added a verifyChain test with a root-path leaf signed by a trusted CA, plus a changelog entry.

X509Svid.parse already rejected a leaf whose SPIFFE ID has no path, but
verifyChain, used by SpiffeTrustManager for peer certificates, did not.
Move the check into X509SvidProfile.validateLeaf so both paths enforce it.

Fixes spiffe#510

Signed-off-by: Srinivas Chippagiri <cvas22@gmail.com>
@maxlambrecht

Copy link
Copy Markdown
Member

hey @cvas22, thanks for this!

Could you add a SpiffeTrustManagerTest regression asserting that both checkClientTrusted and checkServerTrusted reject a root-path leaf, even with acceptAnySpiffeId enabled?

Cover checkClientTrusted and checkServerTrusted with a trust manager that
accepts any SPIFFE ID, so the leaf path check can't be bypassed there.

Signed-off-by: Srinivas Chippagiri <cvas22@gmail.com>
@cvas22

cvas22 commented Nov 13, 2026

Copy link
Copy Markdown
Author

Sure, added it in 31a44b0. It checks both checkClientTrusted and checkServerTrusted with the accept-any trust manager. thx

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.

X509SvidValidator.verifyChain accepts a leaf whose SPIFFE ID has no path

2 participants