Skip to content

fix(security): add SHA-256 integrity verification for k8s installer download - #2046

Merged
brandonpelfrey merged 5 commits into
mainfrom
fix/installer-hash-verification
Apr 20, 2026
Merged

brandonpelfrey merged 5 commits into
mainfrom
fix/installer-hash-verification

Conversation

@ericksoa

@ericksoa ericksoa commented Apr 18, 2026 •

Copy link
Copy Markdown
Member

Summary

  • Adds SHA-256 checksum verification before executing the downloaded nemoclaw.sh installer in the k8s workspace container, preventing MITM/CDN compromise from delivering arbitrary code
  • Adds a sha256sum preflight check so the pod fails fast with a clear error if the binary is missing
  • Adds scripts/check-installer-hash.sh and a weekly CI workflow to catch hash staleness before it causes runtime failures
  • Adds make check-installer-hash Makefile target for local verification

Test plan

  • Apply manifest with correct hash — pod starts normally, installer runs
  • Change hash to a wrong value — pod aborts with "checksum mismatch", installer does NOT execute
  • Run scripts/check-installer-hash.sh — should report OK
  • Run scripts/check-installer-hash.sh --update with a stale hash — should rewrite the manifest

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Installer now verifies a pinned SHA-256 checksum and will abort if the checksum does not match.
  • Chores

    • Added an automated workflow to validate the pinned installer hash on PRs, pushes to main, weekly schedule, and manual runs.
    • Added a local command to check or update the pinned installer hash and integrated it into the build tooling.

@coderabbitai

coderabbitai Bot commented Apr 18, 2026 •

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: cc2af3e3-eef1-4a2e-ac87-53e7d5f8c34d

📥 Commits

Reviewing files that changed from the base of the PR and between 90cfb3d and 5e76736.

📒 Files selected for processing (1)
  • k8s/nemoclaw-k8s.yaml

📝 Walkthrough

Walkthrough

Adds 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

Cohort / File(s) Summary
CI Workflow
.github/workflows/installer-hash-check.yaml
New GitHub Actions workflow triggered on PRs, pushes to main, weekly cron, and manual runs; checks out repo and runs scripts/check-installer-hash.sh (job gated to github.repository == 'NVIDIA/NemoClaw').
Validation Script
scripts/check-installer-hash.sh
New strict-mode bash script that extracts the pinned SHA‑256 from k8s/nemoclaw-k8s.yaml, downloads https://www.nvidia.com/nemoclaw.sh, computes SHA‑256, compares to the pinned value, exits 0/1 for validate mode or rewrites the manifest with --update.
Kubernetes manifest
k8s/nemoclaw-k8s.yaml
Inline installer execution in the pod now requires sha256sum, contains a hardcoded expected SHA‑256, downloads installer to /tmp/nemoclaw-install.sh, verifies via sha256sum -c -, deletes/aborts on mismatch, and proceeds only on checksum pass.
Build Makefile
Makefile
Added .PHONY target check-installer-hash and a Make target that runs bash scripts/check-installer-hash.sh for local invocation.

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
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐇 I hopped through files with careful paws,
I fetched the script to check the laws.
I counted sums with whiskers bright,
Rewrote the hash by moonlit night.
Hooray — the installer stays just right!

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately and concisely describes the primary change: adding SHA-256 integrity verification for the k8s installer download, which is the core security fix implemented across all modified and new files.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/installer-hash-verification

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

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]>

@coderabbitai coderabbitai Bot left a comment

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.

🧹 Nitpick comments (1)
scripts/check-installer-hash.sh (1)

80-82: Scope the update replacement to NEMOCLAW_INSTALLER_SHA256 assignment.

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

📥 Commits

Reviewing files that changed from the base of the PR and between 1a8ea87 and a451533.

📒 Files selected for processing (4)
  • .github/workflows/installer-hash-check.yaml
  • Makefile
  • k8s/nemoclaw-k8s.yaml
  • scripts/check-installer-hash.sh

ericksoa added a commit that referenced this pull request Apr 18, 2026
…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]>
ericksoa added a commit that referenced this pull request Apr 18, 2026
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]>
@ericksoa ericksoa self-assigned this Apr 20, 2026
@brandonpelfrey

Copy link
Copy Markdown
Contributor

Automated PR review summary

Reviewed PR #2046: fix(security): add SHA-256 integrity verification for k8s installer download

Recommendation

  • Recommendation: PASS
  • Highest observed severity: low
  • Block merge: no
  • Why: The most important security claim in this PR is that a tampered installer no longer executes. I extracted and exercised the actual bootstrap snippet behavior under adversarial conditions: missing sha256 tooling and a malicious downloaded payload. In both cases the flow aborted before installer execution. I also verified the new maintenance script fails closed on stale hashes and rewrites the manifest correctly with --update.
  • Reviewer summary: Reviewed PR fix(security): add SHA-256 integrity verification for k8s installer download #2046 with PR-specific adversarial probes against the installer hash verification flow and stale-hash maintenance script; the key security path held up under tampering attempts.

Installation and setup findings

  • Nemoclaw installed from /workspace/nemoclaw using ./install.sh with local source overrides. Onboarding created sandbox nemoclaw-local-install; nemoclaw list/status confirmed it, SSH into that existing sandbox succeeded, 2+2=4 executed inside it, and an in-sandbox openclaw agent query returned 4. I also confirmed that --local is intentionally blocked inside NemoClaw sandboxes, then reran the provider probe through the managed route successfully.

What was validated

  • The PR revision was checked out in an isolated review environment.
  • The local checkout was installed using the repository installer flow as closely as the environment allowed.
  • Adversarial, PR-specific probes were then run against the installed environment and relevant repository context.
  • Diff summary:
 .github/workflows/installer-hash-check.yaml       |  33 ++
 .github/workflows/nightly-e2e.yaml                |  30 +-
 Makefile                                          |   7 +-
 agents/hermes/Dockerfile                          |   5 -
 agents/hermes/manifest.yaml                       |  14 +-
 k8s/nemoclaw-k8s.yaml                             |  19 +
 nemoclaw-blueprint/policies/openclaw-sandbox.yaml |   9 +-
 nemoclaw-blueprint/policies/presets/discord.yaml  |   9 +-
 nemoclaw-blueprint/policies/presets/slack.yaml    |   8 +-
 schemas/blueprint.schema.json                     |   2 +-
 schemas/policy-preset.schema.json                 |   2 +-
 schemas/sandbox-policy.schema.json                |   2 +-
 scripts/check-installer-hash.sh                   |  86 ++++
 src/lib/agent-defs.ts                             |  23 -
 src/lib/agent-onboard.test.ts                     |  90 ----
 src/lib/agent-onboard.ts                          |  25 +-
 src/lib/nim.test.ts                               | 119 -----
 src/lib/nim.ts                                    |  41 --
 src/lib/onboard.ts                                |  67 +--
 src/lib/policies.ts                               |  7
...[truncated]

Failing tests and unresolved impact

  • No failing adversarial tests were captured.

Passing tests and why they mattered

Passing test 1: Missing sha256sum aborts before any installer execution

  • What was tested: The manifest bootstrap fails fast with a clear error when sha256sum is unavailable, before any downloaded installer can run.
  • Why it mattered: If false, minimal images could execute unverified remote code despite the PR's security claim.
  • Observed result: Exit 1 with FATAL: sha256sum not found — cannot verify installer integrity. Aborting. No installer execution marker appeared.
  • Command: bash /tmp/pr2046-test1.sh
  • Recommended follow-up coverage: Add an integration/regression test for the rendered bootstrap shell to assert the sha256sum preflight fails before any installer execution path.

Passing test 2: Checksum mismatch blocks installer execution

  • What was tested: A tampered installer payload is rejected and deleted before bash /tmp/nemoclaw-install.sh executes.
  • Why it mattered: If false, the core MITM/CDN-compromise protection introduced by this PR is bypassable and would still allow arbitrary code execution.
  • Observed result: Exit 1; sha256sum reported /tmp/nemoclaw-install.sh: FAILED and the fatal mismatch message printed. No installer execution marker appeared.
  • Command: bash /tmp/pr2046-test2.sh
  • Recommended follow-up coverage: Add a regression/integration test that injects a mismatched installer blob into the bootstrap snippet and asserts failure before execution.

Passing test 3: Stale hash detection reports actionable mismatch

  • What was tested: scripts/check-installer-hash.sh exits non-zero on a stale pinned hash and prints both pinned and upstream values plus remediation guidance.
  • Why it mattered: If false, CI and local verification may miss stale or incorrect hashes, undermining the runtime protection over time.
  • Observed result: Exit 1 with STALE plus the forged pinned hash, current upstream hash, and scripts/check-installer-hash.sh --update remediation hint.
  • Command: bash /tmp/pr2046-test3.sh
  • Recommended follow-up coverage: Add a unit/integration test around the script with a fixture manifest and mocked upstream installer response to lock in stale-hash reporting.

Passing test 4: --update rewrites the pinned hash cleanly

  • What was tested: scripts/check-installer-hash.sh --update replaces a stale manifest hash with the upstream hash and removes the temporary .bak file.
  • Why it mattered: If false, maintainers could be left with stale hashes or unexpected repo dirt after using the advertised maintenance path.
  • Observed result: Manifest hash changed from a forged stale value back to the current upstream hash; script reported old/new values; k8s/nemoclaw-k8s.yaml.bak was absent afterward.
  • Command: bash /tmp/pr2046-test4.sh
  • Recommended follow-up coverage: Add a regression test using a temp manifest copy to verify only the pinned hash is rewritten and backup cleanup occurs.

Bottom line

  • Based on the install evidence and adversarial probes, this PR looks reasonable to approve.

@brandonpelfrey
brandonpelfrey merged commit 11af5fd into main Apr 20, 2026
15 checks passed
cv pushed a commit that referenced this pull request Apr 21, 2026
#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]>
@wscurran wscurran added area: ci CI workflows, checks, release automation, or GitHub Actions chore Build, CI, dependency, or tooling maintenance platform: k8s Affects Kubernetes deployments and removed priority: high labels Jun 3, 2026
@cv
cv deleted the fix/installer-hash-verification branch June 28, 2026 00:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: ci CI workflows, checks, release automation, or GitHub Actions chore Build, CI, dependency, or tooling maintenance platform: k8s Affects Kubernetes deployments

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants