Skip to content

Fix OSSL_parse_url() scheme and host parsing backport of #27357 - #31267

Closed
DDvO wants to merge 2 commits into
openssl:openssl-4.0from
siemens:fix_URL_scheme_parsing_backport_27357
Closed

DDvO wants to merge 2 commits into
openssl:openssl-4.0from
siemens:fix_URL_scheme_parsing_backport_27357

Conversation

@DDvO

@DDvO DDvO commented May 21, 2026

Copy link
Copy Markdown
Contributor

This backports the OSSL_parse_url() fixes of #27357, as requested by #27357 (comment).

@DDvO
DDvO requested review from Copilot and t8m May 21, 2026 14:55
@DDvO DDvO added approval: review pending This pull request needs review by a committer triaged: bug The issue/pr is/fixes a bug tests: present The PR has suitable tests present branch: 3.5 Applies to openssl-3.5 branch: 3.6 Applies to openssl-3.6 branch: 4.0 Applies to openssl-4.0 labels May 21, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Backports fixes to OSSL_parse_url() to parse URL schemes according to RFC 3986 constraints (avoiding false detection of schemes inside other URL components) and tightens IPv6 literal parsing to stay within the authority component. Updates the HTTP URL parsing tests to cover fragment handling and additional edge cases.

Changes:

  • Update OSSL_parse_url() scheme detection to only accept valid scheme characters and require the "://" delimiter.
  • Bound the search for the closing ] of an IPv6 literal to the authority section.
  • Extend test/http_test.c to validate fragment parsing (including fragments containing "://") and add an additional IP/port/path test.

Reviewed changes

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

File Description
crypto/http/http_lib.c Implements stricter, RFC-aligned scheme parsing and bounds IPv6 ] scanning to the authority component.
test/http_test.c Adds/adjusts URL parsing tests for fragments and additional URL forms to exercise the parsing changes.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread test/http_test.c
@DDvO DDvO changed the title Fix url scheme parsing backport 27357 Fix OSSL_parse_url() scheme and host parsing backport of #27357 May 21, 2026
@esyr esyr added the hold: wait for master The pull request must wait for approval of the equivalent change on master. label May 22, 2026
Comment thread crypto/http/http_lib.c
Comment on lines +87 to +88
&& (ossl_isalpha(*p)
|| ossl_isdigit(*p)

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.

nit:
ossl_isalnum() can be used

@openssl-machine openssl-machine added approval: done This pull request has the required number of approvals approval: ready to merge The 24 hour grace period has passed, ready to merge and removed approval: review pending This pull request needs review by a committer approval: done This pull request has the required number of approvals labels Jun 2, 2026
@openssl-machine

Copy link
Copy Markdown
Collaborator

This pull request is ready to merge

@DDvO DDvO removed the hold: wait for master The pull request must wait for approval of the equivalent change on master. label Jun 10, 2026
@DDvO

DDvO commented Jun 10, 2026

Copy link
Copy Markdown
Contributor Author

Lifted the hold since #27357 is now merged to master.

openssl-machine pushed a commit that referenced this pull request Jun 10, 2026
Reviewed-by: Eugene Syromiatnikov <[email protected]>
Reviewed-by: Norbert Pocs <[email protected]>
MergeDate: Wed Jun 10 07:15:38 2026
(Merged from #31267)
openssl-machine pushed a commit that referenced this pull request Jun 10, 2026
Reviewed-by: Eugene Syromiatnikov <[email protected]>
Reviewed-by: Norbert Pocs <[email protected]>
MergeDate: Wed Jun 10 07:15:39 2026
(Merged from #31267)
openssl-machine pushed a commit that referenced this pull request Jun 10, 2026
Reviewed-by: Eugene Syromiatnikov <[email protected]>
Reviewed-by: Norbert Pocs <[email protected]>
MergeDate: Wed Jun 10 07:15:38 2026
(Merged from #31267)

(cherry picked from commit 6e3627d)
openssl-machine pushed a commit that referenced this pull request Jun 10, 2026
Reviewed-by: Eugene Syromiatnikov <[email protected]>
Reviewed-by: Norbert Pocs <[email protected]>
MergeDate: Wed Jun 10 07:15:39 2026
(Merged from #31267)

(cherry picked from commit 58ebe68)
openssl-machine pushed a commit that referenced this pull request Jun 10, 2026
Reviewed-by: Eugene Syromiatnikov <[email protected]>
Reviewed-by: Norbert Pocs <[email protected]>
MergeDate: Wed Jun 10 07:15:38 2026
(Merged from #31267)

(cherry picked from commit 6e3627d)
openssl-machine pushed a commit that referenced this pull request Jun 10, 2026
Reviewed-by: Eugene Syromiatnikov <[email protected]>
Reviewed-by: Norbert Pocs <[email protected]>
MergeDate: Wed Jun 10 07:15:39 2026
(Merged from #31267)

(cherry picked from commit 58ebe68)
@DDvO

DDvO commented Jun 10, 2026

Copy link
Copy Markdown
Contributor Author

Merged this backport to 4.0, 3.6, and 3.5 - thanks @esyr and @jogme for your swift approvals.

@DDvO DDvO closed this Jun 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approval: ready to merge The 24 hour grace period has passed, ready to merge branch: 3.5 Applies to openssl-3.5 branch: 3.6 Applies to openssl-3.6 branch: 4.0 Applies to openssl-4.0 tests: present The PR has suitable tests present triaged: bug The issue/pr is/fixes a bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants