Repository navigation
Syntax is daemon-owned (G4.6): docs, program-word rejection, quoted Resolves (#89 step 4) - #122
Open
cuihtlauac wants to merge 7 commits into
Open
cuihtlauac wants to merge 7 commits into
cuihtlauac wants to merge 7 commits into
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Cuihtlauac ALVARADO <cuihtlauac@tarides.com>
Step 4 of the 1.3.1 plan: state the Phase 1 claims before the code steps that discharge them. - Assurance case: new G4.6/Sn4.6. The daemon writes all shell syntax in the command slot; a request string appears only as a shquote'd word. The one bare string is a setenv key, which validation limits to a shell name, so it reads as its quoted form would. Sn4.6 is [partial]; its residuals name the #89 steps that close them. - Sn4.5 split into Sn4.5a (syntactic: both texts parse to one tree, [discharged], bash as oracle) and Sn4.5b (semantic: that tree runs like the executor, [partial]). The GFM table no longer splits on the `||` of the accepted-exit-codes spelling. - Threat model: B1 row "caller supplies the syntax shown" (blocked by design), attack-tree leaf 3.10; the unknown-plan-key row now cites G4.6. - Roadmap, display fidelity: the two halves and G4.6, the echo and runtime self-check entries, and the step-9 lint at Rung 1. Dropped the retired shell_escape property from the Rung 2 mapping row. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Cuihtlauac ALVARADO <cuihtlauac@tarides.com>
Sn3.1 cited the shell_escape round-trip fuzzing as evidence, but the structured-plan executor removed shell_escape and that property with it. G3.1 also overclaimed: "no shell is invoked on the privileged path" is false for a privileged `shell` op, which runs as `sudo -- sh -c SCRIPT`. - G3.1 now states the invariant the code keeps (executor.rs): the daemon never assembles a shell command line; every step execs its literal argv, an escalated one as `sudo -- argv`; a shell runs only where the request names one, flagged opaque and refused under no_shell. - Sn3.1 cites build_command, escalated_leaf_is_literal_argv_never_a_shell_wrapper and tests/no_shell.rs instead of the retired property. - security.md, threat-model.md (B4 row, leaf 2.1) and the roadmap's Rung 2 list use the same wording; the dated 0.11.2 audit gets a note that shell_escape was later removed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Cuihtlauac ALVARADO <cuihtlauac@tarides.com>
Code:
- Reject a program word that shquote leaves bare but a shell reads as
syntax: NAME=…, NAME+=…, bash reserved words (check_command_word, plan
and flat pipeline). argv ["FOO=bar","true"] showed as `FOO=bar true`
("set FOO, run true") while the daemon ran a program named FOO=bar.
- Resolves: quotes request words and paths with shquote (names, wrapper
names, opaque-reason words, escaped paths), so a name with blanks or a
path with " -> " cannot pass for a column or a symlink arrow. Ordinary
names and paths are unchanged; no golden moved.
- prop_shquote_reads_back_as_one_word and
prop_built_command_is_the_argv_word_for_word replace the retired
shell_escape property; both checked against mutants.
- MCP schema text, Plan and executor comments: no "no shell on the
privileged path" or "literal argv" overclaims.
Docs:
- G3.1 states exactly how argv is passed and where a shell can run;
Sn3.1 cites the new property.
- G4.6 lists the `# exit N accepted` comments, the program-word and
unknown-key rejections, the shell op as quoted text, and Resolves:;
Sn4.6 cites the new evidence, drops the echo residual, names zsh's
reserved words as a residual.
- Notation: [discharged] allows residuals that name planned work.
- Threat model, roadmap, security.md, protocol.md, slides and the audit
summary match; Sn4.5b and the roadmap list file coverage precisely.
- Backlog and changelog record step 4.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Cuihtlauac ALVARADO <cuihtlauac@tarides.com>
The live run of PR #122 showed `error: command not found: x /usr/bin/ls` on the TTY after an approved request: a request word printed unquoted. Both not-found messages now quote the program (and the wrapper) with shquote. Changelog records the live run. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Cuihtlauac ALVARADO <cuihtlauac@tarides.com>
cuihtlauac
force-pushed
the
docs/g4.6-daemon-owned-syntax
branch
from
November 27, 2026 16:22
2c3d4bb to
8d3c7c3
Compare
CI's Kani job ran for almost two hours and was cancelled (it used to take 6 minutes): plan_run_leaf_matches_dangerous_char_spec put a symbolic character in argv[0], and the new program-word check (string search, reserved-word comparisons) does not finish on a symbolic word. - The harness puts the symbolic character in argv[1] behind a fixed program word: the dangerous-character gate is the same for every argv element; check_command_word is covered by unit tests. - Reserved words are a `matches!` instead of a slice search, so no 17-iteration loop exceeds the harness's unwind bound. All four harnesses verify locally (cargo kani 0.67), the leaf harness in 26 s. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Cuihtlauac ALVARADO <cuihtlauac@tarides.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Step 4 of the 1.3.1 plan in #89: the Phase 1 claims, written before the code steps (5–9) that discharge them. It started as docs only. An independent review then found claims the code did not meet; they are fixed in the code where that was cheap, and stated precisely where not.
Docs
Assurance case
Command:andSteps:is written by the daemon: operators, parentheses, redirections,sudo,cd/export, the accepted-exit-codes wrapper and its# exit N acceptedcomment.shquote.setenvkey appears only as a shell name, whichshquotewould leave bare anyway.shellop's script appears as one quoted argument, flagged opaque.Resolves:.shellop, which runs assudo -- sh -c SCRIPT. It now says what the code does:sudo [-u user] [K=V…] -- program argsorpkexec … env -C dir -- program args.no_shell.shell_escapeevidence.[discharged]now allows residuals that name planned strengthening, as Sn4.3 and Sn3.2 already did.Elsewhere
security.md,protocol.mdand the MCP schema now state the program-word rule and the corrected no-shell claim.Code
Behaviour changes
protocol::check_command_word):NAME=…,NAME+=…and the bash reserved words, in a plan at any depth and in the flatpipeline. Before,argv: ["FOO=bar", "true"]showed asFOO=bar true("set FOO, run true") while the daemon ran a program namedFOO=bar. With--inherit-pathand a user-writable PATH directory, such a program can exist. It is still reachable by path (./FOO=bar,/usr/bin/time).Resolves:quotes request words and paths withshquote: program and wrapper names, the words opaque reasons quote, and filesystem paths after escaping. A name holding blanks, or a path holding->, can no longer pass for a second column or a symlink arrow. Ordinary names and paths are unchanged, and no golden moved.(run by …)form (found during the live run).New property tests (they replace the retired
shell_escapeone)prop_shquote_reads_back_as_one_word: inshand inbash,shquote(w)reads back as the single wordw. Inputs include every metacharacter, quote, blank and non-ASCII sample in fixed positions, and brace and glob words run where the globs match. It was checked against mutants ofshquote's safe set: it catches every one that changes how a shell reads the word.prop_built_command_is_the_argv_word_for_word: over random run-as, hostile argv and env, thesudo/pkexecargv equals the expected form exactly, and a direct leaf passesargv[1..]unchanged. It was checked against an injected extra argument in each escalation mode.Text only: the MCP schema description and the
Planand executor comments no longer claim "no shell on the privileged path" or "literal argv".Checks
cargo test --releasepasses;cargo fmt --checkand clippy are clean;--no-default-featuresbuilds.concurrency::burst_connections_above_cap_get_busy_responsefailed once and passed on two reruns. It is the known flaky test, which also fails on a cleanmain.sudo-request --plan, unprivileged):FOO=bar true(plan and pipeline) andtime lswere refused before prompting.a ->, showed quoted inResolves:.ssh h 'x ) y'showedopaque — runs a command string remotely ('x ) y').The branch was rebased on
main, so it also carries the backlog entry for #123.🤖 Generated with Claude Code