Repository navigation
refactor: compile upstream FSA blocklist helpers instead of copying them - #54751
Conversation
…cklist
Chromium 156.0.8078.3 already contains upstream 64c8e2a1ceda ("[FSA] Block
macOS firmlink alias paths to sensitive directories"), but
refactor_expose_file_system_access_blocklist.patch re-adds
NormalizeFilePath()/GenerateBlockPaths() as static members in the header
without the new pieces, so Electron's copy of the blocklist does not carry
the fix.
Update the patch's header copy to match upstream: add the
MaybeStripMacDataVolumePrefix() and NormalizeFilePathForBlocklist() static
helpers, the /System/Volumes kBlockAllChildren rule, and normalize
generated rules through NormalizeFilePathForBlocklist().
Refs https://chromium-review.googlesource.com/c/chromium/src/+/8410087 (upstream commit 64c8e2a1cedafdbcc750abc423ad9b389537c223)
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01MtuMgvwAcw7t9Q6HEB31Vx
…klist checks Switches Electron's copy of ShouldBlockAccessToPath() to the NormalizeFilePathForBlocklist() helper (from upstream 64c8e2a1ceda, exposed in the header by the companion refactor_expose_file_system_access_blocklist patch update), so paths spelled via /System/Volumes/Data are matched against the root-namespace blocklist rules the same way Chrome does. Refs https://chromium-review.googlesource.com/c/chromium/src/+/8410087 (upstream commit 64c8e2a1cedafdbcc750abc423ad9b389537c223) Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01MtuMgvwAcw7t9Q6HEB31Vx
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01MtuMgvwAcw7t9Q6HEB31Vx
refactor_expose_file_system_access_blocklist.patch used to hand-copy upstream's NormalizeFilePath(), NormalizeFilePathForBlocklist() and GenerateBlockPaths() into the header as inline static members. Since #53634 dropped the .cc hunks, upstream edits to the originals no longer conflict on roll, so the copy goes stale silently (this is how the firmlink fix 64c8e2a1ceda was lost on the M156 roll; main's copy also still keeps the .git/hooks rule Windows-only, while upstream applies it on all platforms). Instead, declare NormalizeFilePathForBlocklist() and GenerateBlockPaths() as static members in the header and move upstream's definitions verbatim out of chrome_file_system_access_permission_context.cc into a new chrome_file_system_access_blocklist.cc, which Electron now compiles as part of //electron/chromium_src:chrome. Upstream changes to the blocklist now conflict loudly on the removal hunk instead of being dropped. Electron's call sites are unchanged. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01MtuMgvwAcw7t9Q6HEB31Vx
Regenerate the index line for chrome_file_system_access_permission_context.cc in refactor_expose_file_system_access_blocklist.patch so the patch round-trips through `e patches chromium` against 156.0.8078.3 (fixes "needs update" in the checkout jobs). Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01MtuMgvwAcw7t9Q6HEB31Vx
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01MtuMgvwAcw7t9Q6HEB31Vx
Regenerate the index line for chrome_file_system_access_permission_context.cc in refactor_expose_file_system_access_blocklist.patch against 157.0.8085.0 after merging main (Chromium roll #54590), matching the update-patches.patch artifact from the failed apply-patches check. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01MtuMgvwAcw7t9Q6HEB31Vx
|
Generated by Claude Code |
… firmlink spec Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01MtuMgvwAcw7t9Q6HEB31Vx
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01MtuMgvwAcw7t9Q6HEB31Vx
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01MtuMgvwAcw7t9Q6HEB31Vx
Resolved the conflict in patches/chromium/refactor_expose_file_system_access_blocklist.patch in favour of this branch's split version, which already carries the firmlink handling from #54679 in chrome_file_system_access_blocklist.cc. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01MtuMgvwAcw7t9Q6HEB31Vx
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01MtuMgvwAcw7t9Q6HEB31Vx
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01MtuMgvwAcw7t9Q6HEB31Vx
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01MtuMgvwAcw7t9Q6HEB31Vx
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01MtuMgvwAcw7t9Q6HEB31Vx
|
This doesn't look like it comes from this PR:
So this looks like a flaky crash in the bundler. I'll re-run the failed job once the rest of the run finishes. Generated by Claude Code |
|
Two more CI failures on run 39499976583 (head 4855bd6) are infrastructure issues and not caused by this PR. The linux-x64 bundler segfault was covered in the comment above.
This PR only changes the FSA blocklist patch and Generated by Claude Code |
Rebase refactor_expose_file_system_access_blocklist.patch onto 158.0.8118.0 and carry the upstream kBlockPaths additions from that version into chrome_file_system_access_blocklist.cc. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01MtuMgvwAcw7t9Q6HEB31Vx
| + // Block write access to */.git/hooks, see crbug.com/465668234 and | ||
| + // crbug.com/553115714. | ||
| + BlockPath::CreateSuffix(FILE_PATH_LITERAL(".git/hooks"), | ||
| + BlockType::kBlockWrite), | ||
| + // Block write access to the repository config and to submodule git | ||
| + // directories, which have their own hooks and config, see | ||
| + // crbug.com/572269631 and crbug.com/571913154. | ||
| + BlockPath::CreateSuffix(FILE_PATH_LITERAL(".git/config"), | ||
| + BlockType::kBlockWrite), | ||
| + BlockPath::CreateSuffix(FILE_PATH_LITERAL(".git/modules"), | ||
| + BlockType::kBlockWrite), |
There was a problem hiding this comment.
🟣 pre-existing, not blocking: Pre-existing, security-relevant: Electron apps still let web content write to .git/hooks, .git/config and .git/modules, although this patch now generates those rules. Electron's ShouldBlockAccessToPath() (shell/browser/file_system_access/file_system_access_permission_context.cc:207-214) only walks extra_rules and block_path_rules_. It never reads suffix_block_path_rules_, so these kBlockWrite suffix rules are dropped. Fix: check every suffix_block_path_rules_ entry in that function, as upstream does, and block writes when the path or an ancestor ends in the suffix. That change is in shell/, so it may need its own PR.
A small fix can ride a push you are already making; otherwise a short reply is enough.
Why this was flagged
The patch (lines 195-205) emits CreateSuffix(".git/hooks"), CreateSuffix(".git/config") and CreateSuffix(".git/modules"), all with BlockType::kBlockWrite. GenerateBlockPaths() puts them in suffix_block_path_rules_ (patch lines 359-362). Electron gets the rules from GenerateBlockPaths (shell/browser/file_system_access/file_system_access_permission_context.cc:557) and passes them to ShouldBlockAccessToPath(). That function only loops over {&extra_rules, &block_path_rules.block_path_rules_} (lines 207-214). A page using the File System Access API can therefore get write access to a repo's .git/hooks or .git/config once the user picks the repo directory. Hooks and config run code on the next git command, which is the attack upstream fixed in crbug.com/465668234, crbug.com/572269631 and crbug.com/571913154. The base branch ignores these rules in the same way, so this is pre-existing. The PR description says suffix rules have no effect and defers the fix to a follow-up, so the newly added rules give Electron users no protection.
Verification: pre-existing. Trigger: an Electron app grants File System Access and a user picks a directory inside a git repository. Then writes under .git/hooks, .git/config or .git/modules are not blocked. ShouldBlockAccessToPath() (shell/browser/file_system_access/file_system_access_permission_context.cc:207-214) only loops over extra_rules and block_path_rules_.
There was a problem hiding this comment.
Agreed, and it stays out of this PR. This PR only stops the blocklist from going stale. Enforcing suffix_block_path_rules_ in ShouldBlockAccessToPath() is a behaviour change to shell/ that applies to main and all four release lines, so it will be a separate PR. It's waiting on a maintainer go-ahead, which I've asked for in the security channel.
Generated by Claude Code
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01MtuMgvwAcw7t9Q6HEB31Vx
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01MtuMgvwAcw7t9Q6HEB31Vx
|
The
I'm re-running the failed jobs. Generated by Claude Code |
|
No Release Notes |
Requested via Slack
Description of Change
Follow-up to @ckerr's review on #54678.
refactor_expose_file_system_access_blocklist.patchhand-copied upstream's blocklist code (NormalizeFilePath(),NormalizeFilePathForBlocklist(),GenerateBlockPaths()) into the header. Since #53634 dropped the.cchunks, upstream edits to the originals no longer conflict on a roll, so the copy goes stale silently. That is how the firmlink fix (64c8e2a1ceda) was lost on the M156 roll (#54678 / #54679).Main's roll to Chromium 158.0.8118.0 (#55210) then did exactly that. Upstream added new blocklist entries in that version: shell startup files and
~/.configon all platforms,/devon macOS,~/.local/share,~/.fonts.confand~/.pkion Linux, and.git/configand.git/modulessuffix rules. The hand-copied list on main dropped them without a conflict. This PR, rebased onto 8118, now compiles them in. The suffix rules still aren't enforced, because Electron's matcher doesn't read suffix rules; that is tracked separately.This PR stops copying. The patch now declares
NormalizeFilePathForBlocklist()andGenerateBlockPaths()as static members inchrome_file_system_access_permission_context.h. It moves upstream's definitions verbatim out ofchrome_file_system_access_permission_context.ccinto a newchrome/browser/file_system_access/chrome_file_system_access_blocklist.cc, along with theNormalizeFilePath()andMaybeStripMacDataVolumePrefix()helpers, and adds that file to upstream's:impltarget. Electron compiles the new file in//electron/chromium_src:chrome. If upstream changes the blocklist, the roll now hits a conflict on the hunk that removes it fromchrome_file_system_access_permission_context.cc, so the change can't be silently dropped. Electron's call sites inshell/are unchanged. The split is also shaped like a reasonable upstream CL, which the patch description already asks for.This builds on #54679 and should merge after it. Until then, GitHub will also show #54679's commits here; only the last commit belongs to this PR.
I haven't built this locally, so CI is the build gate. I checked that the patch applies cleanly to the 158.0.8118.0 sources and round-trips through
git am, that the new file passes clang-format (Chromium style), and thatscript/lint.js --patchesand--jspass.Behavior change:
GenerateBlockPaths()now emits upstream's.git/hookssuffix rule on all platforms, matching upstream at this Chromium version. Main's copy only emitted it on Windows. Electron's ownShouldBlockAccessToPath()never readssuffix_block_path_rules_, though, so in practice nothing changes for apps on any platform. That gap was already there before this PR; it is a separate follow-up.Checklist
🤖 Generated with Claude Code
https://claude.ai/code/session_01MtuMgvwAcw7t9Q6HEB31Vx
Generated by Claude Code
Release Notes
Notes: none