codebytere

#50141: fix: validate protocol scheme names in setAsDefaultProtocolClient

Merged
Created: Mar 9, 2026, 9:48:08 AM
Merged: Mar 9, 2026, 1:16:34 PM
5 comments
Target: main

Description of Change

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.

Checklist

Release Notes

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

Backports

38-x-y
Merged
PR Number
#50157
Merged At
Mar 10, 2026, 6:28:57 AM
Released In
Not yet
Release Date
Not yet
39-x-y
Merged
PR Number
#50156
Merged At
Mar 10, 2026, 6:27:59 AM
Released In
Not yet
Release Date
Not yet
40-x-y
Merged
PR Number
#50158
Merged At
Mar 10, 2026, 12:04:28 AM
Released In
Not yet
Release Date
Not yet
41-x-y
Merged
PR Number
#50155
Merged At
Mar 9, 2026, 6:06:57 PM
Released In
Not yet
Release Date
Not yet

Semver Impact

Major
Breaking changes
Minor
New features
Patch
Bug fixes
None
Docs, tests, etc.

Semantic Versioning helps users understand the impact of updates:

  • Major (X.y.z): Breaking changes that may require code modifications
  • Minor (x.Y.z): New features that maintain backward compatibility
  • Patch (x.y.Z): Bug fixes that don't change the API
  • None: Changes that don't affect using facing parts of Electron