From fe9ca9552f48d421745ad3105f0d7bbd5805fa24 Mon Sep 17 00:00:00 2001 From: Julian lechner Date: Thu, 17 Sep 2026 23:00:01 +0200 Subject: [PATCH] test(config): enforce sandbox defaults --- scripts/test-shell-packages.ps1 | 3 +++ scripts/test-shell-packages.sh | 6 ++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/scripts/test-shell-packages.ps1 b/scripts/test-shell-packages.ps1 index 6703f05..7edea30 100644 --- a/scripts/test-shell-packages.ps1 +++ b/scripts/test-shell-packages.ps1 @@ -41,11 +41,14 @@ foreach ($shell in @('powershell','bash')) { $events = @([regex]::Matches($content, '(?m)^\[\[hooks\.([^.\]]+)\]\]\s*$') | ForEach-Object { $_.Groups[1].Value }) if ($events.Count -ne 1 -or $events[0] -ne 'Stop' -or $content -match 'flashbang-if-input' -or $content -match '(?m)^async\s*=\s*true\s*$') { throw "Codex finish hook is incorrect in $package" } if ($content -notmatch 'approvals_reviewer\s*=\s*"auto_review"') { throw "Codex auto review is missing in $package" } + if ($content -notmatch '(?m)^max_depth\s*=\s*1\s*$') { throw "Codex agent depth limit is missing in $package" } if ($content -notmatch 'status_line\s*=\s*\["model", "reasoning", "approval-mode", "project-name", "git-branch", "context-window-size", "context-used", "used-tokens"\]') { throw "Codex status line is incorrect in $package" } } elseif ((($settings.hooks.PSObject.Properties.Name | Sort-Object) -join ',') -ne 'PreCompact,SessionStart,Stop' -or $content -match 'flashbang-if-input' -or $settings.hooks.Stop[0].hooks[0].async) { throw "Claude finish hook is incorrect in $package" } elseif ($content -notmatch '"defaultMode"\s*:\s*"auto"') { throw "Claude auto permission mode is missing in $package" + } elseif (-not $settings.sandbox.enabled -or $settings.sandbox.allowUnsandboxedCommands -ne $false) { + throw "Claude strict sandbox is missing in $package" } elseif (-not (Test-Path -LiteralPath (Join-Path $package "statusline/statusline.$(if ($shell -eq 'powershell') { 'ps1' } else { 'sh' })")) -or $settings.statusLine.command -notmatch "statusline\.$(if ($shell -eq 'powershell') { 'ps1' } else { 'sh' })") { throw "Claude status line is incorrect in $package" } diff --git a/scripts/test-shell-packages.sh b/scripts/test-shell-packages.sh index 6e3ca91..f964eb6 100755 --- a/scripts/test-shell-packages.sh +++ b/scripts/test-shell-packages.sh @@ -32,7 +32,7 @@ for shell in powershell bash; do [ "$client" != claude ] || file=settings.json test -f "$package/$file" if [ "$client" = codex ]; then - while IFS=$'\t' read -r rule_file skill_name trigger; do + while IFS=$'\t' read -r rule_file _ trigger; do [ "$rule_file" = rule_file ] && continue [ -n "$rule_file" ] || continue rule_path=$rule_file @@ -56,13 +56,15 @@ for shell in powershell bash; do ! grep -q 'flashbang-if-input' "$package/$file" ! grep -Eq '^async[[:space:]]*=[[:space:]]*true[[:space:]]*$' "$package/$file" grep -q 'approvals_reviewer[[:space:]]*=[[:space:]]*"auto_review"' "$package/$file" + grep -Eq '^max_depth[[:space:]]*=[[:space:]]*1[[:space:]]*$' "$package/$file" grep -Fq 'status_line = ["model", "reasoning", "approval-mode", "project-name", "git-branch", "context-window-size", "context-used", "used-tokens"]' "$package/$file" else python3 -c 'import json,sys; settings=json.load(open(sys.argv[1], encoding="utf-8-sig")); assert set(settings["hooks"]) == {"PreCompact", "SessionStart", "Stop"}' "$package/$file" ! grep -q 'flashbang-if-input' "$package/$file" ! grep -q '"async"[[:space:]]*:[[:space:]]*true' "$package/$file" grep -q '"defaultMode"[[:space:]]*:[[:space:]]*"auto"' "$package/$file" - statusline_extension=sh + python3 -c 'import json,sys; settings=json.load(open(sys.argv[1], encoding="utf-8-sig")); assert settings["sandbox"] == {"enabled": True, "allowUnsandboxedCommands": False}' "$package/$file" + statusline_extension='sh' [ "$shell" != powershell ] || statusline_extension=ps1 test -f "$package/statusline/statusline.$statusline_extension" grep -q "statusline.$statusline_extension" "$package/$file"