chore(memory): shell deny fixes queued in phase 2, BDR-125 amendment 6
This commit is contained in:
1 parent
ece04fa809
commit
2a60c93801
3 files changed
+10
-2
No files matched your search
@@ -42,10 +42,16 @@ Shared rules for every phase:
|
||||
- [ ] **Phase 2, guards** (redesigned 2026-10-25 after a 3-lens challenge: correctness FATAL(10), robustness FATAL(13), simplicity FATAL(6); plan `.claude/tasks/plans/2026-10-24-context-mod-phase2.md`)
|
||||
- Killed by the challenge: the phrase-list merge gate (false allows: "don't merge it yet", "should we merge it?", pasted text, skill bodies in the transcript; false denies: a plain "oui"; it blocked the BDR-068 /close auto-finish and the release-executor sub-agent finish; "ship it" contradicts the doctrine); G2 destructive guard (BLK-022: the content is withheld, not the language; stays a user-driven task with its two listed options); whole-file code-limit reports (measured 1498 lines > 80 cols across 92 files, lib/gitflow.sh 81: over-fires, LRN-091); parsing commit text from Bash (heredoc `-m "$(cat <<'EOF' …)"`, `-F`, `-C`); registry format (in 4a).
|
||||
- Merge gate (user pick 2026-10-25: confirmation dialog). Mod `tool.call` on Bash|Monitor matching `gitflow.sh finish`, `gitflow_finish`, or `git merge` while develop/main is checked out → `$.ui.ask("Merge <branch> → <target> ?")`, one per branch, single use; dismissed, rejected, `-p`, or no surface → deny with reason "confirm at the terminal, then re-run". Named exceptions: BDR-068 ritual (this turn's prompt.submit command is capitalize or close, `gitflow.sh start chore <name>` seen this session, diff touches only `.claude/**`); release path in a decision table (verify that `$.ui.ask` works for a sub-agent's tool.call; else /release-candidate runs finish inline, BLK-018 option b). Cheap synchronous prefilter before the `.catch` deny, so a guard bug never denies every Bash call. Banner or doctor line when the guard is not live. settings.json hard_deny names mod refusals and the mod disarm paths (`mods/<name>/` sources, `~/.claude/<name>.json` `"enabled": false`, `enabledPlugins` `<name>@skills-dir`, dev-copy shadow). The finish prose stays until canaries pass across sessions. This is the first piece of the context mod.
|
||||
- Routing guard (user pick 2026-10-25: "always through a skill"). Measured: "j'aimerais que doctor.sh affiche la version de rtk" was coded inline with no skill (routing probe L3); history 2026-09-23 → 10-24: 10 code-writing bug/feature turns went through a skill, 11 coded inline (long pasted faunosteo briefs). Mod `tool.call` on Edit/Write/NotebookEdit of a code file by the MAIN loop (no `agentId`) while no skill run is active (model-router run slot or a `skill.prompt` seen this turn for feat/bugfix/hotfix/ship-feature/refactor/code-clean/tour…) → deny with reason "route through /hotfix (≤2 files, obvious), /feat, /bugfix or /ship-feature". Free: docs (.md), `.claude/**`, sub-agents (executors), any write inside a skill run. Doctrine follows in the same change: the ceiling bullet becomes "the main loop writes no code outside a skill run, whatever the model". Proof: routing bench `.claude/tasks/plans/2026-10-25-routing-probe/` cases (L3 must now enter a skill), long-brief replay in a clone, false-deny fixtures (doc edits, executor edits, in-skill edits).
|
||||
- Routing guard (user pick 2026-10-25: "always through a skill"). Measured: "j'aimerais que doctor.sh affiche la version de rtk" was coded inline with no skill (routing probe L3); history 2026-09-23 → 10-24: 10 code-writing bug/feature turns went through a skill, 11 coded inline (long pasted faunosteo briefs). Mod `tool.call` on Edit/Write/NotebookEdit of a code file by the MAIN loop (no `agentId`) while no skill run is active (model-router run slot or a `skill.prompt` seen this turn for feat/bugfix/hotfix/ship-feature/refactor/code-clean/tour…) → deny with reason "route through /hotfix (≤2 files, obvious), /feat, /bugfix or /ship-feature". Free: docs (.md), `.claude/**`, sub-agents (executors), any write inside a skill run. Bash write forms to a code file by the main loop (`>`/`>>` redirect, `tee`, `sed -i`, `cat <<EOF > f`, `python3 -c 'open(…,"w")'`) → same deny, cheap regex prefilter, unparseable → allow (never deny every Bash). Doctrine follows in the same change: the ceiling bullet becomes "the main loop writes no code outside a skill run, whatever the model". Proof: routing bench `.claude/tasks/plans/2026-10-25-routing-probe/` cases (L3 must now enter a skill), long-brief replay in a clone, false-deny fixtures (doc edits, executor edits, in-skill edits, Bash writes inside a run).
|
||||
- Shell deny hygiene (measured 2026-10-25, bench `.claude/tasks/plans/2026-10-25-bash-deny-probe/`; user pick: stay in `defaultMode: auto`). Facts: the native matcher already sees through `&&` `;` `||` `|` newline `( )` `env` `command` `\cmd` `timeout` `nohup` `xargs` quoted command word and simple assignments (no per-rule duplication needed); it misses `sh -c`, bare `bash`/`sh` + heredoc, `$(…)` in command position, absolute paths, interpreters (`python3 -c`, `awk system()`, `node -e`) and a quoted literal argument (`git push origin ":feature"` escapes `:**`); under auto every miss was approved by the classifier, not prompted; the rtk-rewrite PreToolUse hook runs BEFORE permission evaluation and the deny is evaluated on the REWRITTEN command (`cat SECRET.txt` under deny `cat SECRET*`: DENIED hooks off, RAN hooks on; `git push origin :feature` → rc=3 → `rtk git push origin :feature`, so deny `git push * :**` (hotfix ac23cc6) and ask `git push *` are bypassed in real use; rc=2 forms `--delete` `+ref` `--force*` `.env` `id_rsa` `.aws` `find -delete|-exec` `git branch -D` are left unchanged and hold; rc=0 misses `cat */*.pem`, `cat */secrets/*`); Bash redirects into an Edit-denied path ARE denied; `ask` beats `allow` (an `ask Bash(bash *)` prompts every lib script: never).
|
||||
- rtk hook: rc=3 → pass through unchanged (no `updatedInput`), native deny/ask see the original; re-pin `hooks/.rtk-hook.sha256`; hook test with the `cat SECRET*` analogue hooks-on. rc=0 reads: census test that every `Bash(cat|head|tail <glob>)` deny has its `Bash(rtk read <glob>)` twin, twins added.
|
||||
- settings.json `ask` += `Bash(sh -c *)`, `Bash(bash)`, `Bash(sh)`, `Bash(bash -s*)`, `Bash(bash <(*)`, `Bash(/*)`, `Bash(python3 -c *)`, `Bash(python -c *)`, `Bash(node -e *)`; `deny` += `Bash(awk *system*)` (`awk *` stays allowed; proven: plain awk RAN, system() DENIED). Each pattern proven in the bench (r3) before landing. P41 (templates: "ask inert under auto") is contradicted by measurement (`bash -c` prompted under auto in -p): re-check and fix the item, not the config.
|
||||
- Limits written down, one place: settings.json soft_deny note + README permissions: `$(…)` in command position and a quoted literal argument have no matchable rule and rest on the classifier; mode stays auto.
|
||||
- Folds TODO Actionable "docker host-root mount spellings" (prove with the same bench, same change) and the T42 dead-entry drop list (`git push * :*` etc.) if the release lands first.
|
||||
- Interim (accepted with the order 0 → 4a → 1 → 5 → 2): until this lands, a `git push origin :ref` deletion rests on the classifier and rtk's registry, not on settings.json.
|
||||
- Commit message: `commit-msg` git hook emitted by the gitflow hook generator (global core.hooksPath, T10 drift test), active only when `CLAUDECODE=1`, words counted with trailers excluded, limit read from lib/commit-message.md (one place), exemption only on deterministic convention files (commit template, .gitmessage, commitlint config). A failure is a git error to fix by shortening, not a permission refusal.
|
||||
- Code limits: classic PostToolUse hook, added lines only (Edit new_string, Write content), our code only (`lib/code-origin.sh` on the edited file's repo), 80 columns only, at most 5 reports, once per file per turn, `additionalContext`, never a deny. Function length deferred (or the project's own linter rule).
|
||||
- Proof: an evasion matrix per rule (quoting, cd and -C, bash -c, heredoc, Monitor, sub-agent, non-composer turn); false-allow fixtures for the gate (negation, question, paste); the /close ritual still finishes; the release decision table is tested; destructive commands are never run live (plugin test with stubs only).
|
||||
- Proof: an evasion matrix per rule (the bash-deny-probe bench: quoting, cd and -C, bash -c, sh -c, heredoc, $(…), absolute path, interpreters, rtk rewrite hooks-on, Monitor, sub-agent, non-composer turn); false-allow fixtures for the gate (negation, question, paste); the /close ritual still finishes; the release decision table is tested; destructive commands are never run live (plugin test with stubs only).
|
||||
- Cleanup: compress the gitflow section only for the forms now enforced; the commit-message line already points at the lib.
|
||||
|
||||
- [ ] **Phase 3, listings** (scope note 2026-10-25: this is NOT the plugin advisor; per-project profiles are phase 5. Once phase 5 packs exist, the skill listing shrinks natively, so the mod listing filter shrinks to restoring truncated descriptions of kept skills; the routing hint, agent description trim and MCP names stay here; the fingerprint built here also feeds phase 5 profile detection.)
|
||||
|
||||
Reference in new issue
Block a user