Skip to content

fix: validate protocol scheme names in setAsDefaultProtocolClient#50157

Merged
jkleinsc merged 1 commit into38-x-yfrom
trop/38-x-y-bp-fix-validate-protocol-scheme-names-in-setasdefaultprotocolclient--1773080205478
Mar 10, 2026
Merged

fix: validate protocol scheme names in setAsDefaultProtocolClient#50157
jkleinsc merged 1 commit into38-x-yfrom
trop/38-x-y-bp-fix-validate-protocol-scheme-names-in-setasdefaultprotocolclient--1773080205478

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 38-x-y backport This is a backport PR semver/patch backwards-compatible bug fixes labels Mar 9, 2026
@jkleinsc jkleinsc merged commit fbc489c into 38-x-y Mar 10, 2026
152 of 156 checks passed
@jkleinsc jkleinsc deleted the trop/38-x-y-bp-fix-validate-protocol-scheme-names-in-setasdefaultprotocolclient--1773080205478 branch March 10, 2026 11:28
@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

38-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