asn: improve URI host extraction - #11439
Conversation
There was a problem hiding this comment.
Warning
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Pull request overview
Improves URI host extraction for ASN name-constraints by requiring a valid RFC 3986 scheme and only accepting an authority (//...) immediately after the scheme colon, preventing accidental host extraction from :// sequences later in the URI.
Changes:
- Added
GetUriSchemeEnd()to validate scheme syntax and find the scheme colon. - Updated
GetUriHost()to use scheme-aware authority detection instead of scanning for://anywhere. - Expanded unit and API tests to cover scheme validation and “embedded URL” scenarios in paths/queries/fragments.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| wolfcrypt/src/asn.c | Adds scheme parsing helper and tightens authority/host detection to only the initial scheme delimiter. |
| tests/unit-mcdc/test_asn_ext_whitebox.c | Updates whitebox/MCDC coverage to directly exercise scheme parsing and the new authority guard. |
| tests/api/test_asn.c | Adds API-level regression tests for scheme syntax and ensuring later https://... substrings don’t affect host matching. |
Suppressed comments (1)
wolfcrypt/src/asn.c:1
GetUriSchemeEnd()relies on the loop condition to handleuriSz <= 0. Adding an explicituriSz <= 0early-return alongside theuri == NULLguard would make the contract clearer and keep the helper robust/consistent when called independently (e.g., from tests or future code paths).
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
wolfSSL-Fenrir-bot
left a comment
There was a problem hiding this comment.
Fenrir Automated Review — PR #11439
Scan targets checked: wolfcrypt-src, wolfcrypt-bugs, wolfssl-bugs
Fenrir result: Approved ✅
No new issues found in the changed files.
Advisory only — this automated result does not count as a GitHub approval.
|
Description
Credit to Satoru Kanno (@satokan)