Repository navigation
fix(restore): reject multiple backup arguments in ods-restore.sh - #6326
Closed
vaibhavsrv wants to merge 1 commit into
Closed
vaibhavsrv wants to merge 1 commit into
vaibhavsrv wants to merge 1 commit into
Conversation
Collaborator
|
Thanks for this contribution. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why this matters
In
ods/ods-restore.sh, argument parsing assigns positional parameters directly tobackup_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_idis already populated, it logsMultiple 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
bash ods-restore.sh backup-1 backup-2 --dry-runsilently discardedbackup-1and evaluated onlybackup-2.Multiple backup IDs specifiedto standard output/error; valid single backup targets continue to process correctly.Overlap check
fix(backup): validate argument counts for options in ods-backup.sh) — companion argument boundary fix on backup script; cleanly composed at HEAD.fix(hermes): write SOUL.md atomically and guard missing template in build-installation-context.py) — Hermes persona generation; distinct subsystem.fix(restore): resolve helper libraries from script dir when ODS_DIR lib is missing) — helper library resolution during restore, complementary.Risk / AI disclosure
Follow-up integration evidence