Skip to content

Finish Rust and OCaml installer downloads before running them - #17893

Open
chessing234 wants to merge 1 commit into
omacom:quattrofrom
chessing234:codex/security-dev-installer-downloads
Open

chessing234 wants to merge 1 commit into
omacom:quattrofrom
chessing234:codex/security-dev-installer-downloads

Conversation

@chessing234

@chessing234 chessing234 commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

What changes

Rust and OCaml setup currently pass curl's stdout directly into bash -c. If a transfer writes part of a valid script and then fails, Bash can still execute that partial script; the transfer's failure is lost in command substitution.

Download each installer to a temporary file, run it only after curl succeeds, preserve installer failures, and remove the file afterwards. Both transfers and redirects are restricted to HTTPS. OCaml setup stops before opam init when its installer could not be downloaded.

This is a download failure and transport hardening change, not a claim of a separately exploitable vulnerability. It does not pin vendor releases. Related #9470 addresses a different boundary: cached sudo authorization around vendor code.

Verification

The focused regression passes both truncated-download cases, confirms no partial script or OCaml follow-up runs, and checks complete Rust installation arguments and cleanup. On the unchanged base the regression fails because a partial Rust installer runs and setup reports success. Bash syntax and whitespace checks pass.

Vendor installation is stubbed. The full Linux test workflow passes: Tests run 42238665510. Actual Rust/OCaml vendor installation remains untested.

Screenshots

No visible change: installer selection and successful setup behave as before.

@greptile-apps

greptile-apps Bot commented Nov 7, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 4/5

[Medium impact] The changes affect the Rust and OCaml development-environment setup paths.

The PR appears safe to merge, with a non-blocking cleanup issue when installation is interrupted.

Findings

  1. P2 Interrupted installs leave files ▶

Summary

Rust and OCaml installers now download completely before Bash runs them.

  • Rust and OCaml installers run only after downloads finish.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Create temporary file] --> B[Download over HTTPS]
  B --> C{Download succeeded?}
  C -->|Yes| D[Run installer and save result]
  C -->|No| E[Save download failure]
  D --> F[Remove temporary file]
  E --> F
  F --> G{Succeeded?}
  G -->|No| H[Stop setup]
  G -->|Yes| I[Continue setup]
Loading

Reviews (1) · Last reviewed commit: "Finish developer installer downloads bef..." · Reviewed by Greptile

Comment on lines +37 to +43
installer=$(mktemp) || return 1
if curl --proto '=https' --proto-redir '=https' --tlsv1.2 -fsSL "$url" -o "$installer"; then
bash "$installer" "$@" || status=$?
else
status=$?
fi
rm -f -- "$installer"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Interrupted installs leave files

run_downloaded_installer removes its temporary file only when execution reaches rm. If the terminal closes or the command receives SIGTERM during a download or installation, the shell can exit before that line and leave the downloaded script behind. Add cleanup on exit and handle termination signals so interrupted runs remove the file too.

@omarchybot

Copy link
Copy Markdown
Collaborator

GPT-6 in Codex (reasoning effort not exposed by this session) read the diff, installer flow, menu callers, regression test, and existing review comments at 65a55f3. I classified the partial-download execution problem as a bug, but the configured second classifier, deepseek-v4p1-flash, returned no usable classification, so classification remains unsettled. A separate reviewer health check succeeded; no second code review ran.

Verification stopped at that classification gate: no worker tests, independent reproduction, or actual vendor installation ran, and no changes or labels were applied. This is waiting on the maintainer to resolve classification before verification continues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants