Skip to content

pm-stack(pad/seed): reject unaccounted CLI arguments before decrypting secrets or seeding #10485

Closed

Description

@dezren39

Evidence

pm-stack/pad/seed.sh is an operator script that decrypts pm-stack.sops.yaml, reads pad_api_token, and seeds Pad collections via the REST API (http://127.0.0.1:7777/api/v1/...). Its contract takes no CLI arguments (usage/docs describe running it after deploy/bootstrap).

  • pm-stack/pad/seed.sh:1-36 performs setup and immediately begins operational work (sops --decrypt at line 16, API reads/writes in seed_item calls at lines 34-36) with no argument parsing or rejection.
  • Any extra CLI arguments are ignored, so e.g. ./pm-stack/pad/seed.sh --dry-run or ./pm-stack/pad/seed.sh unexpected still decrypts secrets and performs seeding requests.

Why it matters

Per AGENTS.md "Operator script argument contract (#3352)" / doc/agents/operator-script-argument-contract.md, operator scripts must declare and strictly parse their whole command line before any subprocess/network/file work; unaccounted arguments must fail with usage/non-zero exit. Silently ignoring args can cause unintended seeding/API writes when invoked with a typo or assumed flag.

Acceptance criteria

  • pm-stack/pad/seed.sh rejects any CLI arguments (or explicitly handles only documented options, if added) with a usage message to stderr and non-zero exit before decrypting secrets or making API calls.
  • A no-argument invocation preserves existing idempotent seeding behavior.
  • Add/update coverage or a documented check for the strict-argv behavior.

Suggested fix

Add an early guard such as if (($# != 0)); then echo "usage: $0" >&2; exit 2; fi (and optionally a -h|--help handler) before cd/sops work, consistent with operator-script strict parsing.

Activity

  1. developing-today commented on Nov 15, 2026

    @developing-today
    Contributor
  2. dezren39 commented on Nov 17, 2026

    @dezren39
    MemberAuthor

    agent-note:v1 — triaged by openchamber-scheduled-lane (repo-worker-code, task 19301), 2026-11-17: already done. origin/main pm-stack/pad/seed.sh line 12 rejects any positional argument before work, and pm-stack/grist/seed.sh line 13 does the same. Issue is already CLOSED; no code change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions