Options after the path or URL are ignored, so check DIR --require-signature FPR passes an unsigned manifest #196

Closed
opened 2026-10-13 13:03:06 +02:00 by clawbot · 1 comment
Collaborator

mfer check DIR --require-signature FPR and mfer fetch URL --require-signature FPR accept an unsigned manifest and exit 0. Every command reads options only before its first argument (stopOnFirstArg in internal/cli/mfer.go, kept from urfave/cli v2 by #110), and check, fetch, freshen, list and export, which take one argument, ignore everything after it without a word. So an option written after the path or URL is dropped: --require-signature, --no-extra-files, --include-permissions, and --dest, where fetch then writes into the current directory. check a b checks only a; fetch URL1 URL2 fetches only the first.

Reproduce on next (0fbb3da): mkdir u; echo x > u/x.txt; mfer gen u; mfer check u --require-signature <any fingerprint> exits 0; with the option before u it exits 1 with manifest is not signed.

Severity: critical. A signature requirement the user typed is skipped and the check passes.

Correct: options are read wherever they appear, as urfave/cli v3 does by default, and -- still ends them for a path that starts with -. A command that takes one argument refuses a second one with an error naming it. gen, which takes several paths, changes only in reading options anywhere.

Definition of done

  • Failing tests first, through the CLI: check DIR --require-signature FPR on an unsigned manifest exits 1; fetch URL --dest D writes into D; freshen DIR --include-permissions records modes; check a b exits 1 and names b; gen -- -x treats -x as a path.
  • The fix in internal/cli: stopOnFirstArg goes, and each one-argument command refuses extra arguments.
  • README usage text still matches mfer --help.
  • make check passes.

Model: opus-5-5

`mfer check DIR --require-signature FPR` and `mfer fetch URL --require-signature FPR` accept an unsigned manifest and exit 0. Every command reads options only before its first argument (`stopOnFirstArg` in `internal/cli/mfer.go`, kept from urfave/cli v2 by https://git.eeqj.de/sneak/mfer/issues/110), and `check`, `fetch`, `freshen`, `list` and `export`, which take one argument, ignore everything after it without a word. So an option written after the path or URL is dropped: `--require-signature`, `--no-extra-files`, `--include-permissions`, and `--dest`, where `fetch` then writes into the current directory. `check a b` checks only `a`; `fetch URL1 URL2` fetches only the first. Reproduce on `next` (0fbb3da): `mkdir u; echo x > u/x.txt; mfer gen u; mfer check u --require-signature <any fingerprint>` exits 0; with the option before `u` it exits 1 with `manifest is not signed`. Severity: critical. A signature requirement the user typed is skipped and the check passes. Correct: options are read wherever they appear, as urfave/cli v3 does by default, and `--` still ends them for a path that starts with `-`. A command that takes one argument refuses a second one with an error naming it. `gen`, which takes several paths, changes only in reading options anywhere. ## Definition of done - Failing tests first, through the CLI: `check DIR --require-signature FPR` on an unsigned manifest exits 1; `fetch URL --dest D` writes into `D`; `freshen DIR --include-permissions` records modes; `check a b` exits 1 and names `b`; `gen -- -x` treats `-x` as a path. - The fix in `internal/cli`: `stopOnFirstArg` goes, and each one-argument command refuses extra arguments. - README usage text still matches `mfer --help`. - `make check` passes. Model: opus-5-5
clawbot self-assigned this 2026-10-13 13:03:06 +02:00
Author
Collaborator

Fixed in #197: options are read wherever they appear, -- still ends them, and check, fetch, freshen, list and export refuse a second argument, naming it.

Model: opus-5-5

Fixed in https://git.eeqj.de/sneak/mfer/pulls/197: options are read wherever they appear, `--` still ends them, and `check`, `fetch`, `freshen`, `list` and `export` refuse a second argument, naming it. Model: opus-5-5
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sneak/mfer#196