Repository navigation
fix(preflight): safely validate installer flags before shifting arguments - #6796
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/scripts/linux-install-preflight.sh, options requiring parameter values (--json-file,--ods-root, and--min-disk-gb) immediately performedshift 2inside the argument parser without validating parameter presence or non-empty value boundaries. When invoked with a trailing flag without an argument underset -euo pipefail, the script aborted abruptly onshift 2with unhandled status 1 and no diagnostic output; furthermore, if another flag was passed immediately following (e.g.--json-file --strict), the subsequent flag was silently consumed as the option's value rather than being evaluated.This fix introduces surgical option argument guards matching the established CLI validation conventions in ODS scripts. If an argument is missing, empty, or starts with a hyphen indicating another flag, the script exits immediately with status 2 and writes a clear diagnostic message to stderr (
Option <flag> requires an argument). Existing valid flag parsing, output defaults, and preflight evaluation routines remain completely untouched.Validation
ods/scripts/linux-install-preflight.sh --json-filefailed underset -euo pipefailonshift 2with unhandled status 1 and empty stderr. Callingods/scripts/linux-install-preflight.sh --json-file --strictsilently consumed--strictas the JSON file path.Option <flag> requires an argumenton stderr.Overlap check
linux-install-preflight.sh.Risk / AI disclosure
AI-assisted investigation, implementation and CLI regressions. This strengthens a CLI 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 #6795 at 28743cc without conflicts. Production and test diffs passed together; capability and preflight checks 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.