Expand description
Structural typing of a shell command’s effects for authority decisions.
Fail closed: observation_only is an allowlist of shapes this module fully
understands (an exact executable table, per-program option rules, and a
quote-aware syntax scan). Anything unusual (env assignments, heredocs,
comments, newlines, groupings, wrappers, unparsable segments) is simply not
observation-only. deletes and fetches_network err the other way: they
unwrap wrappers and groupings and over-report rather than miss.
No wording of the command is ever read for intent.
Structs§
Functions§
- acts_
on_ its_ ddev_ project - Whether every command is a
ddevproject’s own Drush or WP-CLI command on its own site (run in its own containers, against its own database): no code handed to it, no URL among its arguments, no file written or deleted on this computer, nothing sent to a remote. Run inside a folder the request’s work created, what it touches is that work’s own project, whatever the command is (live 2026-11-13:ddev drush watchdog:showin the Drupal site the helper had just installed asked the owner). Which folder it runs in is the caller’s to judge; acdis not accepted, so the folder is the one the call names. - command_
card - The approval card for running
line, from its structure: the folders it only looks inside, and the one effect worth a warning (deleting, with the targets when they can be read, or sending a write to a service).titleis the call’s own few words for itself. The line is shown with every secret value hidden (crate::sanitize::redact_command_secrets). - command_
effects - command_
names_ git_ config_ path - Whether any shell word of
command(including redirect targets,--opt=valueoperands, substitution bodies and nestedsh -cscripts) names a git configuration path peris_git_config_path. - egress_
effect - An egress effect on
host, with IPv6 brackets stripped so[::1]and::1name one host.Nonefor an empty or unreadable host. - execution_
backend_ is_ local - Whether the active execution backend is this machine, so paths resolve on the local disk.
- fetches_
network - Whether any command (behind wrappers, groupings, substitutions and
sh -c) is a known network-reaching executable or subcommand. - file_
tool_ write_ effects - The effects of
write_file/edit_file: a write of the path argument (or its aliases). A relative path, or any path on a remote workspace, is undeterminable here. - is_
git_ config_ path - Whether writing
pathcan plant git configuration. A structural path fact, deliberately over-reporting: - is_
observation_ reading_ input - An observation whose observers may also read plain input redirects
(
cat < file). For judging where output came from, with the redirect targets checked as operands (path_operands); the authority view (CommandEffects::observation_only) stays the stricter shape. - literal_
path_ operands - The literal paths a command names, for facts about named files (never
for trust or confinement, which need
path_operands’s all-or-nothing reading): every absolute or~/operand of every reachable command, plus its relative operands while no command changes directory. An operand that does not read literally (expansion, quoting the scanner cannot settle) is skipped, never guessed, and the rest still count. - looked_
inside - The folders a read-only command looks inside, by name, for the owner’s
card (“look inside your claude-drupal and claude-wordpress folders”).
Empty unless every command only reads or reports on this computer
(observations,
cd, a localddevproject’s own query) and writes no file. Each listing command’s operand (ls,tree,du,find,stat, a loop’s words bound) counts once, by its first component when relative and its last when absolute;.,.., home and anything still holding a variable or a glob are left out. - only_
reads - Whether every command only reads, here or across the network, and
changes nothing:
only_reads_this_computer’s shapes, pluscurlreads of any site that save nothing and send no write. What a run given the network capability does when it is not this is a change somewhere the sandbox does not reach (a container engine, a service). - only_
reads_ this_ computer - Whether every command only reads or reports on this computer and
writes nothing: observations,
cd, a localddevproject’s own query, andcurlreads of sites on this computer that save nothing (no output, header, cookie or trace file). Checking the dev site the work set up is a read, like listing its folder. Fail closed like the other shapes:wgetsaves by default, and redirects into files, deletes and writes to a site are excluded. - path_
effect - A path effect on
raw, absolute and normalized:~/expands to the home directory and a relative path resolves againstcwd(an absolute directory). On disk the nearest existing ancestor is canonicalized, so an existing path is declared by its canonical form (symlinks resolved, and on macOS case and/tmpas/private/tmp) and a new one below it agrees with it. ADeletekeeps its last component: removing a symlink removes the link.Nonewhen the path cannot be read structurally (shell expansion) or is relative with no known working directory. - path_
operands - Every operand a command could read as a path, as written: each
non-option argument of every reachable command (patterns included; they
are judged as paths, which only over-reports), and the value of a
--option=value.Nonewhen any cannot be determined structurally: shell expansion (variables, substitutions, globs, braces,~other than a leading~/), ANSI-C quoting, an option with a path glued to it (-I/x), or a command that changes directory (cd,pushd,popd), since relative operands then resolve somewhere else. - program_
label - What a command runs, in a word or two for the owner: “a shell loop” for
a
for/while/untilloop, else its first program’s name (“ddev”), “a command” when neither can be read. Never the raw line. - proven_
fetch_ urls - The URLs a command is proven to have fetched when it exits 0, as written:
the whole command is
curlorwgetinvocations joined only by&&, each naming exactly one strict URL in a shape the option tables understand. With&&the exit status is the last invocation’s and every earlier one had to succeed for it to run, so status 0 proves every fetch completed (for curl: a response arrived; with-falso a non-error status).Nonefor anything a later step could mask or that could run something else:;,||, a pipe, a background&, a newline, a subshell or substitution, an expansion, a launcher or variable assignment, an unlisted option, or a second URL in one invocation (curl reports only its last transfer). - reaches_
only_ this_ computer - Whether every command reaches nothing beyond this computer: an
observation,
cd, a localddevproject’s own query, or acurl/wgetread (no body, upload or writing method) whose every address points at this computer alone (crate::web::local_site_key: alocalhostname, a loopback address, or a dev site such as*.ddev.sitethat resolves only to loopback). Checking a site the work set up is local work, and so is addevquery, though both need the network capability in the sandbox to reach a local port or the container engine’s socket. The shapes are the same fail-closed tables as everywhere here. Resolves the addresses’ names, so it may block briefly. - recognizably_
changes - Whether
commandrecognizably changes something: a redirection into a file, a delete, a remote write, a known file-changing program (cp,mkdir,chmod,tee,sed -i, …), or a package install. Behind a remote-exec wrapper the command it runs is judged. Unlike “not read-only”, an unknown program is not a recognized change, so a caller that credits work from this can only miss a change, never invent one. Read from token structure only (machine format: a shell command line). - remote_
inner_ only_ reads - For a command that runs another command somewhere else (
docker exec,podman exec,kubectl exec,ssh): whether that inner command only reads.Nonewhencommandis not one such single wrapper, or its inner command cannot be read structurally. The inner text is judged byonly_reads, so a redirection, a delete or an unknown program inside counts as a change. Read from token structure only (machine format: a shell command line), never from wording. - root_
holds_ repository - Whether the directory
root(home-expanded, resolved againstbasewhen relative) holds a.gitentry directly inside it, so a write anywhere under it can plant repository configuration. - runs_
project_ code_ of - Whether
programwith its first wordsubcommand(none: no word) runs code the project defines: a build or a test. A Python program runs project code whatever module it is given. - sends_
remote_ write - Whether any command (behind wrappers, groupings, substitutions and
sh -c) asks a remote service to change something: curl with a method other than GET/HEAD, a body, a form or an upload; wget with a body or such a method;git push. Read from option structure, so a plain fetch is not a write. Other network programs are not judged here. - shell_
call_ effects - The typed effects of a shell command run in
cwd(an absolute directory, if known): egress hosts from the URL operands of network programs, deletes, and writes from output redirects,tee,cp/mvdestinations,touchandmkdir. NEVER complete: a shell string cannot be proven fully described (every review round found another construct), and the keys bind the owner’s declines either way. It isunderstoodwhen every segment is a program this scan models, with literal operands it resolved (no substitution, expansion,cdor unknown program): the owner is then asked again after a decline only for a call that deletes or reaches outside, not for a plain copy into the work area followed bylsanddate(live 2026-11-13). - shell_
path_ effects - A path operand of a shell command, resolved the way the OS resolves it:
the longest existing prefix of the RAW path (
..not folded first, solink/..is the link target’s parent) is canonicalized, then the rest is appended. ADeletealso declares the entry as named (its parent canonicalized, its last component kept), so both a symlink and, through a trailing/, its target are covered.Nonewhen the path cannot be read (shell expansion, relative with no working directory), when an existing prefix cannot be canonicalized (a dangling symlink), or when..follows a component that does not exist. - url_
effect - The egress effect of a URL in its strict form
(
scheme://[userinfo@]host[:port][/path][?query][#fragment]).Nonefor anything else: no scheme (programs guess one), non-ASCII, whitespace, control characters,\\, quotes, shell expansion, more than one@in the authority, a host that is not a DNS name or IP literal, a bad port, or curl glob characters ({ } [ ] * ,) outside an IPv6 host literal. The host must also be the one the URL crate reads, so a program’s parser and ours cannot disagree. - url_
host_ effect - The egress effect of a parsed URL: its host and its explicit port, else the scheme’s default.
- without_
local_ paths - Effects on a remote (SSH, Docker) workspace: its paths cannot be resolved on this disk, so path keys are dropped and the effects are incomplete. Egress keys stay.