8000 fix: wrap install.sh executable body in main() to close the curl|sh short-read risk by gominimal-aw-bot[bot] · Pull Request #1276 · gominimal/minimal · GitHub
[go: up one dir, main page]

Skip to content

fix: wrap install.sh executable body in main() to close the curl|sh short-read risk - #1276

Merged
norrietaylor merged 1 commit into
mainfrom
inbox-patch/harden-install-short-read-dbce2b2269ed7037
Aug 24, 2026
Merged

norrietaylor merged 1 commit into
mainfrom
inbox-patch/harden-install-short-read-dbce2b2269ed7037

Conversation

@gominimal-aw-bot
@gominimal-aw-bot gominimal-aw-bot Bot commented Aug 24, 2026 •
Copy link
Copy Markdown
Contributor

Routing-Key: inbox-route/I_kwDOSUhdos8AAAABOC0qCQ

scripts/install.sh runs its executable body at the top level, after the
helper functions, so under curl ... | sh the shell can begin executing before
the whole script has arrived. A truncated or interrupted download then risks
running a partial but syntactically-valid prefix — the standard short-read
hazard for piped installers.

This wraps the entire body in a single main() invoked as the final line, so
sh cannot start until the closing brace is read; a short read now fails to
parse instead of partially running. Execution order and POSIX sh global
variable scope are unchanged, so helper functions still see every variable set
inside main().

Verification

cargo fmt --all --check --manifest-path target/Cargo.toml — passed (no drift)
cargo clippy --workspace --locked --manifest-path target/Cargo.toml -- -D warnings — passed (0 warnings)
cargo build --workspace --locked --manifest-path target/Cargo.toml — passed
cargo test --workspace --locked --manifest-path target/Cargo.toml — passed (installer_matches_the_message_the_cli_actually_prints ok; all_scripts_pass_shellcheck ok)

Summary by CodeRabbit

  • Bug Fixes
    • Improved installer reliability when downloaded scripts are incomplete or truncated.
    • Prevented partially downloaded installer content from executing.

The executable body of scripts/install.sh ran at the top level, after
the helper function definitions. Under `curl … | sh` that lets sh begin
executing before the whole script has arrived, so a truncated or
interrupted download can run a partial but syntactically-valid prefix —
the standard short-read hazard for piped installers.

Wrap the entire body in a single main() invoked as the final line, so
sh cannot start until the closing brace is read; a short read now fails
to parse instead of partially running. Execution order is unchanged and
POSIX sh global scope means the helpers still see every variable set
inside main().
@gominimal-aw-bot
gominimal-aw-bot Bot requested a review from a team as a code owner August 24, 2026 18:03
@gominimal-aw-bot gominimal-aw-bot Bot added the agent:fix Agentic fix PR eligible for review iteration; min-aw's worker-iterate gates on it. label Aug 24, 2026
@coderabbitai
coderabbitai Bot commented Aug 24, 2026 •
Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: e22b2f47-a5c4-4bbe-83a3-938da31b0a7b

📥 Commits

Reviewing files that changed from the base of the PR and between 5c6166a and 9f6ee85.

📒 Files selected for processing (1)
  • scripts/install.sh

Included review availability: 4 reviews are currently available. Your included PR review attempts over the past 7 days set your current allowance at 5 reviews per hour.


📝 Walkthrough

Walkthrough

The installer logic now runs inside main(). The script invokes main "$@" after the function definition. This prevents truncated curl | sh input from executing a partial script body.

Changes

Installer execution

Layer / File(s) Summary
Wrap and invoke installer logic
scripts/install.sh
The installer logic is enclosed in main(). The script invokes main "$@" after the function definition.

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to 9f6ee

This localized change defers installer execution until the complete script is parsed, reducing the curl|sh short-read risk without reported functional regressions; no actionable merge-blocking risk remains after normal checks and review.

Suggested reviewers: twitchyliquid64

Poem

I’m a rabbit who checks every line,
Now partial scripts stop in good time.
main holds the code, neat and tight,
Then arguments guide its final flight.
Hop, hop—safe execution tonight!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change to wrap the installer body in main().
Description check ✅ Passed The description explains the change and rationale and provides verification results; it omits the template Checklist but remains mostly complete.
Docstring Coverage ✅ Passed Docstring check was indeterminate for this PR — some files could not be analyzed in time. Not blocking.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch inbox-patch/harden-install-short-read-dbce2b2269ed7037

Comment @coderabbitai help to get the list of available commands.

@norrietaylor
norrietaylor merged commit f731569 into main Aug 24, 2026
34 checks passed
@norrietaylor
norrietaylor deleted the inbox-patch/harden-install-short-read-dbce2b2269ed7037 branch August 24, 2026 22:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent:fix Agentic fix PR eligible for review iteration; min-aw's worker-iterate gates on it.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

0