Skip to content

feat: enforce the operation gate with allowed-tools, a PreToolUse hook, and a gated wrapper - #4

Merged
Zulut30 merged 4 commits into
mainfrom
feat/enforcement-hooks
Aug 17, 2026
Merged

feat: enforce the operation gate with allowed-tools, a PreToolUse hook, and a gated wrapper#4
Zulut30 merged 4 commits into
mainfrom
feat/enforcement-hooks

Conversation

@Zulut30

@Zulut30 Zulut30 commented Aug 17, 2026

Copy link
Copy Markdown
Member

Summary

Phase 1 of the hardening roadmap: turn the fail-closed policy layer from a convention into a mechanism.

  • Require a least-privilege allowed-tools declaration in every module (SKILL.md frontmatter + module.yaml), enforced by the manifest schema and validate_platform.py; control-plane and provider modules receive no unrestricted shell.
  • Add tools/devops_exec.py: executes exactly one approved command, requires the canonical argv digest to equal the approved change.plan_digest, re-runs the operation gate immediately before launch, and appends a secret-redacted record to a local execution ledger. Drift blocks with a non-zero exit.
  • Add tools/hooks/pretooluse_gate.py (+ docs/hooks-setup.md): a fail-closed PreToolUse hook that denies mutating, obfuscated, or unclassifiable shell commands without a fresh gate PASS bound to the exact command digest.
  • Migrate the portfolio demo to gated wrapper execution, including a blocked drift path.
  • Split README safety properties into enforced vs advisory.

Testing

  • python devops-platform-contracts/scripts/validate_platform.py → OK, 21/21 compatible installed skills
  • python -m unittest discover -s tests → 50 tests OK (was 33)
  • python examples/portfolio-demo/run_demo.py → verified, wrapper drift blocked
  • python -m unittest discover -s examples/portfolio-demo/tests -p "test_*.py" → OK

🤖 Generated with Claude Code

Zulut30 and others added 4 commits August 17, 2026 22:18
Every SKILL.md frontmatter and module manifest now declares an explicit
allowed-tools set: control-plane modules are limited to reads and their
own validators, provider packs to reads plus their provider CLI, and
executors receive the full toolset that the PreToolUse gate constrains.
Missing, duplicated, malformed, or mismatched declarations fail
validation instead of warning.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…nding

tools/devops_exec.py executes exactly one approved command: it computes
the canonical digest of the actual argv, requires equality with the
approved change.plan_digest, re-runs the registered operation gate
immediately before launch, executes without a shell, and appends a
secret-redacted record to a local execution ledger. Digest drift, gate
refusal, malformed requests, and internal errors block with a non-zero
exit code. The portfolio demo now executes its simulated rollout through
the wrapper and proves the drift path is blocked.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
tools/hooks/pretooluse_gate.py denies every shell command that is not
provably read-only, a resolved-path-verified platform script, or a
devops_exec wrapper call whose operation request binds the approved
plan digest to the canonical digest of the exact wrapped command, has
an open execution window, and receives a fresh operation-gate PASS.
Obfuscation via shell wrappers, eval, base64, substitution, variable
expansion, redirection, multi-line input, and unknown executables is
denied fail-closed. docs/hooks-setup.md documents installation and the
decision rules.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The README safety-properties section now states per property whether it
is enforced by a blocking mechanism (gate, wrapper digest binding,
PreToolUse hook, allowed-tools validation, release verification) or
advisory discipline that depends on the agent. CHANGELOG records the
enforcement layer added for the next release.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@Zulut30
Zulut30 requested a review from Shpuntyara as a code owner August 17, 2026 21:09
@Zulut30
Zulut30 enabled auto-merge (rebase) August 17, 2026 21:10
@Zulut30
Zulut30 merged commit e710b89 into main Aug 17, 2026
3 checks passed
@Zulut30
Zulut30 deleted the feat/enforcement-hooks branch August 17, 2026 21:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant