Skip to content

Commit 6a46bc1

Browse files
committed
fix(security): enable Claude OAuth refresh and tighten sandbox access
- Add write access to ~/Library/Keychains/login.keychain-db for token refresh - Replace broad ~/Library read with allowlist (Caches, Preferences, etc.) - Restrict write to session-specific $TMPDIR instead of all /var/folders - Deny access to sensitive Library paths (Cookies, Mail, Messages, Safari) - Enforce deny rules for critical sensitive paths in base profile
1 parent 9b12652 commit 6a46bc1

3 files changed

Lines changed: 18 additions & 5 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,4 @@ target/
1313
# MSVC Windows builds of rustc generate these, which store debugging information
1414
*.pdb
1515
actionlint
16+
worktrees/

profiles/base.toml

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ network_mode = "offline"
55

66
[filesystem]
77
allow_read = [
8+
# System paths
89
"/usr",
910
"/bin",
1011
"/sbin",
@@ -21,8 +22,16 @@ allow_read = [
2122
"/var/run",
2223
"/tmp",
2324
"/dev",
25+
# sx config
2426
"~/.config/sx",
25-
"~/Library",
27+
# ~/Library - allowlist only safe subdirectories (shift-left)
28+
"~/Library/Caches/",
29+
"~/Library/Preferences/",
30+
"~/Library/Application Support/",
31+
"~/Library/Logs/",
32+
"~/Library/Frameworks/",
33+
"~/Library/Keychains/", # Encrypted, requires Security framework ACL to access secrets
34+
"~/Library/Developer/",
2635
# Shell config files (read-only)
2736
"~/.zshrc",
2837
"~/.zshenv",
@@ -32,6 +41,7 @@ allow_read = [
3241
"~/.profile",
3342
"~/.inputrc",
3443
]
44+
# This enforce deny on critical path containing sensibles data even if user allow HOME directory in global config
3545
deny_read = [
3646
"~/.ssh",
3747
"~/.aws",
@@ -42,10 +52,8 @@ deny_read = [
4252
]
4353
allow_write = [
4454
"/tmp",
45-
"/private/var/folders",
46-
"/private/var/run",
47-
"/var/folders",
48-
"/var/run"
55+
"/private$TMPDIR", # Session-specific temp dir (canonical path)
56+
"$TMPDIR", # Session-specific temp dir (symlink path)
4957
]
5058

5159
[shell]

profiles/claude.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ network_mode = "online"
66
allow_read = [
77
"~/.claude",
88
"~/.claude.json",
9+
"~/.claude.lock",
910
"~/.local/share/claude",
1011
"~/.local/bin/claude",
1112
"~/.CFUserTextEncoding",
@@ -15,7 +16,10 @@ allow_read = [
1516
allow_write = [
1617
"~/.claude",
1718
"~/.claude.json",
19+
"~/.claude.lock",
20+
"~/.local/share/claude",
1821
"~/Library/Caches/claude-cli-nodejs/",
22+
"~/Library/Keychains/login.keychain-db", # OAuth token refresh
1923
"/private/tmp/claude*", # claude-UID directories (e.g. claude-501)
2024
"/private/tmp/zsh*", # When claude use zsh in bash it create dynamic tmp file
2125
]

0 commit comments

Comments
 (0)