Skip to content

fix: use upstream's File System Access path matcher - #55328

Merged
jkleinsc merged 3 commits into
mainfrom
security-fix/main/fsa-upstream-matcher
Oct 26, 2026
Merged

jkleinsc merged 3 commits into
mainfrom
security-fix/main/fsa-upstream-matcher

Conversation

@claude

@claude claude Bot commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

Requested by Keeley Hammond in Slack.

Description of Change

Electron kept its own copy of Chrome's File System Access path matcher (ShouldBlockAccessToPath() and the Windows MaybeIsLocalUNCPath() helpers). That copy never checked the suffix rules, so the write blocks on .git/hooks, .git/config and .git/modules were never enforced. It was also missing the hypervisor host-share UNC servers (mac, psf, vmware-host, .host, vboxsvr, vboxsrv) and the trailing-dot handling that upstream added in 158.0.8120.0. This PR extends refactor_expose_file_system_access_blocklist.patch to move upstream's ShouldBlockAccessToPath() and its UNC helpers into chrome_file_system_access_blocklist.cc. The code is copied verbatim and exposed as a static member of ChromeFileSystemAccessPermissionContext. Electron's own copy is deleted, and Electron now calls upstream's function and passes it the access trigger. As in Chrome, kBlockWrite rules therefore apply only to save-picker and programmatic write operations, and reads are still allowed. Because Electron now runs upstream's code, future upstream changes to the matcher will conflict when Chromium is rolled instead of quietly drifting. One behaviour change is deliberate: Electron's stricter UNC checks are replaced by upstream's. _ is now allowed in UNC server names. Only drive shares (X$) and the ADMIN$/IPC$/PRINT$/FAX$ admin shares are blocked, where Electron used to block every share ending in $. A new spec in spec/chromium.spec.ts covers the .git write blocks on all platforms.

Checklist

🤖 Generated with Claude Code

https://claude.ai/code/session_01MtuMgvwAcw7t9Q6HEB31Vx

Notes: Fixed File System Access blocklist gaps for .git files and UNC shares.

Electron kept its own copy of ShouldBlockAccessToPath() and the Windows
MaybeIsLocalUNCPath() helpers. That copy never evaluated the suffix block
rules, so the kBlockWrite rules for .git/hooks, .git/config and .git/modules
were not enforced, and it lacked the hypervisor host-share servers (mac, psf,
vmware-host, .host, vboxsvr, vboxsrv) and trailing-dot handling that upstream
added in 158.0.8120.0.

Extend refactor_expose_file_system_access_blocklist.patch to move upstream's
ShouldBlockAccessToPath() and its UNC helpers verbatim into
chrome_file_system_access_blocklist.cc, exposed as a static member of
ChromeFileSystemAccessPermissionContext, and call it from Electron with the
access trigger so kBlockWrite rules only apply to save and programmatic write
operations, matching Chrome. Future upstream changes to the matcher now
conflict on roll instead of drifting.

This replaces Electron's stricter UNC checks with upstream's: '_' is now
allowed in UNC server names, and only drive (X$) and ADMIN$/IPC$/PRINT$/FAX$
admin shares are blocked rather than every '$'-suffixed share.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01MtuMgvwAcw7t9Q6HEB31Vx
@claude claude Bot added no-backport semver/patch backwards-compatible bug fixes labels Oct 25, 2026
@claude

claude Bot commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor Author

The latest run on fb586e8 has one red test job, and it isn't caused by this PR:

  • windows-x64 test 1: three api-app.spec.ts "setPath(name, path) > sessionData" tests fail. The first attempt timed out waiting for the set-path fixture app to exit, and every retry then hit EPERM on %APPDATA%\electron-test-set-path, which the hung fixture still held. This shard doesn't run chromium.spec.ts, the same shard passed on windows-arm64, and main's latest run (40292334811) is green. I re-ran that job once and it passed.

The new UNC spec ("applies Chrome's local UNC path rules") passed on windows-x64 and windows-arm64 test 2. Its \\localhost.\ check was skipped on both runners because that name doesn't resolve there. All Linux and macOS jobs passed.


Generated by Claude Code

@claude claude Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I reviewed this PR from a standalone clone and didn't find any bugs. It changes the File System Access blocklist, and it loosens the Windows UNC checks on purpose (_ in server names, fewer $ shares blocked), so a human should still look at it.

What was reviewed:

  • Electron's side in shell/browser/file_system_access/file_system_access_permission_context.cc. The access trigger is passed from ConfirmSensitiveEntryAccess and the deferred-init callback into CheckShouldBlockAccessToPathAndReply. That function now posts upstream's static ShouldBlockAccessToPath to the thread pool, with normalization on and the profile path supplied.
  • How the extended refactor_expose_file_system_access_blocklist.patch lines up with the new static call site. I can't see the upstream matcher from this checkout, so I couldn't confirm the moved code is an exact copy.
  • The new .git/hooks / .git/config spec in spec/chromium.spec.ts. It records values in the listener and asserts in the test body.
Extended reasoning...

The change replaces Electron's own copy of the File System Access path matcher with upstream's. It extends a Chromium patch so the matcher and its UNC helpers move into a separate file and become public, and it passes the access trigger through Electron's permission context. This is security-sensitive: it decides which local and UNC paths web content can read or write. On Windows it also deliberately relaxes some UNC share and server-name blocks. The upstream code the patch moves can't be seen from this checkout, so whether it was copied exactly is unverified. Those two points, the security surface and the unverifiable upstream code, are why this defers rather than approves.

@MarshallOfSound

Copy link
Copy Markdown
Member

I think we need this backported to 46 as well, don't see a PR for that?

@claude

claude Bot commented Oct 26, 2026

Copy link
Copy Markdown
Contributor Author

Opened #55344 for 46-x-y.


Generated by Claude Code

…klist

Shares a fixture directory over loopback SMB and pastes it under different
UNC server and share names, checking that local server names (localhost,
127.0.0.1, and a trailing-dot localhost when it resolves) and drive admin
shares are blocked while other servers and non-admin hidden shares are not.
The hidden share and trailing-dot cases pin down the intentional changes
from Electron's previous matcher.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01MtuMgvwAcw7t9Q6HEB31Vx
Comment thread spec/chromium.spec.ts Resolved
Comment thread spec/chromium.spec.ts Resolved
A file URL drops a "localhost" host, so pasting \\localhost\share reached
Chromium as a path with no server. Drop that case; 127.0.0.1 and the
trailing-dot localhost still cover local server names.

Keep share names to 12 characters so net share doesn't stop to ask about
MS-DOS clients, and answer that prompt anyway in case it appears.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01MtuMgvwAcw7t9Q6HEB31Vx

@claude claude Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Code review found no issues

No high-confidence issues detected in this change.

@jkleinsc
jkleinsc merged commit 27e39e9 into main Oct 26, 2026
125 of 127 checks passed
@jkleinsc
jkleinsc deleted the security-fix/main/fsa-upstream-matcher branch October 26, 2026 20:57
@release-clerk

release-clerk Bot commented Oct 26, 2026

Copy link
Copy Markdown

Release Notes Persisted

Fixed File System Access blocklist gaps for .git files and UNC shares.

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

Labels

47-x-y no-backport semver/patch backwards-compatible bug fixes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants