From 8fd0190c1ecbcfd4a6839f57e17cbbf10b75189b Mon Sep 17 00:00:00 2001 From: Gerrrt Date: Sat, 28 Nov 2026 15:48:50 -0800 Subject: [PATCH] ci(audit): allow read-only grep and find, report denials, finish focus 0 The audits fell back to grep and find in Bash when Grep and Glob were missing, and both were denied. Allow them, with find's -exec, -ok, -delete, -fprint and -fls denied. Add a step that writes the session's tool list and the shape of each denied call to the job summary. Tell the audit that a denial is no reason to leave an item unchecked, and make focus 0 give each of the 15 newest ADRs its own Coverage line. Co-Authored-By: Claude Opus 5.5 --- .claude/commands/weekly-audit.md | 16 +++++++++---- .github/workflows/weekly-audit.yml | 36 +++++++++++++++++++++++++++++- 2 files changed, 47 insertions(+), 5 deletions(-) diff --git a/.claude/commands/weekly-audit.md b/.claude/commands/weekly-audit.md index 02470bcb..a707fe5b 100644 --- a/.claude/commands/weekly-audit.md +++ b/.claude/commands/weekly-audit.md @@ -17,8 +17,11 @@ right, record a FINDING. Do not edit. ## Tools Bash runs under a fixed allow list; anything else is denied, not asked. -Read files with Read, find them with Glob, search with Grep. In Bash, run one -command per call: no `cd`, no `&&` or `;`, no redirects (`2>&1`, `>`). +Read files with Read, find them with Glob, search with Grep. If Glob or Grep +is not in your tool list, use `find` and `grep -rn` in Bash instead; both are +allowed. `find` with `-exec`, `-ok`, `-delete` or `-fprint` is denied. +In Bash, run one command per call: no `cd`, no `&&` or `;`, no redirects +(`2>&1`, `>`). The id hash in step 3 is the one allowed pipe. Keep `|`, `;` and `&` out of arguments: `git log --format=%h|%cs|%s` is three piped commands, and is denied. Separate fields with spaces or `%x09` instead: @@ -87,6 +90,9 @@ say what it checked and found clean. as running short. Only past that may you leave items unchecked, and the PR body must name each one under *Not reached*. "Not reached" with fewer than 120 tool calls used is a failed run. +- A denied call is never a reason to leave an item unchecked. Read the + Tools section, rewrite the call in an allowed form (Read, `grep`, `find`, + `git show`) and carry on. - Step 9 (stale images) runs every week, whatever the focus. It is not part of the checklist and cannot be "not reached": do it before step 10. @@ -102,8 +108,10 @@ everything on disk is in the doc, and everything in the doc is on disk. - Every link to an ADR from a current-state document (`CLAUDE.md` lists them): it does not cite a Superseded ADR as the current decision. - Every ADR count in a README matches the number of files. - - The 15 newest ADRs: their Decision against the code and the changelog - entries dated after them. + - The 15 newest ADRs, every one of them: their Decision against the code + and the changelog entries dated after them. In *Coverage*, give each of + the 15 its own line: the ADR number, the Decision claim you checked, and + the file that bears it out or contradicts it. Fifteen lines, no sampling. 1. `ansible/`. - Every role directory: listed in `ansible/README.md` (roles, tags, secret variables) and used by a playbook. diff --git a/.github/workflows/weekly-audit.yml b/.github/workflows/weekly-audit.yml index d5d4e195..4961494f 100644 --- a/.github/workflows/weekly-audit.yml +++ b/.github/workflows/weekly-audit.yml @@ -80,6 +80,7 @@ jobs: run: echo ".lemmiwinks/" >> .git/info/exclude - name: Run audit + id: audit uses: anthropics/claude-code-action@4411a9e9b0283becf4b924f7bce360fd7756c78c # v1.0.290 env: GH_TOKEN: ${{ github.token }} # gh issue list/create only @@ -109,6 +110,7 @@ jobs: "Bash(wc *)", "Bash(sort *)", "Bash(uniq *)", "Bash(date *)", "Bash(printf *)", "Bash(sha256sum)", "Bash(cut *)", + "Bash(grep *)", "Bash(find *)", "Bash(python3 scripts/check_docs.py)", "Bash(python3 scripts/check_docs.py *)", "Bash(python3 scripts/check_close_keywords.py --text docs/audit/pr-body.md)", @@ -123,11 +125,43 @@ jobs: "Edit(**/*.png)", "Edit(**/*.jpg)", "Edit(**/*.jpeg)", "Bash(sops *)", "Bash(git push *)", "Bash(git commit *)", "Bash(git -C * push *)", "Bash(git -C * commit *)", - "Bash(curl *)", "Bash(wget *)" + "Bash(curl *)", "Bash(wget *)", + "Bash(find *-exec*)", "Bash(find *-ok*)", + "Bash(find *-delete*)", "Bash(find *-fprint*)", + "Bash(find *-fls*)" ] } } + # Which tools the session had, and the shape of each denied call: the + # command's first words and whether it held a shell operator. Never the + # whole command, since the job summary is public. + - name: Report tools and denials + if: always() && steps.audit.outputs.execution_file != '' + env: + EXEC_FILE: ${{ steps.audit.outputs.execution_file }} + run: | + set -euo pipefail + [ -f "$EXEC_FILE" ] || exit 0 + jq -rs ' + (if (.[0] | type) == "array" then .[0] else . end) as $m + | ($m | map(select(.type == "system" and .subtype == "init")) + | first | .tools // [] | join(", ")) as $tools + | ($m | map(select(.type == "result")) | last + | .permission_denials // []) as $d + | "### Tools and denials\n\nTools: \($tools)\n\nDenied calls: \($d | length)\n\n" + + ($d | map( + .tool_name as $t + | (.tool_input.command // "") as $c + | ($c | split(" ") | map(select(. != ""))) as $w + | (if $w[0] == "git" and $w[1] == "-C" then $w[0:4] else $w[0:2] end + | join(" ")) as $head + | "- \($t)" + + (if $c != "" then ": `\($head)`" else "" end) + + (if ($c | test("[|;&<>]")) then " (shell operator)" else "" end) + ) | join("\n")) + ' "$EXEC_FILE" >> "$GITHUB_STEP_SUMMARY" + - name: Package doc changes id: patch run: |