fix(delivery): harden the guard hook after three review rounds
Two fresh-context adversarial reviews and a spec/standards review of the guard found bypasses, false denies and fail-open paths. Fixes: - Substitution bodies are parsed by the tokenizer itself, so an apostrophe in a here-doc commit/PR body no longer hides later commands. - Redirect operands never become words; every redirect target is checked for secret paths and .git/hooks. - Unquoted here-doc substitutions are analysed; stdin shells (bash -, ssh host, pwsh) analyse their here-doc as a script. - Option clusters ending in a value letter (bash -euo pipefail -c, sudo -iu root) consume their value. - PowerShell mode: backtick escapes, iex, cmd /c, -EncodedCommand denied. - Malformed payloads and unknown runtimes fail closed; runtime comes from the deploy path only. - Linear-time parsing with size, word, command, depth and unwrap caps, so Copilot cannot time out (and fail open) on long input. - Wider secret coverage (.ssh/.kube globs and dirs, id_* suffixes, sops age key, k3s/admin kubeconfigs, git-credentials, deploy keys, REV:path) and hook-bypass routes (git config alias, .git/hooks writes, find -delete, HUSKY=0, LEFTHOOK=0). - Fewer false denies: commit/PR message values, find -name, search globs, jq/yq filters, pytest -k, git -S/--grep, ssh -i naming, non-admin kubeconfigs, quoted braces, option names, doc and test files. - New allowlists: helmfile, terragrunt hcl/render, helm diff. - delivery 0.2.0: a new hook changes compiled output (configure.md). - ADR-0032: allowlists described as "no cluster or state change and no secret printed"; Write added to the file tools. Refs #190 Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_012CqgnwEGtmfsjcoG9QwByN
This commit is contained in:
1 parent
a6ff1c14d4
commit
d86ae521e7
7 files changed
+1509
-463
No files matched your search
@@ -96,9 +96,10 @@ running it in CI on a bot PR hands the bot those credentials. Decided in
|
||||
since v1.0.53), so on Copilot an odd-job ask may run without a human answer. The owner kept ask
|
||||
on Copilot rather than deny; Copilot is untested in v1 and the credential boundary still holds.
|
||||
- The guard hook (`plugins/delivery/.apm/hooks/guard.py`) also checks file-tool paths (Read, Grep,
|
||||
Edit, Copilot's `view`, Codex's `apply_patch`) against the secret-path globs, not only shell
|
||||
commands. `kubectl`, `helm`, `flux` and `tofu` are allowlists of read verbs: anything not on
|
||||
the list is denied, so an unlisted mutating verb fails safe. Codex cannot ask, so odd jobs are
|
||||
Edit, Write, Copilot's `view`, Codex's `apply_patch`) against the secret-path globs, not only
|
||||
shell commands. `kubectl`, `helm`, `flux` and `tofu` are allowlists of subcommands that change no
|
||||
cluster or state and print no secret: anything not on the list is denied, so an unlisted mutating
|
||||
subcommand fails safe. Codex cannot ask, so odd jobs are
|
||||
denied there; an unrecognised runtime is treated the same way.
|
||||
- *Amended 2026-11-23 ([delivery guard hook](https://git.rkdr.net/Mortis/Holocron/issues/190)): Copilot ask kept
|
||||
as an accepted risk; the guard covers file tools and uses read-verb allowlists.*
|
||||
|
||||
Reference in new issue
Block a user