test(fuzz): fuzz the broker's command line and the gate's path resolution
Problem
The only fuzz target, broker_requests, reaches the gate through the broker with one READ | LIST grant, and fails only if a delivered descriptor reads the secret. Nothing fuzzes path resolution directly, with nested grants, create, and checks on what a success reached. Nothing fuzzes fsgate-broker's --grant and --direct parsers. fuzz.yml runs only when broker.rs changes. This is the fourth item of M10 in the roadmap.
Change
gate_pathsrunsopen,create,metadata, andread_diron arbitrary paths through oneGate.- Tree. Three grants:
granted(READ | LIST), withgranted/nested(READ) andgranted/w(every right) inside it. They sit in a fixed tree with FIFOs, a sibling whose name starts with the grant's, and symlinks that stay inside, climb out, are absolute, dangle, or loop. No symlink leads out of the tree. - Checks. A success must reach an object, by device and inode, beneath the grant the path routes to, and a listing must be one of a directory there. A refusal must be the one the routing calls for.
opennever returns a directory. The tree must not change, except that acreatemay make or truncate the file it returns; the target then puts the tree back. - Input. One operation a line. A lowercase letter takes a path relative to the tree; an uppercase one takes the raw path, so it can be relative or name anything.
- Tree. Three grants:
broker_argscompares the parser with a restatement of its rules: each--grantand--directspec, alone and in a command line, and the mode the options select. Arguments are split at NUL bytes. A one-byte argument such asUstands for an option such as--unconfined, so that one changed byte swaps one option for another.- The parser moves, unchanged, from
fsgate-broker.rsintofsgate-broker/args.rs, which the target includes with#[path]. The only textual difference is rustfmt wrapping one signature thatpub(super)made longer.confine.rskeeps callingsuper::parse_direct. - Seeds and dictionaries for both targets, in
fuzz/seeds/andfuzz/dicts/. .cargo/mutants.toml(from #80) examinesfsgate-broker/args.rstoo, so the parser's mutants keep counting in their new file.fuzz.ymlruns every target on Linux, andgate_pathson macOS too. Each runs for 15 minutes when anything incrates/fsgate/src/orfuzz/changes, for an hour every Monday, and on demand. A finding uploads the input. The oldbroker-requestsjob is nowbroker_requests (ubuntu-latest); no check is required onmain.
Safety and compatibility
The broker's behavior does not change: the parser's code moved without edits, and nothing else in the crate changed. The packaged crate includes src/bin/fsgate-broker/args.rs (cargo package --list).
Mutation testing (#80). .cargo/mutants.toml there lists the broker's files by name. Whichever of #80 and this PR merges second must add crates/fsgate/src/bin/fsgate-broker/args.rs to it, or the parser's mutants drop out of the run.
Verification
Controls. Each defect was put in on purpose and fuzzed on macOS from one or two seeds, with libFuzzer seed 1:
| Defect | Target | Found after |
|---|---|---|
open follows the path from the root, not beneath the grant | gate_paths | 100,511 inputs, about a minute |
| Routing picks the shortest covering grant | gate_paths | 51,386 inputs, under 40 s |
create follows the path from the root | gate_paths | 15,937 inputs, under 40 s |
--direct accepts w | broker_args | 6,155 inputs, under 3 s |
Interception mode accepts --unconfined | broker_args | 303,507 inputs, under 12 s |
The last one first went unfound for five minutes, twice: once with a dictionary of the option names and once with each name ending in a NUL. That led to the one-byte stand-ins. Before the controls, a traced run of the seeds showed each operation getting the answer its seed was written for.
Recorded runs on macOS 26.2 (Apple M1). No crash, hang, or check failure. Toolchain: rustc 1.102.0-nightly (f5cedb83a 2026-11-07), cargo-fuzz 0.13.2, libfuzzer-sys 0.4.13, with AddressSanitizer.
| Target | Seconds | Inputs | Per second | Corpus | Coverage counters |
|---|---|---|---|---|---|
gate_paths | 901 | 371,858 | 412 | 9 seeds to 564 inputs | 1,037 to 1,095 |
broker_args | 901 | 5,846,233 | 6,488 | 19 seeds to 733 inputs | 442 to 614 |
Recorded runs in CI, the fuzz jobs on 144078d, with the same toolchain. No crash, hang, or check failure.
| Target | Runner | Seconds | Inputs | Per second | Corpus | Coverage counters |
|---|---|---|---|---|---|---|
gate_paths | Linux 7.0.0-1019-azure x86_64 | 901 | 411,576 | 456 | 9 seeds to 405 inputs | 840 to 873 |
broker_args | Linux 7.0.0-1019-azure x86_64 | 901 | 3,155,653 | 3,502 | 19 seeds to 759 inputs | 444 to 622 |
broker_requests | Linux 7.0.0-1019-azure x86_64 | 901 | 26,466,766 | 29,374 | 14 seeds to 1,376 inputs | 1,013 to 2,111 |
gate_paths | Darwin 25.6.0 arm64 | 901 | 385,580 | 427 | 9 seeds to 566 inputs | 1,037 to 1,098 |
All 12 checks passed on 144078d.
After merging main (#77 and #80), all 17 checks passed on 10ba3e2, including the three Linux fuzz jobs, gate_paths on macOS, and both mutants jobs. With args.rs examined, the totals and the misses are unchanged: Linux tested 420 mutants and missed the 29 listed, and macOS tested 278 and missed the 6 listed. Before this change, the parser's 28 mutants were counted under fsgate-broker.rs.
check failed once on 10ba3e2 in a_program_a_confined_worker_leaves_running_ends_with_it, with "the program never ran", and passed on a rerun of that job. That test is from #75 and is not touched here: it checks that a program is still running after its worker has exited, which races the broker's kill of the worker's group. The same failure showed up once in #80's mutation run.
Locally:
cargo fmt --all --checkandcargo fmt --manifest-path fuzz/Cargo.toml --check: clean.cargo clippy --all-targets -- -D warnings: clean.cargo clippy --target x86_64-unknown-linux-gnu -p fsgate --all-targets -- -D warnings, with and without--features experimental-intercept: clean. These are type-checks, not runs.cargo clippy --manifest-path fuzz/Cargo.toml -- -D warnings(stable, macOS): clean.cargo test --locked: 106 passed, and 121 after merging main.actionlint1.7.12 (with shellcheck) andzizmor1.32.0 onfuzz.yml: no findings.
Not verified:
- The weekly schedule. It only runs from
main, so it has not run yet. - The fuzz crate on Linux. Its clippy on Linux runs only in CI's
checkjob. - What the tree leaves out. It has no hard links or mounts, and nothing renames while a path resolves; the threat model lists those as gaps.
- The rules themselves. The parser's restatement follows the same rules, so it cannot find a flaw in them.
Documentation and release
fuzz/README.mddescribes both targets and their commands.- The threat model's gate section gets a row for arbitrary paths.
docs/security-review.mdlistsargs.rsand the new targets.ROADMAP.mdticks the item with the controls and every run above (2982f44).
Test and CI only, so no changelog entry and no release.