Skip to content

certificatePolicies fixes - #11221

Open
gasbytes wants to merge 1 commit into
wolfSSL:masterfrom
gasbytes:certificatePolicies-fix
Open

certificatePolicies fixes#11221
gasbytes wants to merge 1 commit into
wolfSSL:masterfrom
gasbytes:certificatePolicies-fix

Conversation

@gasbytes

@gasbytes gasbytes commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

Description

Two simple and small fixes on how certificatePolicies are handled:

  1. reject empty certificatePolicies (since they are outside the boundary of 1 to MAX as defined from the RFC);
  2. reject trailing bytes after the last PolicyInformation in certificatePolicies rather than skipped;

And a minor edit updating the whitebox notes to match with these changes.

Testing

Added two regression tests, one for each test.

Checklist

  • added tests
  • updated/added doxygen
  • updated appropriate READMEs
  • Updated manual and documentation

Copilot AI lite review requested due to automatic review settings August 20, 2026 15:46
@gasbytes gasbytes self-assigned this Aug 20, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR tightens X.509 certificatePolicies extension parsing to better match RFC 5280 requirements and adds regression coverage to prevent acceptance of malformed inputs.

Changes:

  • Reject empty certificatePolicies sequences (RFC 5280 §4.2.1.4: SEQUENCE SIZE (1..MAX)).
  • Ensure trailing bytes after the final PolicyInformation are rejected (not silently ignored).
  • Add/adjust regression tests exercising both conditions.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
wolfcrypt/src/asn.c Enforces non-empty certificatePolicies and iterates through the full decoded sequence to catch trailing junk.
tests/unit-mcdc/test_asn_ext_whitebox.c Updates whitebox expectation for empty certificatePolicies to require failure.
tests/api/test_asn.h Adds declarations/registration for new ASN extension regression tests.
tests/api/test_asn.c Adds regression tests for empty certificatePolicies and trailing-junk rejection.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread tests/unit-mcdc/test_asn_ext_whitebox.c Outdated
@gasbytes
gasbytes force-pushed the certificatePolicies-fix branch from dae7c7c to 0653ac9 Compare August 20, 2026 16:06
@gasbytes
gasbytes marked this pull request as ready for review August 20, 2026 16:57
@gasbytes
gasbytes force-pushed the certificatePolicies-fix branch from 0653ac9 to 952c579 Compare August 20, 2026 16:57
@github-actions

Copy link
Copy Markdown

retest this please

must be 1..MAX as per RFC 5280 4.2.1.4;
- asn: reject trailing bytes after the last PolicyInformation in certificatePolicies;
- minor edit updating the whitebox notes to match with these new
  changes;
@gasbytes
gasbytes force-pushed the certificatePolicies-fix branch from a222443 to e0d985d Compare August 21, 2026 14:12
@gasbytes

Copy link
Copy Markdown
Contributor Author

Jenkins retest this please. (TIMEOUT)

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.

2 participants