Threat model¶
What CallPact stops, how it stops it, and — the longer half of this document — what it does not stop.
Read this before you rely on it for anything. A governance tool that overstates its reach is worse than none, because it moves work from "I am careful here" to "the tool handles it".
1. Position¶
CallPact is not a sandbox for normal execution. Normal CLI exec/serving does not isolate the filesystem, restrict network access, drop capabilities, or filter syscalls. A wrapped tool that is permitted to run has the privileges of the CallPact process. Explicit verification cases have separate OS isolation; that containment does not extend to ordinary tool calls.
A separate implementation, docs/sandbox.md, provides optional
per-module delegation to an OS/backend sandbox (0.15.0). It does not turn
normal execution into a sandbox: only selected modules are confined, the
backend must be available, required refuses without one, and an adapter is a
trusted component. The default pair is
macOS sandbox-exec (OS, deprecated, canonical paths) and Linux bwrap (the
bubblewrap package); systemd-run is system/root only, because its user
manager ignores path properties. advisory
is a diagnostic level, not an execution mode.
CallPact is an execution boundary: a place where a call must present a declared contract before the subprocess is spawned or an imported HTTP operation is sent, and where the decision to permit or refuse it is recorded. Schema validation, configured ACLs and auditing apply to both module types. CLI path checks do not govern remote API data or its filesystem; see the OpenAPI guide for the HTTP import boundary.
The two are complementary and you should want both. The recommended deployment
is CallPact inside a sandbox (sandbox-runtime, bubblewrap, a container):
the sandbox bounds what any escape can reach, CallPact decides what should be
attempted and leaves the evidence. Neither substitutes for the other — a sandbox
cannot tell an authorised deletion from a catastrophic one, and an execution
boundary cannot contain a process that has already been permitted to run.
2. The problem being addressed¶
An agent asked to do ordinary work reaches for ordinary tools. The failure mode that has been repeatedly documented in the field is not exotic: the agent takes an irreversible action it was instructed not to take.
The instructive detail from the PocketOS incident (April 2026) is the post-mortem finding that the agent acknowledged violating the destructive-command rule in its own system prompt.
That generalises to a design premise:
A constraint expressed in an instruction is a request. Only a constraint enforced at the point of execution is a fact.
Everything below follows from taking that literally.
3. Why command-string matching is the wrong enforcement layer¶
The common enforcement design is a pattern list over command strings: allow
git status, deny rm -rf. It fails as a category, not as an implementation,
because the set of strings that produce a given effect is open.
Four shapes of this have been reported publicly against various agent hosts. They are listed as classes of problem inherent to string matching, not as defects of any particular product — every one of them was fixed or mitigated where reported:
| Class | Shape |
|---|---|
| Compound commands | The matcher evaluates the first token; a && b presents a and runs both (claude-code#36637) |
| Delegation | A sub-agent or channel-served session is spawned on a path that skips the policy filter (claude-code#40343, zeroclaw#7063) |
| Path aliasing | /proc/self/root/usr/bin/npx resolves to the same binary and matches no deny pattern |
| Approval fatigue | Hundreds of prompts per session make review nominal, and the documented response is to disable prompting entirely |
The first three share a root cause: the policy is written against a rendering
of the intent rather than the intent. The fourth is a UX consequence of the same
thing — when a rule cannot distinguish git status from rm -rf /, it must ask
about both.
CallPact checks structured operations: a module ID and schema-validated input. Module JSON and protocol clients supply those directly. Reviewed native exec and PATH shims resolve argv against declared grammar before entering the same checks. The executor runs an argument vector, without evaluating a shell command string; the calling shell still owns pipes and redirections.
4. What CallPact actually enforces¶
Each row is implemented and test-covered. Source locations are given so the claim can be checked rather than believed.
4.1 No shell on the execution path¶
src/module/executor.rs builds a tokio::process::Command and passes argv
straight to execve. No shell is spawned anywhere on the execution path. The
single sh/zsh invocation in the crate lives in scanner::completion and runs
a hardcoded constant script with no interpolation.
The consequence is structural: ;, |, &, $, backtick and quotes are
ordinary bytes in an argument. They cannot start a command, open a pipe, or
expand a variable, because nothing is there to interpret them. Compound-command
injection is not mitigated — it has no mechanism to exist.
This is why CallPact deliberately does not reject shell metacharacters in
argument values: doing so bought no safety and broke real use (curl could not
send a JSON body, no jq filter containing | could be passed). See the
CONTROL_CHARS documentation in executor.rs for the full reasoning, and
test_build_arguments_allows_shell_metacharacters for the guarantee.
4.2 The injection that does exist on an execve path¶
A value that reaches argv is read positionally by the wrapped tool's own
parser. A value of --output=/etc/passwd is indistinguishable from an option the
caller was never granted. This — not shell metacharacters — is the real injection
on this path.
validate_argument_value therefore rejects any value starting with -.
Two documented exemptions, both narrow:
numeric— a value that arrived as a JSON number, so legitimate negative numbers work. A string"-1"is still rejected.separator_available— set only for a tool whose overlay states it honours the--end-of-options separator. After--the wrapped parser cannot read the value as an option, which is a stronger guarantee than refusing values that merely look like one.
4.3 Control characters that would corrupt the audit trail¶
\0, \n, \r, U+2028, U+2029 and U+0085 are rejected in any value. The
argument is log integrity, not execve safety: a caller who can plant one of these
decides where a log reader sees a line boundary. Tab, VT, FF and ESC are
deliberately not rejected — they are already neutralised on output by tracing's
Debug rendering, and rejecting them would cost real values.
4.4 Fail-closed ACL — when one is loaded¶
callpact acl init writes ~/.callpact/acl.yaml with default_effect: "deny".
Modules annotated readonly get an explicit allow rule; modules annotated
destructive get an explicit deny rule. Everything else — including everything
the scanner could not classify — falls through to deny for callers the starter
policy does not name. (The default developer profile also allows the local
caller to run cli.* above those denials; use --profile strict for a policy
that grants nothing implicitly.)
The direction of that failure mode matters: an unclassified command is refused, not permitted. See §5.2 for the case where it does not hold.
"Fail-closed" describes the loaded policy, not CallPact's default state.
install_acl returns early when no --acl path is given, so a server started
without the flag enforces no access control at all. What is fail-closed about
the flag itself: passing --acl with a path that does not exist refuses to
start rather than continuing unguarded. See §5.3.
4.5 Environment policy¶
Two policies, selected by execution surface:
- Captured (MCP/A2A and module JSON):
env_clear()plus a base allowlist andLC_*locale variables. Secrets in the parent environment do not reach wrapped tools. - Local (native
exec, PATH shims,callpact sh): inherits the caller's environment so credential helpers such asGH_TOKEN,AWS_PROFILE,KUBECONFIGandSSH_AUTH_SOCKkeep working.LD_PRELOAD,LD_LIBRARY_PATHandDYLD_*are removed before the child starts.
The local policy is a trust decision, not isolation: a wrapped tool can read and use the caller's credentials, and commands it starts inherit the same environment.
Every local call is one caller. Native exec, PATH shims and callpact sh
present the same local caller, so no ACL rule can tell the operator's terminal
from an agent the operator started. What the shims do give you is a split by
activation, not by identity: a shell with the shim directory on PATH is
governed, one without it is not. That is why callpact env --enable --no-rc
together with callpact agent <host> --write leaves the human shell outside the
boundary while the agent's callpact-sh is inside it. Anything stronger needs an
identity the wrapped process cannot mint: a separate Unix user, or a container
with its own ACL and bindings, or the MCP/A2A caller identities, which are
authenticated and do not exist on the local surface. An CALLPACT_CALLER-style
environment variable would be attribution, not enforcement — a process that can
run the tool can also unset it.
4.6 Resource bounds¶
Output is capped at 64 MiB per stream (DEFAULT_MAX_OUTPUT_BYTES). A timeout,
when configured, is enforced with kill_on_drop(true), so an expired timeout
actually kills the child rather than merely returning an error to the caller —
covered by test_execute_subprocess_kills_the_child_when_the_timeout_elapses.
Captured execution is bounded by default_timeout (30 s). Local passthrough is
unbounded by default (local_timeout: 0): the caller owns a terminal and can
interrupt the command, whereas a fixed wall clock killed legitimate long-running
tools mid-flight. Set local_timeout when the local surface is driven by
something that cannot be interrupted by hand.
4.7 Audit trail¶
audit.jsonl (mode 0600) records executions, refusals, and ACL allow/deny
decisions, each carrying caller_id (the authenticated principal) and trace_id
in one timestamp format, so an allow-decision can be joined to the execution it
permitted.
It deliberately holds no argument values, hashed or otherwise. See §5.5 for what that costs.
4.8 Path guard on path-valued arguments¶
--acl decides whether a module may be called. It cannot decide what a call
may touch: apcore's ACL matches on callers and targets (module ids), and
its condition keys — identity_types, roles, max_call_depth, $or, $not
— are all facts about the principal, never about an argument. So an ACL can say
"cli.rm is allowed" or "cli.rm is denied", and nothing in between.
The realistic policy is in between. rm is not a command to forbid outright;
rm /etc is a command to forbid. src/governance/path_guard.rs closes that
gap: every argument the input schema types as a filesystem path
(x-apexe-path, emitted by the schema builder for ValueType::Path) is
resolved and checked before it becomes argv.
Two baselines, because reading and writing are different risks. A single
list forced one answer onto two unrelated questions and got both wrong:
cat /etc/hosts was refused, which buys nothing — the file is world-readable
and the agent's own file-reading tool reaches it anyway (§5.7) — while
cat ~/.ssh/id_rsa and rm -rf /etc were refused for the same stated reason
despite being nothing alike. The split follows the risk:
| System paths | Credential paths | |
|---|---|---|
Module annotated readonly |
allowed | refused |
| Everything else | refused | refused |
- System paths —
/bin,/boot,/dev,/etc,/lib,/lib32,/lib64,/proc,/run,/sbin,/sys,/usr,/var, plus/System,/Library,/Applications,/private/etc,/private/varon macOS. Destruction is the risk here; legibility is not, and refusingls /usr/binbought friction rather than safety. - Credential paths —
~/.ssh,~/.aws,~/.gnupg,~/.kube,~/.dockerand~/.callpactunder the invoking user's home, plus the token stores that do not sit at the top level:~/.config/gh,~/.config/gcloud,~/.config/apcore,~/.git-credentialsand~/.netrc. All are refused to readers and writers alike.~/.config/apcoreis listed ahead of anything writing there: it is the normative location for the OAuth tokens apcore-toolkit's device-authorization flow persists, and a baseline entry for a path nothing has created yet costs nothing, while adding it afterwards leaves a window in which CallPact wraps tools able to read a credential CallPact does not know exists. Deleting a private key announces itself the next time the key is used; copying one into a model context leaves no trace at all, so the stricter treatment goes to the risk that is harder to notice.~/.callpactis on this list rather than the other because it holds the ACL and the audit trail governing the very call being made — a wrapped tool that can read the policy can plan around it.
The mode comes from the module's readonly annotation, and an unannotated
module is treated as a writer. That inherits §5.2's caveat: a false
readonly — a command whose name matches a readonly pattern but which
writes — gets the weaker of the two treatments here as well as an explicit
allow rule in the ACL. Both point at the same remedy, which is to correct the
classification with an overlay.
config.yaml's additional_denied_paths appends to the credential list,
so a configured path binds readers too: an operator naming a path explicitly is
asserting it is sensitive, and the stronger of the two readings is the one that
cannot be wrong in the dangerous direction.
allowed_paths is the one setting that goes the other way, and it is empty
unless an operator writes it. It exists because the alternative was worse:
an agent that legitimately has to write /etc/nginx/conf.d otherwise had to be
handed that tooling outside CallPact altogether, which drops the audit trail and
the ACL along with the path check — §5.1 in miniature, reached by way of a
control that was too rigid to use. A narrow declared carve-out keeps the call
inside the governed path.
Nothing validates that a carve-out is wise. Naming /etc, or a credential
directory, is honoured — overruling an explicit instruction would put the guard
in the business of second-guessing the person who deployed it, and an operator
staring at a config file that appears to do nothing is its own failure mode.
What the guard does instead is refuse to be quiet: every carve-out is logged at
startup, and one that opens a whole system location or exposes credentials is
logged at warn. Two properties are worth stating plainly: a carve-out
grants everything beneath it, and a carve-out over a service's configuration
directory grants that service's behaviour — write access to
/etc/nginx/conf.d is enough to add a proxy_pass and redirect traffic,
without touching anything else under /etc.
Carve-outs and denials share one specificity ladder, so a subtree can be opened
and part of it fenced off again. An exact tie is broken by whose carve-out it
is: a configured allowed_paths entry wins, because it is an instruction; the
derived temp-directory exemption loses, because nobody asked for it and an
exact overlap there is a coincidence — which is what stops a TMPDIR pointed
at ~/.ssh from reading a key out.
Comparison happens on the resolved path, never the supplied string. Three transformations sit between what a caller sends and what the kernel acts on, and skipping any one makes the guard decorative:
- Relative paths are joined to the guard's root — which is also what
Command::current_diris set to, so the guard and the child cannot disagree about where../../etc/passwdlands. Before this, the child inherited CallPact's own working directory, and the meaning of every relative argument depended on where the operator happened to launchcallpact servefrom. - Symlinks are followed.
/tmp/x -> /etcmakesrm -rf /tmp/x/a request to delete/etc, and no string comparison on/tmp/xsees it. The longest existing prefix is canonicalized, so a destination that does not exist yet (amkdir -ptarget, acpdestination) is still judged. ..components are folded — but only across the non-existent tail, and only after the symlinks ahead of them are resolved.std::path::absolutepreserves..because POSIX requires it, and collapsing it lexically first is wrong:/tmp/link/..is the parent of link's target, not/tmp.
A guarded location that is itself a symlink is held in both spellings. The
resolution above is deliberately partial — only the part of a path that exists
gets canonicalized — so the same location can reach the comparison spelled two
ways. On macOS /etc and /var are links into /private, and a baseline
canonicalized once would contain only /private/etc; a .. climb through a
directory that does not exist folds lexically and arrives as the literal
/etc/passwd, which matches neither. Every denied entry — the compiled-in
baselines and additional_denied_paths alike — therefore stores its literal and
its canonical form. Carve-outs (allowed_paths) deliberately do not: a second
spelling can only match more paths, which is the right direction for a refusal
and the wrong one for an exemption.
The check runs in both directions, and only one of them binds a reader.
Containment — the path sits inside a protected location, /etc/passwd under
/etc — applies to both modes, and is what refuses cat ~/.ssh/id_rsa.
Ancestry — the path sits above one — applies to writers only, because it
exists for the recursive operation that takes the protected directory with it:
rm -rf / never names /etc and destroys it regardless. Holding a reader to
it would refuse ls ~ and ls / on the grounds that a home directory contains
.ssh, which is most of what a reader legitimately does; the resulting gap is
§5.8's third bullet. Matching is by whole path component either way, so
/etcetera does not collide with /etc.
One carve-out exists, and it is compiled in. On macOS the per-user
temporary directory is /var/folders/<x>/<y>/T, so guarding /var would
otherwise refuse every use of the directory whose purpose is being written to.
config.yaml cannot extend the carve-out list, and a TMPDIR that equals or
contains a system location is discarded rather than honoured. The credential
list is deliberately not weighed there: a home directory under $TMPDIR is
ordinary in a sandbox, and counting it would void the carve-out and re-arm
/var across the whole temp directory. Specificity already refuses a
credential path nested inside a carve-out. Where a denied
entry and the carve-out both cover a path, the more specific one decides; a tie
is a refusal.
A refusal is ACL_DENIED, carrying the requested path, the resolved path and
the protected location that matched. The resolved path is in the message
because the requested one frequently does not look protected — that is the
whole point of resolving — and a caller told only "denied" cannot tell a
mistake from a misconfiguration. Being a governance code rather than an input
code also keeps it out of circuit-breaker health (breaker.rs excludes
governance refusals), so a caller repeatedly probing /etc cannot open a
circuit and deny cli.rm to everyone else.
Unlike --acl and --enable-approval, this is on by default and has no
off switch (§5.3 does not apply to it).
The boundary is inspectable without running a server. callpact paths prints
the guard as installed — both compiled-in baselines, whatever
additional_denied_paths added, the allowed_paths carve-outs, and the derived
temp-directory exemption — read off the live guard rather than re-derived from
config.yaml, so it cannot describe a policy other than the one in force.
callpact paths --path <p> --mode read|write calls the guard's own check, the
same call a wrapped tool's argument goes through:
callpact paths # the whole boundary
callpact paths --path /etc/passwd # refused to a writer
callpact paths --path /etc/passwd --mode read # allowed to a readonly module
callpact paths --path ~/.ssh/id_rsa --mode read # refused: credentials bind readers
This matters for review rather than enforcement: §5.2's remedy is "check the
classification", and until now checking what a given module could actually reach
meant standing up callpact serve and driving it with an MCP client.
4.9 Flag-level risk, for the two things a scan cannot infer¶
Help text does not distinguish git --exec-path=<path>, which sets a search
path, from git --upload-pack=<cmd>, which runs one. Both read as "takes a
value" to every parser CallPact has, so guessing would produce exactly the
plausible-but-wrong assertion this project exists to avoid. A curated overlay
states it instead, and the field defaults to absent.
risk |
Enforcement | Contract keyword |
|---|---|---|
escalates |
The call goes to the approval gate — only when the flag is actually sent (§5.2's approval-fatigue argument: marking the command would prompt on every git push) |
x-apexe-escalates: true |
executes |
The call is refused with ACL_DENIED, before anything spawns |
x-apexe-exec: true |
benign |
Suppresses the name-list escalation for this one flag (bsdtar -y is bzip2, not "assume yes") |
x-apexe-escalates: false |
executes is a different claim from escalates, not a louder one. §4.1's
guarantee is that argv reaches execve with no shell on the path; a flag whose
value becomes a command hands that guarantee straight back, and no JSON Schema
constrains what the string becomes. It is refused rather than gated because an
approval prompt would ask a human to predict what an arbitrary string will do —
the judgement least likely to be made correctly under a stream of prompts, which
is the same reasoning §5.9 applies to the exec wrappers. There is no
per-parameter carve-out: an operator who needs one runs the tool outside CallPact,
which is at least a visible decision.
Enforced in executor::reject_exec_parameters, which checks effective values
only — {"upload_pack": false} renders no flag, so it is not sending one.
Escalation is enforced in ApprovalGate, which reads the properties recorded at
scan time against the arguments a call carries.
This is a floor and it is small. executes is set today on the flags a
human has checked, not on every flag that has the property. An unmarked flag of
this class in an un-overlaid tool is not caught — docs/overlays.md lists the
known members and requires verification against a real installation before
asserting one.
5. What CallPact does not stop¶
This section is the reason the document exists.
5.1 An agent that has a shell does not need CallPact¶
CallPact governs the tools it exposes. If the same agent host also offers a
general Bash/Shell/Terminal tool, the agent can bypass every control here
by simply not using the governed path.
CallPact raises the floor only if the ungoverned floor is removed. Wrapping
git while leaving a shell tool enabled buys you an audit trail of the calls the
agent chose to make politely. Deploy it together with host-level restriction of
raw shell access, or inside a sandbox where raw execution is unavailable.
This is the single most important limitation on this page.
5.2 Annotations are name-based heuristics, and can be wrong¶
Matching cli-permissions overlays supply reviewed behavioral assertions for specific command variants. The first online scan can download the default corpus; later scans use the recorded snapshot until explicitly updated. Repository data is validated before installation, and selection checks declared platform, variant, version and probe constraints. This establishes a source and a match, not a guarantee that the author's behavioral assertion is correct.
Without matching facts, src/adapter/annotations.rs classifies commands by
matching names against fixed pattern lists (READONLY_PATTERNS,
DESTRUCTIVE_PATTERNS), with invocation-based flag escalation. Offline scans
still use matching cached and local overlays; only tools without matching facts
use the fallback. Failed acquisition likewise retains available local sources.
The two error directions are not symmetric:
- Missed destructive (a destructive command whose name matches nothing) →
falls through to
default_effect: denyin a newly generated ACL. Safe direction for that default; an existing operator-selected default is preserved. - False readonly (a command whose name matches a readonly pattern but which has side effects) → gets an explicit allow rule. Unsafe direction.
The built-in fallback marks find and command-execution wrappers such as env
as destructive, because their invocable surface can execute a caller-selected
program. Arbitrary tools or subcommands with harmless-sounding names can still
be misclassified. Destructive and open-world annotations both disqualify a
module from the generated readonly allow rule, even if readonly is also set.
The classification also feeds §4.8. A false readonly gets the weaker of the path guard's two treatments as well as an ACL allow, so one wrong annotation now moves two boundaries.
Review the generated ACL before serving it. It is a starting point produced from corpus assertions and fallback inference, not a policy you have approved. Use overlays to correct classifications for tools you rely on.
5.3 Policy selection at startup¶
For manual startup, supply --acl and --enable-approval to enable those
gates. A bare callpact serve
gives you the contract (schema validation), CLI process controls (§4.1, §4.2,
§4.5, §4.6), typed-path checks and the audit trail — and no ACL or approval
policy: every registered module is
callable by every caller.
callpact agent --mcp-only requires a loadable ACL and always includes its path
in the generated server arguments. callpact setup records the selected ACL in
the shim manifest, so removing that file causes covered invocations to fail.
For a manually started MCP server with ACL and approval, use the following.
5.3.1 The approval gate additionally needs client support¶
Without --enable-approval, requires_approval annotations are recorded but
never enforced by a human decision.
With it, the prompt is delivered as an MCP elicitation, so a client that declared no elicitation support cannot be prompted and the call is refused. This is deliberate (refusing beats silently proceeding) but means the gate's behaviour depends on the connected client.
There is no approval gate on the A2A surface at all — A2A has no elicitation
channel, and callpact a2a rejects the flag rather than accepting it and doing
nothing.
For a boundary that needs no human and works on every surface, use --acl.
5.4 Approval is not an ACL condition¶
require_approval is not a registered apcore ACL condition key. Approval gating
happens in the Executor's ApprovalHandler, not in ACL evaluation. Writing it as
an ACL condition would silently never match — the rule would fall through rather
than deny. Do not attempt it in a hand-written policy file.
5.5 The audit trail cannot tell you what was deleted¶
Because no argument values are recorded, audit.jsonl answers "which principal
invoked which module, when, with what outcome" — and not "which file did it
remove". This is a privacy-and-tamper tradeoff, taken deliberately. If your
forensic requirement is the latter, CallPact's log alone will not meet it.
5.6 Scan quality is bounded by the tool's own help output¶
Schemas are derived deterministically from --help, man pages and shell
completions. A tool with incomplete, inconsistent or absent help produces an
incomplete schema. Nothing here infers intent — that is the point, but it means
coverage varies by tool. Curated overlays exist for this reason.
5.7 Not covered at all¶
- Anything the agent does without invoking a wrapped tool: direct HTTP calls, file writes through its own edit tool, code it executes in a sandbox
- Prompt injection reaching the agent through tool output (CallPact bounds size, not content)
- Compromise of the
callpactbinary, its binding files, or its ACL file. Binding files are checked againstBINDING_INJECTION_CHARSas a tamper signal, which is a signal and not a defence - Anything that happens after the wrapped tool starts running
5.8 The path guard sees types, not intent¶
The guard checks the arguments the input schema types as paths, at the strength
the module's readonly annotation selects. Five limits follow directly, and
none of them is a bug to be fixed later:
- A schema that does not mark a value as a path leaves it unchecked. The
marker comes from the scanner's
ValueType::Pathinference or from an overlay's"type": "path". A tool whose help text does not reveal that an option takes a filename yields an unmarked value, and the guard has nothing to act on. Guessing is not the alternative — treating every string as a path would refusegrep /etc/hosts logfile, whose first argument is a pattern. - It bounds arguments, not what the tool does with them.
find . -delete, a config file that names a target, a tool that reads paths from stdin, and any shell-out the wrapped tool performs itself are all past the boundary. The last bullet of §5.7 — nothing after the wrapped tool starts running — still holds in full. - The mode is per module, not per argument.
cp /etc/hosts ~/backupis refused even though/etc/hostsis only being read, becausecpis not areadonlymodule and both its operands are judged at the module's strength. Distinguishing a source operand from a destination would need a per-argument direction the scanner cannot infer and no overlay declares. The failure direction is a refusal rather than a permit, so this is friction rather than exposure. - A recursive read rooted above a credential directory is not caught.
Ancestry binds writers only (§4.8), so
grep -r … /andls -R ~pass the guard even though a recursive read can reach~/.ssh. The alternative was refusingls ~outright, which is most of what a read-only tool is for. The guard sees paths, not the-rthat changes what a path means — closing this needs flag semantics it does not have. - Glob expansion never happens (§4.1: no shell), so
rm /etc/*reaches the guard as a single literal path and is refused. That is the safe direction, but it is a consequence of having no shell, not something the guard verifies.
The guard raises the floor for the case that actually recurs — an agent pointing a legitimate destructive command at a system directory. It is not a sandbox, and §5.1 and §6 still apply in full.
5.9 A tool that runs other tools defeats every name-based control¶
env, xargs, nice, timeout, nohup, chroot, sudo and their kin do
not merely have dangerous options — running a caller-supplied command is
their interface. Everything CallPact decides from a command's name is therefore
decided about the wrapper rather than about what it will run.
This was live, and it is worth stating exactly because the shape recurs:
env's name is inREADONLY_PATTERNS, so the generated ACL gave it an explicit allow (§5.2's "false readonly", reached by the worst possible name).- BSD
envtakes-S <string>, which splits the string into argv and executes it.-Sis typedstring, notpath, so §4.8's guard never inspected it — correctly, by its own contract, since nothing there is a path. cli.envwith{"S": "rm -rf /etc"}therefore passed both controls.
EXEC_WRAPPER_TOOLS in src/adapter/annotations.rs now classifies these as
destructive, which flips the generated ACL from allow to deny and makes the
path guard judge their arguments as a writer's. Two overlays that carried
destructive: false for xargs were corrected in the same change, since a
curated overlay replaces the scan result and would otherwise have overridden
the classification silently.
That fix is a floor, not a solution. No static analysis can decide what
argv a caller-supplied string will become, so the guard cannot inspect the
command inside -S or the one after xargs. Treat these tools as equivalent
to handing the agent a shell (§5.1):
# In your ACL, ahead of any broad allow rule:
- callers: ["*"]
targets: ["cli.env", "cli.xargs", "cli.sudo", "cli.timeout", "cli.nice"]
effect: deny
description: "Command executors — argv is caller-controlled"
Better still, do not scan them into the registry at all. A wrapped env buys
nothing that wrapping the underlying tool directly does not, and it costs every
control in §4.
5.10 A binding older than the control it feeds turns that control off¶
Three of the controls in §4 read the schema rather than the command: the path
guard acts on values typed x-apexe-path (§4.8), the approval gate on
x-apexe-escalates and x-apexe-approval-basis (§4.9), and log redaction on
x-sensitive. A binding file written before a keyword existed does not carry
it, so for that module the control has nothing to act on and enforces
nothing. Nothing fails; the call simply is not checked.
This is a different limitation from §5.8's first bullet, and the difference is the remedy. There, the scanner could not tell that an option takes a filename, and no rescan changes that. Here the scanner infers it perfectly well and the file on disk merely predates it — a rescan fixes it completely. Reading §5.8 as covering both would leave an operator concluding there is nothing to do.
It is not a hypothetical. 0.7.0 introduced all three keywords; on the development machine where this was found, 166 of 166 binding files had been written by an earlier release, so all three controls were inert across the entire registry and no mechanism existed to say so.
Bindings now carry metadata.apexe_scan_format, and every registered CLI
module with a missing or incompatible format produces a rescan warning. The
producer stamp metadata.generated_by is retained as provenance, while the
format number is what the runtime compares. Existing bindings remain loadable:
a warning identifies the gap, but does not repair missing markers or certify
that a tool still matches its schema. Re-run callpact scan after a format warning.
Trust in a binding's grammar is stamped per route, not per tool:
metadata.grammar is reviewed only when every flag the route can emit came
from a curated overlay, and scanned otherwise — including a route that
declares no flags at all, since nothing about it was read. metadata.grammar
replaces shim_contract.authoritative as the gate for a Verified shim route
and for native callpact exec, which admits reviewed routes only; a binding
written before the stamp falls back to the tool-level contract, the stricter of
the two. The distinction exists because one boolean per tool cannot describe a
command with 142 subcommands: it made git either wholly reviewed or not at
all, and neither answer is true.
5.11 Local execution and the remaining Stage 2 boundaries¶
Module-mode callpact exec executes declared modules with captured output and
null stdin. Native callpact exec -- <command> and Stage 2 shims share reviewed
argument resolution and passthrough streams. See the
execution surface matrix for stdin and
sandbox defaults. Native
exec works without activation and checks executable identity, including absolute
paths; it does not restrict commands invoked outside that entry point. It uses the fixed local ACL caller; --as is accepted only for
a non-executing simulation and marks that identity as asserted. It loads the
default ACL when present and fails closed on an unreadable or malformed policy.
These limitations remain present even with the implemented PATH shims.
docs/features/v2-f8-local-execution.md §8
describes the shipped stdin and shim boundaries:
- Explicit unmanaged execution lacks argument path typing. Native exec
defaults to refusing unknown commands.
--unmanaged allow|approvalopts into literal argv under anunmanaged.<basename>ACL target; the loaded ACL still applies. Timeout, the passthrough environment denylist and audit remain, but schema-derived path checks cannot run. stdin is null. Arbitrary programs can start subprocesses or access files directly, so this option requires external containment for agents.approvalstill requires ACL permission; native local execution prompts on/dev/tty, and a non-interactive call is refused. - stdin is an ungoverned input channel. Every control in §4 acts on
argv. An inherited stdin is not schema-validated, not path-checked and not
recorded — and for any tool that reads a program from stdin (
python -,awk,sh -s,sed -f -) that is a complete bypass by a different route than §5.9's. Local managed calls inherit stdin whether or not the overlay declaresstreaming_stdin_safe. Treat stdin-producing processes as part of the caller's trust boundary, and use OS confinement when that is not safe. -
Embedded child commands are argv-gated, not confined. A command that embeds another program's argv (
find . -exec rm {} \;) is refused by default.child_exec.mode: analyzeresolves the child to its own reviewed module and applies that module's schema, ACL, path policy and approval at the parent's starting paths;delegatere-enters the installed child shim per match, so the actual{}path, symlinks and-execdir's working directory are checked. The short-lived grant binds the selected policy, caller and prepared child scope. Only a positive terminal decision for that scope satisfies a fresh approval requirement. Neither mode confines the child's own logic:sh -c,sed 'w /etc/x',python -cand TOCTOU still need an external confinement backend. The module-JSON/MCP surface never executes an exec-list without the native analysis, andtrust_uncoveredis an explicit operator responsibility. Seedocs/features/v2-f8-local-execution.md§8.3 and the user manual. -
Shim coverage is partial, and the gap silent. Shell builtins —
cd,echo,test, and in most shellskill— are resolved without consultingPATH, so no shim can sit in front of them and nothing at the point of use distinguishes a governed command from an ungoverned one. - A shim is bypassable by absolute path.
/bin/lsis not aPATHlookup. This is §5.1 applied locally: against a human the shim is an audit trail, not enforcement; it is a real boundary only wherePATHand the filesystem are controlled externally (a container, a CI runner image). - A host pre-tool hook is fail-open and rewrites only simple commands.
callpact hook claudecan deny aBashcall and rewrite a simple external command tocallpact sh -c '<command>', but Claude Code treats a hook that cannot start, exits with a code other than 2, or emits an unknown protocol as a warning and runs the original command (verified with 2.1.318 on 2026-11-05). It leaves builtins, pipelines and compound commands unchanged, so those still depend on PATH shims. Treat it as one routing layer, not as the boundary. --asasserts a principal, it does not authenticate one. F8 constrains it to--dry-runfor that reason, and audit records from a preflight mark the principal as asserted.
6. Recommended deployment¶
- Run
callpactinside a sandbox. It governs; the sandbox contains. The per-call delegation indocs/sandbox.mdis complementary, not a substitute: it confines only selected modules when an enforcing backend is available; it does not replace the outer sandbox, andrequiredrefuses when no backend is available.advisoryis a diagnostic, not a run mode. - Remove or restrict raw shell tools in the agent host (§5.1) — otherwise the governed path is optional, and optional controls are decorative.
- Review the generated ACL (§5.2) — especially every rule in the readonly allow list — and then pass it explicitly. It is not applied for you (§5.3):
- Confirm your MCP client supports elicitation, or the approval gate refuses
rather than prompts (§5.3.1). On A2A there is no gate at all — use the ACL.
The path guard (§4.8) needs no wiring: it is on by default on every surface.
Extend it with
additional_denied_pathsif this deployment has data directories worth the same protection. - Keep
--authat its default on HTTP transports. A non-loopback bind with no credential refuses to start unless explicitly acknowledged; do not acknowledge it casually. - Ship
audit.jsonlsomewhere the agent cannot write, and know what it does and does not contain (§5.5). - Re-review the ACL after every
callpact scan. A rescan merges freshly generated rules into the existing file, so new commands arrive with heuristic classifications you have not read yet (§5.2). - Re-run
callpact scanafter every CallPact upgrade, before trusting the path guard, the approval gate or log redaction on that host. All three read keywords out of the binding file, so a binding written by an earlier release silently carries none of them and the control enforces nothing (§5.10). A rescan refreshes these markers. Missing or incompatible scan-format metadata now produces a warning; native shim installation excludes such bindings. - Do not wrap command executors —
env,xargs,sudo,timeout,niceand their kin (§5.9). They are classifieddestructiveso the generated ACL denies them, but the durable fix is to keep them out of the registry: argv is caller-controlled there, and no control in §4 can see inside it.
7. Reporting¶
Report security issues privately — see SECURITY.md, which turns §4 and §5 of this document into an explicit in-scope / out-of-scope list.
The short version: if you find a way to reach execve with argv the contract did
not authorise, that is a vulnerability and we want it. If you find that a
heuristic misclassified a command, that is §5.2 working as documented — an
overlay fix, not a vulnerability.