Skip to content

fix(restore): reject multiple backup arguments in ods-restore.sh - #6326

Closed
vaibhavsrv wants to merge 1 commit into
Osmantic:public-betafrom
vaibhavsrv:fix/restore-multiple-backup-args
Closed

vaibhavsrv wants to merge 1 commit into
Osmantic:public-betafrom
vaibhavsrv:fix/restore-multiple-backup-args

Conversation

@vaibhavsrv

Copy link
Copy Markdown
Contributor

Why this matters

In ods/ods-restore.sh, argument parsing assigns positional parameters directly to backup_id="$1" without checking if a backup identifier was already parsed. If an operator or automated runner mistakenly passes multiple positional identifiers (e.g. ods-restore.sh snapshot-A snapshot-B), the first identifier is silently discarded and replaced by the subsequent one. This can cause restore operations to execute against the wrong backup target without user awareness.

This patch adds an explicit guard in the positional argument handler: if $backup_id is already populated, it logs Multiple backup IDs specified: '$backup_id' and '$1' and exits with error code 1. Existing options, dry-run flags, and single-argument restore workflows remain unchanged.

Validation

  • Baseline: Invoking bash ods-restore.sh backup-1 backup-2 --dry-run silently discarded backup-1 and evaluated only backup-2.
  • Post-fix: Exits with code 1 and writes Multiple backup IDs specified to standard output/error; valid single backup targets continue to process correctly.
  • Restore argument validation suites: 2 passed. New-test Ruff, ShellCheck, and diff checks pass; new regressions wired into Linux CI.

Overlap check

Risk / AI disclosure

AI-assisted investigation, implementation and CLI regressions. This strengthens a CLI input boundary check, not runtime admission. Independent human review and platform/runtime qualification remain gates. No running configuration, deployment or upstream merge changed.

Follow-up integration evidence

Composed with #6325 at 5662f0d without conflicts. Production and test diffs passed together; backup and restore workflows remain intact.
Backlog composition was local-only (production/test diffs, excluding workflow/Makefile wiring); it is not an upstream merge or independent human approval. Declared live-review gates remain open.

@Lightheartdevs

Copy link
Copy Markdown
Collaborator

Thanks for this contribution. public-beta was promoted into main on 2026-09-24 and no longer receives changes, so we're closing pull requests that target it. This isn't a judgment on the change itself. If it's still needed, please rebase onto main and open a focused PR. See #7253 for details and the contribution policy.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants