[Attestation] Reject attestation tokens whose signature cannot be verified - #50449
Merged
Olga Kroshkina (olkroshk) merged 3 commits intoSep 15, 2026
Merged
Olga Kroshkina (olkroshk) merged 3 commits into
Olga Kroshkina (olkroshk) merged 3 commits into
Conversation
|
Azure Pipelines: Successfully started running 1 pipeline(s). 34 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
Olga Kroshkina (olkroshk)
marked this pull request as ready for review
September 14, 2026 23:14
Olga Kroshkina (olkroshk)
requested review from
a team,
anilba06 and
Greg Kostal (gkostal)
as code owners
September 14, 2026 23:14
|
Azure Pipelines: Successfully started running 1 pipeline(s). 34 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
Copilot started reviewing on behalf of
Olga Kroshkina (olkroshk)
September 14, 2026 23:15
View session
Contributor
There was a problem hiding this comment.
🔵 Needs a closer look
The changes require final human review because they are too complex or risky for automated approval.
Pull request overview
Hardens attestation token validation against signature-verification bypasses.
Changes:
- Rejects signed tokens that cannot be verified by trusted signers.
- Removes trust in certificates embedded within tokens when no signers are supplied.
- Adds offline regression tests and changelog entries.
File summaries
| File | Description |
|---|---|
| sdk/attestation/azure-security-attestation/src/test/java/com/azure/security/attestation/models/AttestationTokenValidationTests.java | Updated as part of this pull request. |
| sdk/attestation/azure-security-attestation/src/test/java/com/azure/security/attestation/models/AttestationTokenTests.java | Updated as part of this pull request. |
| sdk/attestation/azure-security-attestation/src/main/java/com/azure/security/attestation/implementation/models/AttestationTokenImpl.java | Updated as part of this pull request. |
| sdk/attestation/azure-security-attestation/CHANGELOG.md | Updated as part of this pull request. |
Review details
Suppressed comments (1)
sdk/attestation/azure-security-attestation/src/main/java/com/azure/security/attestation/implementation/models/AttestationTokenImpl.java:481
- This branch no longer follows the helper's Javadoc contract: the documentation above still says that when
signersis absent it consults the JWS header for candidate keys, but this code now rejects that case instead of using embedded key material. Please update that Javadoc to state that signed-token validation requires a caller-supplied trusted signer list and never trusts keys embedded in the token.
// No trusted signers were provided. Do NOT fall back to the key material embedded in the
// token itself - that would let a token vouch for its own signature and bypass validation
// (CWE-347). Mirror the other Azure Attestation SDKs and fail closed.
throw LOGGER.logExceptionAsError(
new RuntimeException("Unable to find any certificates which can be used to validate the token."));
- Files reviewed: 4/4 changed files
- Comments generated: 0
- Review effort level: Lite
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
Copilot started reviewing on behalf of
Olga Kroshkina (olkroshk)
September 14, 2026 23:46
View session
Alan Zimmer (alzimmermsft)
approved these changes
Sep 15, 2026
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.
Description
This pull request fixes a signature verification bypass. In AttestationTokenImpl, validateTokenSignature() returned null for two distinct outcomes — an unsigned token (alg: none) and a signed token that no trusted signer could verify — and validate() accepted both. The null result was only meant to represent "no signature to check," but it was also being returned (and accepted) for "the signature matched no trusted key," so a token signed with an untrusted key passed validation.
This change distinguishes the two cases:
It also removes a fallback where a token with no supplied signers was verified against its own embedded certificate — letting it vouch for itself — which now fails closed.
All SDK Contribution checklist:
General Guidelines and Best Practices
Testing Guidelines