Skip to content

github-backup(worker deploy): unrecognized arguments are silently ignored — a typo'd --dry-rnu performs a real deploy (upload + secret reset) #3287

Closed

Description

@dezren39

github-backup(worker deploy): unrecognized arguments are silently ignored — a typo'd --dry-rnu performs a real deploy (upload + secret reset)

Summary

infra/github-backup/worker/deploy.mjs (landed today in #3280 / commit 307a250) parses its CLI flags by membership only and never rejects an argument it does not recognize:

  • deploy.mjs:40-47 — const dryRun = args.includes("--dry-run"), args.indexOf("--deploy-version"); there is no allowlist check over args anywhere in the file.

So deploy.mjs --dry-rnu (or any unknown flag, e.g. --bogus-flag) is silently treated as a plain deploy of HEAD: it uploads a new Worker version, creates the 100% deployment when the version is not already live, and (re)sets the live Worker secrets DRAIN_BEARER and GITHUB_WEBHOOK_SECRET from Bitwarden — then exits 0 reporting the Worker live. The operator who typo'd the dry-run flag gets no signal that a production deploy just happened.

This is the same defect class already filed for the sibling deploy/install scripts — #3264 (pkarr-worker deploy.mjs), #3278 (opencode-claimant install.mjs), #3281 (id-mail worker deploy.mjs) — but this script is new code merged after those filings and is not covered by any of them.

Evidence (verified this run)

Laptop probe ~/git/fleet/probe-2026-10-31-laneB-ghbdeploy/ (deploy.mjs copied verbatim; sha256 feb5ebfc3d11a9a592d444e9722b8548973e533651fa9ffdac982dac28ee2ad7, matching main cf1b243f), with bws / wrangler / git stubbed to log every invocation and return canned JSON:

  • Control — node deploy.mjs --dry-run: exit 0; the only stub call is wrangler deploy --dry-run; prints "dry run: config builds, nothing uploaded".
  • node deploy.mjs --dry-rnu: exit 0; stub log shows the FULL real deploy sequence — git rev-parse HEAD, wrangler versions list, wrangler versions upload --tag git-abcdef012345 …, wrangler deployments list, wrangler secret put DRAIN_BEARER, wrangler secret put GITHUB_WEBHOOK_SECRET, and the live report (live: https://developing-today-backup.developing-today.workers.dev at version …). (No versions deploy call in this run only because the stub reported the just-uploaded version as already live; against real wrangler state a fresh upload is not live, so the deployment-create step runs too.)
  • node deploy.mjs --bogus-flag: exit 0; identical full deploy sequence.

Why it matters

This script is the deploy path for the backup webhook receiver Worker. A one-character typo in the safety flag turns a no-op validation into a production deploy of whatever HEAD happens to be, including resetting the live Worker's secrets — with a success exit code and a normal "live:" report, so the mistake is invisible in the moment and only surfaces if the deployed code misbehaves.

Acceptance criteria

  • Any argument that is not --dry-run or --deploy-version <id> (with a present, non-flag value) makes the script exit non-zero with a usage error naming the offending argument, before any bws/wrangler/git call.
  • --deploy-version followed by another flag or nothing is rejected the same way.
  • --dry-run, bare (deploy HEAD), and --deploy-version <id> behavior is unchanged.
  • A stubbed-CLI test (or equivalent) pins: unknown flag → zero stub calls + non-zero exit; --dry-run → only the dry-run validation call.

Activity

  1. added
    kind/bugSomething isn't working (prefixed form of the classic bug label)
    task/triageQueue packet kind: verify, reproduce, and route this item
    source/creatorFiled by the new-issue-creator job
    priority/normalOrdinary priority (the default)
    queue/queuedHas a queued task in the Supabase agent queue
    effort/sSmall: expected under 2 hours of work
    app/github-backupinfra/github-backup estate mirror system
    on Nov 1, 2026
  2. dezren39 commented on Nov 1, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · filed

  3. dezren39 commented on Nov 1, 2026

    @dezren39
    MemberAuthor

    Adopted as Phase 1 of design #3352. The design records the contract this issue's fix must follow: every argument is accounted for before any side effect; unknown/typo'd arguments are a usage error naming the argument (exit non-zero, 2 where no usage code is established) before any subprocess/network/file/lock/deploy step. Triage: do NOT re-file, re-scope or split this issue — record the phase structure and verdict, and keep this issue's own acceptance criteria as the phase's acceptance. Design doc: files/designs/code-operator-argument-contract.md (keep-the-four-repos-healthy goal workspace).

  4. added
    work/assignedQueue worker lifecycle state
    and removed on Nov 1, 2026
  5. 52 remaining items

  6. added
    status/parkedDeliberately paused with a recorded resume condition
    and removed
    queue/claimedQueue worker lifecycle state
    on Nov 2, 2026
  7. dezren39 commented on Nov 2, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · parked — CI pending on PR #4475

  8. dezren39 commented on Nov 2, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · picked up

  9. added
    queue/claimedQueue worker lifecycle state
    and removed
    status/parkedDeliberately paused with a recorded resume condition
    queue/parkedQueue task is parked (waiting on CI, time, or an event)
    on Nov 2, 2026
  10. added 2 commits that reference this issue on Nov 2, 2026
  11. dezren39 commented on Nov 2, 2026

    @dezren39
    MemberAuthor

    🤖 Agent note · done

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

Metadata

Metadata

Assignees

Labels

app/github-backupinfra/github-backup estate mirror systemeffort/sSmall: expected under 2 hours of workkind/bugSomething isn't working (prefixed form of the classic bug label)priority/normalOrdinary priority (the default)source/creatorFiled by the new-issue-creator jobsource/design-architectFiled by the repo design architect jobtask/small-fixQueue packet kind: bounded fix with reproduction and targeted tests

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions