Repository navigation
fix(security): add SHA-256 integrity verification for k8s installer download - #2046
Conversation
…staller download" This reverts commit 1a8ea87.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughAdds installer hash verification: a new GitHub Actions workflow, a bash validation/update script, Kubernetes manifest inline checksum enforcement, and a Makefile target to run the check — verifying the pinned NemoClaw installer SHA‑256 against the upstream installer. Changes
Sequence Diagram(s)sequenceDiagram
participant GH as GitHub Actions
participant Repo as Repository
participant Script as check-installer-hash.sh
participant Upstream as https://www.nvidia.com/nemoclaw.sh
GH->>Repo: checkout (pinned actions/checkout)
GH->>Script: execute scripts/check-installer-hash.sh
Script->>Repo: read pinned SHA256 from `k8s/nemoclaw-k8s.yaml`
Script->>Upstream: curl download installer
Upstream-->>Script: return installer bytes
Script->>Script: compute sha256sum of downloaded file
Script->>Repo: compare computed SHA with pinned SHA
alt match
Script-->>GH: exit 0 (valid)
else mismatch
Script-->>Repo: (if --update) replace pinned SHA
Script-->>GH: exit 1 (mismatch)
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
A stale hash breaks every pod launch. Weekly-only checks are insufficient — verify on every code submission so mismatches are caught before merge. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
There was a problem hiding this comment.
🧹 Nitpick comments (1)
scripts/check-installer-hash.sh (1)
80-82: Scope the update replacement toNEMOCLAW_INSTALLER_SHA256assignment.Current substitution replaces the first matching hash anywhere in the manifest. Anchoring it to the variable assignment avoids accidental mis-rewrites if the same digest appears elsewhere.
♻️ Proposed hardening for replacement logic
-# Perform the replacement -sed -i.bak "s/${pinned}/${upstream}/" "$MANIFEST" +# Perform the replacement (only on the installer hash assignment line) +sed -i.bak -E \ + 's#^( *NEMOCLAW_INSTALLER_SHA256=")[a-f0-9]{64}(".*)$#\1'"${upstream}"'\2#' \ + "$MANIFEST" rm -f "${MANIFEST}.bak"🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@scripts/check-installer-hash.sh` around lines 80 - 82, The sed replacement currently swaps the first occurrence of the pinned hash anywhere in "$MANIFEST" which can mis-rewrite other entries; update the substitution to target only the NEMOCLAW_INSTALLER_SHA256 assignment by matching the left-hand variable name and replacing the hash on that line (e.g., match a pattern like ^NEMOCLAW_INSTALLER_SHA256=.*<pinned_hash> and replace just the hash with <upstream_hash>), keeping the existing use of sed -i.bak and the subsequent rm of the backup; ensure you reference the variables pinned and upstream and the assignment NEMOCLAW_INSTALLER_SHA256 in the change so only that assignment line is modified.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@scripts/check-installer-hash.sh`:
- Around line 80-82: The sed replacement currently swaps the first occurrence of
the pinned hash anywhere in "$MANIFEST" which can mis-rewrite other entries;
update the substitution to target only the NEMOCLAW_INSTALLER_SHA256 assignment
by matching the left-hand variable name and replacing the hash on that line
(e.g., match a pattern like ^NEMOCLAW_INSTALLER_SHA256=.*<pinned_hash> and
replace just the hash with <upstream_hash>), keeping the existing use of sed
-i.bak and the subsequent rm of the backup; ensure you reference the variables
pinned and upstream and the assignment NEMOCLAW_INSTALLER_SHA256 in the change
so only that assignment line is modified.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: a9225ed1-c9fc-434c-beee-70823538fdde
📒 Files selected for processing (4)
.github/workflows/installer-hash-check.yamlMakefilek8s/nemoclaw-k8s.yamlscripts/check-installer-hash.sh
…r download verify_downloaded_script() computed a SHA-256 hash but only printed it — it never compared against an expected value. The Ollama installer was downloaded from https://ollama.com/install.sh and executed with no integrity verification, allowing MITM or CDN compromise to deliver arbitrary code. Pin the Ollama installer hash (OLLAMA_INSTALL_SHA256) and compare it before execution, matching the existing nvm verification pattern. Extend scripts/check-installer-hash.sh (from #2046) to also monitor the Ollama hash for upstream staleness via the weekly CI workflow. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
The k8s NEMOCLAW_INSTALLER_SHA256 is added by #2046 which hasn't merged yet. Treat a missing variable as a skip rather than a failure so CI passes before and after #2046 lands. Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Automated PR review summaryReviewed PR #2046: fix(security): add SHA-256 integrity verification for k8s installer download Recommendation
Installation and setup findings
What was validated
Failing tests and unresolved impact
Passing tests and why they matteredPassing test 1: Missing sha256sum aborts before any installer execution
Passing test 2: Checksum mismatch blocks installer execution
Passing test 3: Stale hash detection reports actionable mismatch
Passing test 4: --update rewrites the pinned hash cleanly
Bottom line
|
#2048) ## Summary - `verify_downloaded_script()` computed a SHA-256 hash but only printed it — never compared against an expected value. The Ollama installer was downloaded and executed with no integrity verification. - Pins `OLLAMA_INSTALL_SHA256` and compares before execution, matching the existing nvm verification pattern. - Extends `scripts/check-installer-hash.sh` (from #2046) into a registry-based multi-hash checker that monitors both the k8s NemoClaw installer and the Ollama installer for upstream staleness. - Adds the Ollama hash to the weekly CI workflow and `make check-installer-hash`. ## Ordering dependency > **This PR must merge after #2046.** It extends the `check-installer-hash.sh` script and CI workflow introduced there. Expect a merge conflict on `scripts/check-installer-hash.sh` — resolve by taking this PR's version, which is a superset of #2046's single-hash script. ## Files changed | File | Change | |------|--------| | `scripts/install.sh` | `verify_downloaded_script()` accepts optional expected hash; `OLLAMA_INSTALL_SHA256` constant; both Ollama download sites pass hash | | `install.sh` | Bootstrap copy gets same hash-checking capability | | `scripts/check-installer-hash.sh` | Generalized to check multiple pinned hashes (k8s + Ollama) | | `.github/workflows/installer-hash-check.yaml` | Weekly + PR + push CI check for all pinned hashes | | `Makefile` | `make check-installer-hash` target | ## Test plan - [x] Run installer normally — Ollama install succeeds with "integrity verified" message - [ ] Set `OLLAMA_INSTALL_SHA256` to a wrong value — installer aborts with "integrity check failed", Ollama script does NOT execute - [ ] Remove sha256sum and shasum from PATH — installer aborts with "No SHA-256 tool available" (not silently skipped) - [ ] Verify existing nvm hash verification still works unchanged - [ ] Run `scripts/check-installer-hash.sh` — reports both hashes OK - [ ] Run `scripts/check-installer-hash.sh --update` with a stale hash — rewrites the correct file 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Installer downloads now include SHA-256 hash verification to validate integrity and detect corrupted or compromised files. * Added automated verification workflow that continuously validates pinned installer hashes against upstream sources on a weekly schedule with manual trigger capability. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Signed-off-by: Aaron Erickson <[email protected]> Co-authored-by: Claude Opus 4.6 (1M context) <[email protected]>
Summary
nemoclaw.shinstaller in the k8s workspace container, preventing MITM/CDN compromise from delivering arbitrary codesha256sumpreflight check so the pod fails fast with a clear error if the binary is missingscripts/check-installer-hash.shand a weekly CI workflow to catch hash staleness before it causes runtime failuresmake check-installer-hashMakefile target for local verificationTest plan
scripts/check-installer-hash.sh— should report OKscripts/check-installer-hash.sh --updatewith a stale hash — should rewrite the manifest🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Chores