Repository navigation
fix: wrap install.sh executable body in main() to close the curl|sh short-read risk - #1276
Conversation
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().
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
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. 📝 WalkthroughWalkthroughThe installer logic now runs inside ChangesInstaller execution
Estimated code review effort: 2 (Simple) | ~10 minutes Merge Risk: ⚪ Minimal · up to 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: Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
Routing-Key: inbox-route/I_kwDOSUhdos8AAAABOC0qCQ
scripts/install.shruns its executable body at the top level, after thehelper functions, so under
curl ... | shthe shell can begin executing beforethe 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, soshcannot start until the closing brace is read; a short read now fails toparse 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