You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
permission hook: enforce an org-supplied command allowlist, hard denies, and start/end audit events for agent runs #3582
Agent runs on a box can run commands outside their tool-access level. The host operator needs (1) an org-supplied command allowlist enforced when a command is requested, (2) a typed denial when a command is outside it, and (3) an audit event for each command. Enforcement today is the run's --restricted and --allowedTools flags (box_run_policy.go), not a hook. This issue adds the mechanism.
Mechanism
Extend the existing run approval server (agent-box approval-mcp, internal/coderun/approval.go) or add a PreToolUse and PostToolUse hook pair. PostToolUse is needed for end events. The choice is made in the design step of this issue and recorded on it.
Acceptance criteria
Matching: a glob over argv elements. * matches within one element only. A command containing a shell operator never matches. The executable name matches exactly.
An allowlisted command runs outside its tool-access level. Hard denies still block it: outbound network to arbitrary hosts, git push, git remote, and the transport options. Tests for each.
A non-matching command is denied with a typed close reason and a blocked event. The run ends. Approval produces a new run; it does not resume this one.
Every command writes a start event before it runs, and an end event with exit code when it finishes. Output is not stored.
Events go to a daemon-owned sink the run user cannot write to. The existing journal is written by the run user (box_run.proto), so it is not used as the sink.
The start request carries the approval id and approver id when a run is a re-run; the decision records them.
Command class is a proto enum.
Argument redaction from a default list plus an operator-supplied addition list. Environment variables are never logged. Test that a token-looking argument is replaced.
Status note: PR #3583 (merged 2026-11-09, in v0.136.0) delivers the hook pair, allowlist enforcement and start/end audit events described here. Leaving this open until the real-box pass of that PR's 'Not verified' items is recorded.
Activity
feat(agent): command-mode runs go through the command policy; FULL_SU…
fix(agent): every audit START gets an END; exit code from failure tex…
fix(agent): the run's exit status the sink reads is root's, not the r…
fix(runhook): close two hard-deny bypasses and harden the policy setup (
build(agent-box): build the linux agent-box with CGO_ENABLED=0 and ga…
fix(runhook): refuse unresolvable commands by name, deny nests past t…
fix(agent): a policy run executes a root-owned copy of the engine the…
fix(runhook): deny as UNRESOLVABLE only what the parser cannot resolv…
fix(runhook,server): follow-ups to review of #3583 (Refs #3582)
fix(server): gate box_run_engine_stage_test on !containarium_client (…
feat(agent): command allowlist enforcement and audit events for agent…
feat(runs): per-run command event feed with sequence numbers (Footpri…
feat(box-run): re-land the per-run token file; refuse tokenless run-u…
feat(box-run): re-land the per-run token file; refuse tokenless run-u…
hsinatfootprintai commentedon Nov 12, 2026
Status note: PR #3583 (merged 2026-11-09, in v0.136.0) delivers the hook pair, allowlist enforcement and start/end audit events described here. Leaving this open until the real-box pass of that PR's 'Not verified' items is recorded.