Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/agents/omp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ configure_omp_mode_paths() {
"${XDG_DATA_HOME:-$HOME/.local/share}/omp"
"${XDG_STATE_HOME:-$HOME/.local/state}/omp"
"${XDG_CACHE_HOME:-$HOME/.cache}/omp"
"$HOME/.bun"
)

local p
Expand Down
4 changes: 2 additions & 2 deletions sandbox
Original file line number Diff line number Diff line change
Expand Up @@ -642,8 +642,8 @@ run_macos() {
# 6. Claude lock dirs and atomic-write temp files in $HOME
printf '(allow file-write* (regex #"^%s/\\.claude\\.lock$"))\n' "$(policy_quote "$HOME")"
printf '(allow file-write* (regex #"^%s/\\.claude\\.lock/"))\n' "$(policy_quote "$HOME")"
printf '(allow file-write* (regex #"^%s/\\.claude\\.json\\.lock"))\n' "$(policy_quote "$HOME")"
printf '(allow file-write* (regex #"^%s/\\.claude\\.json\\.tmp\\."))\n' "$(policy_quote "$HOME")"
printf '(allow file-write* (regex #"^%s/\\.claude\\.json\\.lock(/|$)"))\n' "$(policy_quote "$HOME")"
printf '(allow file-write* (regex #"^%s/\\.claude\\.json\\.tmp\\.[^/]+$"))\n' "$(policy_quote "$HOME")"

# 7. Keychain access for OAuth token refresh (only if explicitly allowed)
if [[ "$allow_keychain" == true ]]; then
Expand Down
31 changes: 31 additions & 0 deletions tests/test_sandbox.sh
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,37 @@ else
fi
fi

if [[ "$OS" == "Darwin" ]]; then
echo "Test: Claude JSON lock directory remains writable"
if HOME="$CLAUDE_HOME" ./sandbox sh -c 'mkdir "$HOME/.claude.json.lock" && : >"$HOME/.claude.json.lock/lock"' 2>/dev/null; then
pass "Claude JSON lock directory remains writable"
else
fail "Claude JSON lock directory remains writable"
fi

echo "Test: Claude JSON atomic temp file remains writable"
if HOME="$CLAUDE_HOME" ./sandbox sh -c ': >"$HOME/.claude.json.tmp.write"' 2>/dev/null; then
pass "Claude JSON atomic temp file remains writable"
else
fail "Claude JSON atomic temp file remains writable"
fi

echo "Test: Claude JSON lock prefix cannot create sibling files"
if HOME="$CLAUDE_HOME" ./sandbox sh -c ': >"$HOME/.claude.json.lockx"' 2>/dev/null; then
fail "Claude JSON lock prefix cannot create sibling files"
else
pass "Claude JSON lock prefix cannot create sibling files"
fi

mkdir "$CLAUDE_HOME/.claude.json.tmp.directory"
echo "Test: Claude JSON temp prefix cannot write nested paths"
if HOME="$CLAUDE_HOME" ./sandbox sh -c ': >"$HOME/.claude.json.tmp.directory/nested"' 2>/dev/null; then
fail "Claude JSON temp prefix cannot write nested paths"
else
pass "Claude JSON temp prefix cannot write nested paths"
fi
fi

rm -rf "$CLAUDE_HOME"

#
Expand Down
6 changes: 4 additions & 2 deletions tests/test_startup_preflights.sh
Original file line number Diff line number Diff line change
Expand Up @@ -224,20 +224,22 @@ if (
"$PI_CODING_AGENT_DIR" \
"$XDG_DATA_HOME/omp" \
"$XDG_STATE_HOME/omp" \
"$XDG_CACHE_HOME/omp"
"$XDG_CACHE_HOME/omp" \
"$HOME/.bun"
rw_paths=()
add_rw_path() {
rw_paths+=("$1")
}
is_known_subcommand "omp"
configure_agent_subcommand "omp"
[[ "$command_flag" == "omp" ]]
[[ ${#rw_paths[@]} -eq 5 ]]
[[ ${#rw_paths[@]} -eq 6 ]]
[[ "${rw_paths[0]}" == "$HOME/.omp" ]]
[[ "${rw_paths[1]}" == "$PI_CODING_AGENT_DIR" ]]
[[ "${rw_paths[2]}" == "$XDG_DATA_HOME/omp" ]]
[[ "${rw_paths[3]}" == "$XDG_STATE_HOME/omp" ]]
[[ "${rw_paths[4]}" == "$XDG_CACHE_HOME/omp" ]]
[[ "${rw_paths[5]}" == "$HOME/.bun" ]]
); then
pass "OMP mode registers its command and writable state roots"
else
Expand Down
Loading