Skip to content

fix: validate protocol scheme names in setAsDefaultProtocolClient#50156

Merged
jkleinsc merged 1 commit into39-x-yfrom
trop/39-x-y-bp-fix-validate-protocol-scheme-names-in-setasdefaultprotocolclient--1773080204470
Mar 10, 2026
Merged

fix: validate protocol scheme names in setAsDefaultProtocolClient#50156
jkleinsc merged 1 commit into39-x-yfrom
trop/39-x-y-bp-fix-validate-protocol-scheme-names-in-setasdefaultprotocolclient--1773080204470

Conversation

@trop
Copy link
Copy Markdown
Contributor

@trop trop bot commented Mar 9, 2026

Backport of #50141

See that PR for details.

Notes: Added validation to protocol client methods to reject protocol names that do not conform to the RFC 3986 URI scheme grammar.

On Windows, `app.setAsDefaultProtocolClient(protocol)` directly
concatenates the protocol string into the registry key path with no
validation. A protocol name containing `\` could write to an arbitrary
subkey under `HKCU\Software\Classes\`, potentially hijacking existing
protocol handlers.

To fix this, add `Browser::IsValidProtocolScheme()` which validates that a protocol
name conforms to the RFC 3986 scheme grammar:

  scheme = ALPHA *( ALPHA / DIGIT / "+" / "-" / "." )

This rejects backslashes, forward slashes, whitespace, and any other
characters not permitted in URI schemes.

Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
@trop trop bot requested review from a team and codebytere March 9, 2026 18:17
@trop trop bot added 39-x-y backport This is a backport PR semver/patch backwards-compatible bug fixes labels Mar 9, 2026
@jkleinsc jkleinsc merged commit 0e6e480 into 39-x-y Mar 10, 2026
155 of 159 checks passed
@release-clerk
Copy link
Copy Markdown

release-clerk bot commented Mar 10, 2026

Release Notes Persisted

Added validation to protocol client methods to reject protocol names that do not conform to the RFC 3986 URI scheme grammar.

@jkleinsc jkleinsc deleted the trop/39-x-y-bp-fix-validate-protocol-scheme-names-in-setasdefaultprotocolclient--1773080204470 branch March 10, 2026 11:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

39-x-y backport This is a backport PR semver/patch backwards-compatible bug fixes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants