Skip to content

Allow callers to ignore selected critical extensions#485

Open
xyzzyz wants to merge 1 commit intorustls:mainfrom
xyzzyz:feature/ignore-critical-extensions
Open

Allow callers to ignore selected critical extensions#485
xyzzyz wants to merge 1 commit intorustls:mainfrom
xyzzyz:feature/ignore-critical-extensions

Conversation

@xyzzyz
Copy link
Copy Markdown

@xyzzyz xyzzyz commented Apr 29, 2026

I'm working with a system that uses private critical extensions on X.509 certificate. They don't play a role during building a path, but are then used to enforce constraints on the objects being authenticated. Therefore, I'd like to be able to make rustls-webpki ignore these extensions when building a path, and verify these later separately.

I don't like how I had to add a new method to make sure that API is backwards-compatible. I think that verify_for_usage already has too many arguments as it is. I'd suggest adding a new API that's extensible by design: it should take an Options sort of an object as argument, the fields of which should be private; this way new functionality can be added by adding new public methods on the Options object.

I could do it in a separate PR, and then once it's merged, rebase this one on top of the other one. Thoughts?

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 29, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.03%. Comparing base (55a52f3) to head (88fc6de).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #485      +/-   ##
==========================================
+ Coverage   96.97%   97.03%   +0.05%     
==========================================
  Files          20       20              
  Lines        3936     4007      +71     
==========================================
+ Hits         3817     3888      +71     
  Misses        119      119              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Add ExtensionId and an opt-in EndEntityCert constructor that accepts a DER OID allowlist for unsupported critical extensions on the leaf certificate. Existing TryFrom parsing remains strict by default.

Add verify_for_usage_with_ignored_critical_extensions so callers can explicitly apply an allowlist when path building parses intermediate certificates. Existing verify_for_usage remains strict for intermediates.

Supported extensions are still parsed and validated normally; the allowlist only suppresses UnsupportedCriticalExtension for exact OID matches. Add integration tests for leaf and intermediate allowlisting, exact-match behavior, and supported-extension parsing.
@xyzzyz xyzzyz force-pushed the feature/ignore-critical-extensions branch from 1667c76 to 88fc6de Compare April 29, 2026 04:02
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.

1 participant