Support arbitrary extension types in ExtensionPolicy#14964
Merged
Conversation
7b2dee1 to
8065f56
Compare
alex
reviewed
Jun 7, 2026
Comment on lines
+221
to
+223
| policy | ||
| .additional_extensions | ||
| .retain(|existing| existing.oid() != &oid); |
Member
There was a problem hiding this comment.
I don't think this retain is required -- we said registering these must be done only 1x.
The ExtensionPolicy builder methods (require_present, may_be_present, require_not_present) previously only accepted a fixed set of eight extension types and rejected everything else with "Unsupported extension OID". This made it impossible to account for otherwise unrecognized critical extensions (such as certificatePolicies), which would cause path validation to fail with "certificate contains unaccounted-for critical extensions". ExtensionPolicy now keeps the eight default-handled extensions in their dedicated fields and stores any other user-added extension validators in a separate list, so any extension type can be configured. A present extension whose value can't be parsed into a known Python object is now passed to the validator callback as an UnrecognizedExtension. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
alex
reviewed
Jun 7, 2026
Comment on lines
+236
to
+237
| // `configured_oids` guarantees we haven't already stored a | ||
| // validator for this OID, so we can push without deduplicating. |
alex
approved these changes
Jun 7, 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.
The ExtensionPolicy builder methods (require_present, may_be_present, require_not_present) previously only accepted a fixed set of eight extension types and rejected everything else with "Unsupported extension OID". This made it impossible to account for otherwise unrecognized critical extensions (such as certificatePolicies), which would cause path validation to fail with "certificate contains unaccounted-for critical extensions".
ExtensionPolicy now keeps the eight default-handled extensions in their dedicated fields and stores any other user-added extension validators in a separate list, so any extension type can be configured.
A present extension whose value can't be parsed into a known Python object is now passed to the validator callback as an UnrecognizedExtension.