You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Permission loader: a settings file that cannot exist, or holds only a BOM, fails closed #4651
With #4287, load_permission_rules adds a catch-all Ask when a Claude Code settings file exists but cannot be read or parsed, and skips missing or empty files. Two inputs fall on the wrong side of that line. Neither file holds any rules, but both get the Ask:
The parent path is not a directory. If a project contains a regular file named .claude, user_dirs::project_root still accepts it as the marker, because it only checks .exists(). The same happens if CLAUDE_CONFIG_DIR points at a file. Reading <that>/settings.json then fails with ENOTDIR (ErrorKind::NotADirectory), not NotFound, so it is treated as unreadable. Windows reports NotFound for the same layout and skips the file, so the result depends on the platform.
The file holds only a UTF-8 BOM. For example, a settings.local.json saved empty by an editor that writes EF BB BF. content.trim() does not remove U+FEFF, so the empty-file check misses it. from_json_str then strips the BOM, fails on the empty input, and the file counts as unparseable.
Measured with rtk rewrite "git status", where the other settings file has allow: ["Bash(git status)"]:
Claude Code permission loader fails closed (adds catch-all Ask) for a non-directory .claude path or a BOM-only settings file instead of treating them as absent/empty, with platform-divergent behavior.
This looks like a simple fix that could be auto-resolved. Repo maintainers can use /wshm fix to attempt it.
📁 Relevant files
src/permissions.rs
src/user_dirs.rs
Suggested Actions
Treat io::ErrorKind::NotADirectory like NotFound when reading settings files (MSRV 1.91, stable since 1.83)
Run the empty-content check after strip_leading_bom in load_permission_rules_from
Add regression tests: .claude as a regular file, and a BOM-only settings.local.json
#4680 gives the Cursor, Droid and Gemini loaders the same missing / unreadable split through read_json in src/hooks/permissions.rs, so the two inputs here now reach a second site. Measured on #4680's head eaee169b6 against its base 6c1af5fbc, rtk hook cursor / rtk hook droid, payload git status, no other settings file:
{}, failed to read permissions … Not a directory (os error 20)
Droid settings.json (any of the four scopes) = EF BB BF
rewritten
no output (steps aside), parse warning
Droid scope directory .factory is a regular file
rewritten
no output, Not a directory warning
Gemini's output is unchanged in both cases (warning only). Neither file holds a rule, so the cost is a lost rewrite, not a missed deny. The fix described above applies to read_json too; #4658 currently covers only the Claude Code loader.
Thanks for identifying the second site. #4658 merged at aac43f6a, but it changes only the Claude loader. The shared read_json still has the NotFound-only read branch and checks for empty content before BOM removal on develop 19ece88e, so the Cursor/Droid follow-up described above remains. The merge closed this issue; could that remaining scope stay tracked here or in a follow-up issue?
Activity
rtk-wshm-sync-bot commentedon Oct 18, 2026
🔍 Automated Triage
bugmediumSummary
Claude Code permission loader fails closed (adds catch-all Ask) for a non-directory
.claudepath or a BOM-only settings file instead of treating them as absent/empty, with platform-divergent behavior.📁 Relevant files
src/permissions.rssrc/user_dirs.rsSuggested Actions
.claudeas a regular file, and a BOM-only settings.local.jsonTriaged automatically by wshm · This is an automated analysis, not a human review.
KuSh commentedon Oct 31, 2026
#4680 gives the Cursor, Droid and Gemini loaders the same missing / unreadable split through
read_jsoninsrc/hooks/permissions.rs, so the two inputs here now reach a second site. Measured on #4680's headeaee169b6against its base6c1af5fbc,rtk hook cursor/rtk hook droid, payloadgit status, no other settings file:~/.cursor/cli-config.json=EF BB BFask, rewritten tortk git status, parse warning{}(steps aside), parse warning~/.cursoris a regular fileask, rewritten{},failed to read permissions … Not a directory (os error 20)settings.json(any of the four scopes) =EF BB BF.factoryis a regular fileNot a directorywarningGemini's output is unchanged in both cases (warning only). Neither file holds a rule, so the cost is a lost rewrite, not a missed deny. The fix described above applies to
read_jsontoo; #4658 currently covers only the Claude Code loader.Ehsan-hash commentedon Oct 31, 2026
Thanks for identifying the second site. #4658 merged at
aac43f6a, but it changes only the Claude loader. The sharedread_jsonstill has the NotFound-only read branch and checks for empty content before BOM removal on develop19ece88e, so the Cursor/Droid follow-up described above remains. The merge closed this issue; could that remaining scope stay tracked here or in a follow-up issue?refactor(hooks): read every host's settings file one way
KuSh commentedon Nov 1, 2026
Hi @Ehsan-hash normally handled in my #4458 PR, thanks
fix(hooks): read every host's settings file one way
fix(hooks): read every host's settings file one way
fix(hooks): read every host's settings file one way
fix(hooks): read every host's settings file one way