Repository navigation
fix: use upstream's File System Access path matcher - #55328
Conversation
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
|
The latest run on fb586e8 has one red test job, and it isn't caused by this PR:
The new UNC spec ("applies Chrome's local UNC path rules") passed on windows-x64 and windows-arm64 test 2. Its Generated by Claude Code |
There was a problem hiding this comment.
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 fromConfirmSensitiveEntryAccessand the deferred-init callback intoCheckShouldBlockAccessToPathAndReply. That function now posts upstream's staticShouldBlockAccessToPathto the thread pool, with normalization on and the profile path supplied. - How the extended
refactor_expose_file_system_access_blocklist.patchlines 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/configspec inspec/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.
|
I think we need this backported to 46 as well, don't see a PR for that? |
|
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
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
|
Release Notes Persisted
|
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 WindowsMaybeIsLocalUNCPath()helpers). That copy never checked the suffix rules, so the write blocks on.git/hooks,.git/configand.git/moduleswere 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 extendsrefactor_expose_file_system_access_blocklist.patchto move upstream'sShouldBlockAccessToPath()and its UNC helpers intochrome_file_system_access_blocklist.cc. The code is copied verbatim and exposed as a static member ofChromeFileSystemAccessPermissionContext. Electron's own copy is deleted, and Electron now calls upstream's function and passes it the access trigger. As in Chrome,kBlockWriterules 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 theADMIN$/IPC$/PRINT$/FAX$admin shares are blocked, where Electron used to block every share ending in$. A new spec inspec/chromium.spec.tscovers the.gitwrite blocks on all platforms.Checklist
npm testpasses🤖 Generated with Claude Code
https://claude.ai/code/session_01MtuMgvwAcw7t9Q6HEB31Vx
Notes: Fixed File System Access blocklist gaps for
.gitfiles and UNC shares.