Repository navigation
fix(backup): validate argument counts for options in ods-backup.sh - #6325
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-backup.sh, option parsing for-o|--outputand-t|--typeexecutesshift 2unconditionally without checking remaining argument count. When an operator or wrapper script passes-oor-tas the final flag without an option value, Bash withset -euo pipefailhalts with an unhandled internal shell errorshift count must be <= $#.This patch introduces explicit argument presence guards
[[ $# -ge 2 ]] || { log_error "Option $1 requires an argument"; exit 1; }for both flags before shifting. Existing backup types, retention policies, and compression handling remain completely untouched.Validation
bash ods-backup.sh -oorbash ods-backup.sh -tfailed with internal shell shift error and non-zero exit code before usage diagnostics.Option <flag> requires an argumentto stderr; valid backup operations proceed normally.Overlap check
fix(hermes): write SOUL.md atomically and guard missing template in build-installation-context.py) — Hermes persona generation; zero backup utility overlap.fix(amd-topo): guard non-numeric byte counts in amd_memory_type) — GPU topology classification, distinct subsystem.fix(backup): pre-secure backup archive permissions before compression in ods-backup.sh) — archive permissions; separate from CLI argument boundary checks.Risk / AI disclosure
Follow-up integration evidence