Repository navigation
Select the attestation extension nearest the root - #2
Merged
Merged
Conversation
- `parseChainExtensions` reads the root-most extension in the leaf-first chain and commits to it, so a prepended descendant cert cannot substitute a forged extension and a malformed ancestor fails closed instead of falling back to the leaf - Bound the chain to 1..8 certs and the extension to `MAX_EXTENSION_BYTES`; this hardens the unauthenticated local parse, it does not authenticate the chain
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.
What
HardwareAttestation.parseChainnow reads the attestation extension from thecertificate nearest the root in the leaf-first chain and commits to it — instead
of reading the leaf's and rejecting any chain where another cert also carries one.
Why
Android returns the chain leaf-first, so a prepended descendant certificate can carry
an attacker-added extension; reading the leaf would trust it. Taking the root-most
extension resists that substitution, and a malformed ancestor now fails closed rather
than silently falling back to the leaf.
This is the local, unauthenticated parse — it feeds
ENVIRONMENTposture signalsthat never reach
isRooted, and the server round-trip stays authoritative. It hardensparsing; it does not authenticate the chain.
Also
MAX_EXTENSION_BYTES).parseChainExtensionsas a tested seam. Four new unit tests cover theleaf-absent, descendant-cannot-override-ancestor, malformed-ancestor-no-fallback,
and wrong-challenge / missing / empty / oversized cases — all green.
1.2.0.