security: verify integrity of downloaded scripts before execution#106
Merged
jacobtomlinson merged 1 commit intomainfrom Mar 17, 2026
Merged
security: verify integrity of downloaded scripts before execution#106jacobtomlinson merged 1 commit intomainfrom
jacobtomlinson merged 1 commit intomainfrom
Conversation
install.sh downloaded the nvm installer via curl | bash with no integrity check. A MITM or CDN compromise could substitute a backdoored script that runs with full host privileges before any sandbox is established. Now downloads to a temp file, checks SHA-256 against a pinned digest, and only executes on match. Ollama installer is left as-is (rolling release URL that can't be pinned, and the call is commented out). Closes #57 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
87ef69e to
171222d
Compare
jacobtomlinson
approved these changes
Mar 17, 2026
Member
jacobtomlinson
left a comment
There was a problem hiding this comment.
Tested in a fresh ubuntu container
5 tasks
jessesanford
pushed a commit
to jessesanford/NemoClaw
that referenced
this pull request
Mar 24, 2026
…IDIA#106) install.sh downloaded the nvm installer via curl | bash with no integrity check. A MITM or CDN compromise could substitute a backdoored script that runs with full host privileges before any sandbox is established. Now downloads to a temp file, checks SHA-256 against a pinned digest, and only executes on match. Ollama installer is left as-is (rolling release URL that can't be pinned, and the call is commented out). Closes NVIDIA#57 Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.
Summary
Fixes #57 —
install.shpiped the nvm installer directly throughcurl | bashwith no integrity check.Fix: Downloads to a temp file, checks SHA-256 against a pinned digest, only executes on match. No new abstractions — the check is inlined at the one call site that needs it.
Ollama stays as
curl | sh— it's a rolling release URL that can't be pinned without breaking on every Ollama update, and the call is commented out inmain()anyway.Edge cases
sha256sumorshasumTest results
9 test cases, 25 assertions, all passing. Tests ran on macOS and in Docker (ubuntu:24.04).
shasumfallback works whensha256sumunavailable (macOS compat)curl | bashpipes remain in nvm install pathTotal: 25 assertions, 0 failures
Test plan for CI pipeline
These test cases should be automated when the build pipeline is set up:
TC1 — Hash correctness: Download nvm installer independently, compute SHA-256, assert it matches the pinned
NVM_SHA256value ininstall.sh. This catches stale hashes after version bumps.TC2 — Verification pass: Serve a known file via
python3 -m http.server, call the inline verification logic with the correct hash, assert exit 0 and "integrity verified" in output.TC3 — Verification fail (tampered): Serve a file, call with a wrong hash, assert exit non-zero, output contains "integrity check failed" with both expected and actual hashes, and the file was not executed.
TC4 — Empty hash passthrough: Call with empty expected hash, assert file is still executed without verification errors.
TC5 — No hash tool fallback: Run in a container with
sha256sumandshasumremoved from PATH, assert warning "No SHA-256 tool found" is printed and the script still executes.TC6 — Temp file cleanup: Assert no orphaned temp files exist after both successful and failed verification runs.
TC7 — Download failure: Call with a non-existent URL, assert exit non-zero and "Failed to download" in output.
TC8 — shasum fallback (macOS): Run in an environment with only
shasum(nosha256sum), assert verification succeeds with the correct hash.TC9 — No curl|bash pipes:
grep -cE 'curl.*\|.*(bash|sh)' install.shon the nvm install path returns 0. Ollama (commented out) is excluded from this check.