Skip to content

fix(images): backport historical OpenClaw security patches - #7276

Closed
ericksoa wants to merge 142 commits into
mainfrom
fix/openclaw-tar-cve-backfill
Closed

fix(images): backport historical OpenClaw security patches#7276
ericksoa wants to merge 142 commits into
mainfrom
fix/openclaw-tar-cve-backfill

Conversation

@ericksoa

@ericksoa ericksoa commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Summary

This adds a manual, main-only path to publish security-revised historical OpenClaw base images without upgrading OpenClaw or changing any existing tag or digest. It deterministically remediates the reviewed production dependency graph and keeps runtime plugin installation transactional and fail-closed.

This PR owns historical image revisions for NemoClaw v0.0.50 through v0.0.89. Merge alone publishes no image and mutates no existing tag.

Related work and ownership

Changes

  • Preserve each historical OpenClaw version while replacing reviewed vulnerable production trees, including tar@7.5.19, and require a zero-finding production audit for the remediated OpenClaw core graph.
  • Patch npm's private bundled tar and verify that npm, npx, pack, and install remain usable.
  • Remediate all 15 pinned first-party plugin archives spanning the reviewed 2026.5.22, 2026.5.27, and 2026.6.10 versions of Slack, Teams, Discord, diagnostics, and WhatsApp.
  • Verify original archive SRI and expected dependency shape, replace only reviewed subtrees, repack with scripts disabled, verify canonical remediated SRI, and install the same remediated artifact that was audited.
  • Include the reviewed Slack and Teams Axios replacement at axios@1.18.0 and the reviewed plugin-core replacements needed for a zero high/critical plugin audit.
  • Resolve profiled, development, custom-state, and historical NemoClaw plugin installs without changing unrelated OpenClaw commands.
  • Constrain reviewed remediation to an owned direct child of /sandbox, protect credentials outside rollback snapshots, and restore state transactionally across injected install/remediation/rollback failures.
  • Stage plugin dependency and metadata replacements as one transaction, roll the entire tree back on injected mid-commit failure, and verify the exact committed graph.
  • Reject symlink-swapped metadata using O_NOFOLLOW plus descriptor-based fstat validation, and reject symlinked intermediate state/project parents before candidate discovery.
  • Resolve the exact historical release commit and immutable source image, build one multi-architecture OCI candidate with SBOM/provenance, freeze and record the Trivy databases, validate both platforms through the exact historical release Dockerfile, and publish the already-scanned OCI index with ORAS without rebuilding.
  • Refuse to publish over an existing destination tag and retain validation/publication evidence for review.

Type of Change

  • Code change (feature, bug fix, or refactor)
  • Code change with doc updates
  • Doc only (prose changes, no code sample modifications)
  • Doc only (includes code sample changes)

Quality Gates

  • Tests added or updated for changed behavior
  • Existing tests cover changed behavior — justification:
  • Tests not applicable — justification:
  • Docs updated for user-facing behavior changes
  • Docs not applicable — justification: This is a maintainer-only manual publication path and changes no existing tag, resolver, CLI option, or configuration surface.
  • Sensitive paths changed (security, policy, credentials, preflight, onboarding, inference, runner, sandbox, or messaging)
  • Sensitive-path review completed or maintainer-approved waiver recorded — reviewer/approval link/justification:
  • Non-success, skipped, or missing CI check accepted by maintainer — check name, approval link, and follow-up issue:

DGX Station Hardware Evidence

  • Tested on DGX Station
  • Tested commit:
  • Station profile/scenario:
  • Result:
  • Supporting evidence:

Verification

Tested head: 91d7d83f3b05df63458f93f29e3ba9014236d110

  • npm run check:diff passes, including repository, formatting, lint, shell, Dockerfile, TypeScript, commit, and pre-push gates.
  • The inherited Hermes swap setup is isolated outside the live .test.ts; its decision tests pass 3/3 and the changed-test conditional guard reports no added branch.\n- [x] Plugin archive snapshots open leaf files with O_NOFOLLOW, validate the opened descriptor with fstat, and hash content plus mode from that same handle, closing the CodeQL filesystem-race finding.\n- [x] Historical core verification now requires each exact reviewed post-remediation npm ls problem set and preserves the reviewed GNU/musl clipboard platform trees.
  • Exact merged-head focused suite: 121 passed; 6 opt-in container cases skipped locally. The late historical-image reconciliation adds 37 passed and 5 expected skips on its affected suite.
  • Plugin-core transaction suite: 14 passed, including injected failure after the first installed replacement with byte-for-byte and mode rollback proof, plus symlinked extensions/projects parent rejection with external-tree preservation.
  • Historical image workflow boundary tests: 10 passed.
  • Exact immutable v0.0.89-source image build preserves OpenClaw 2026.6.10, reports zero core production audit findings, and reports zero high/critical findings for every reviewed remediated plugin archive.
  • Exact immutable v0.0.50-source image build preserves OpenClaw 2026.5.18, reports the same clean audits, and preserves the historical no-shrinkwrap contract.
  • Real UID 998 /sandbox Slack install resolves axios@1.18.0, body-parser@2.3.0, and ws@8.21.1; its production audit reports zero high/critical findings.
  • Real UID 998 /sandbox WhatsApp install resolves protobufjs@8.7.1 and ws@8.21.1; its production audit reports zero high/critical findings.
  • Root is rejected from remediating the sandbox-owned state root, while the intended sandbox owner succeeds.
  • Exact-head advisor blockers are addressed: dependency plus metadata commits are transactional with injected rollback proof, and candidate discovery rejects symlinked intermediate parents.\n- [x] Reviewed plugin install interception handles supported boolean/value flags before the install target, and the rollback copy fallback documents its external failure source and retirement boundary.
  • fix(security): remediate OpenClaw 2026.6.10 transitive dependencies #7286 merged first; this branch is rebased on its merge commit and the shared scripts/audit-reviewed-npm-graph.mts behavior is reconciled and covered by the exact-head audit suite.\n- [x] Current advisory audit under Node 22.22.2 proves the pinned raw archive graph exactly matches the reviewed input (low=1 moderate=6 high=4 critical=1), while the remediated shipping graph is clean at the release threshold (low=1 moderate=1 high=0 critical=0) and the locked mcporter graph has zero findings at every severity.
  • Latest exact-head CI/advisor/E2E is running on 91d7d83f3b05df63458f93f29e3ba9014236d110.
  • test(images): verify historical OpenClaw security revisions #7294 opt-in container E2E passed against the exact final image — runs after this PR lands and the immutable candidate exists.
  • No secrets, API keys, or credentials committed.
  • npm run docs builds without warnings (doc changes only)
  • Doc pages follow the style guide (doc changes only)
  • New doc pages include SPDX header and frontmatter (new pages only)

No historical image publication workflow has been dispatched, and no image or existing tag has been published or mutated by this PR.


Signed-off-by: Aaron Erickson aerickson@nvidia.com
Signed-off-by: Charan Jagwani cjagwani@nvidia.com

Summary by CodeRabbit

  • Security
    • Pinned tar to 7.5.19 and strengthened historical OpenClaw security revision checks for Axios, Hono node-server, and OpenTelemetry/Jaeger.
    • Added a manual security artifact re-verify-and-republish workflow with immutable publication/digest validation and preserved evidence.
    • Updated the dependency graph to pin @hono/node-server to 2.0.10 and tightened reviewed dependency verification criteria.
  • Bug Fixes
    • Improved fail-closed behavior and rollback/restore reliability across security-revision wrappers.
  • Tests
    • Expanded unit/e2e and workflow tests to cover deterministic packaging, reviewed audit expectations, and integrity verification.

Signed-off-by: Aaron Erickson <aerickson@nvidia.com>
@ericksoa ericksoa added the area: security Security controls, permissions, secrets, or hardening label Jul 21, 2026
@ericksoa ericksoa self-assigned this Jul 21, 2026
@copy-pr-bot

copy-pr-bot Bot commented Jul 21, 2026

Copy link
Copy Markdown

Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually.

Contributors can view more details about this message here.

@coderabbitai

coderabbitai Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Adds a historical OpenClaw security-revision pipeline with pinned dependency remediation, transactional rollback, deterministic archive generation, Trivy validation, immutable OCI publication, provenance, and extensive tests.

Changes

Historical security revision pipeline

Layer / File(s) Summary
Immutable image publication
.github/workflows/..., Dockerfile.openclaw-tar-security-revision, test/openclaw-tar-security-revision-*
Builds, scans, verifies, publishes, and evidences multi-architecture historical revision images.
Transactional remediation
scripts/lib/*, scripts/*security-revision*, scripts/*wrapper.sh
Adds staged replacements, rollback handling, tar/Hono/npm/OpenClaw/plugin remediation, archive validation, and installation wrappers.
Archive audit controls
scripts/audit-reviewed-npm-graph.mts, ci/reviewed-npm-audit.json, scripts/lib/openclaw-npm-remediation.mts
Adds exact reviewed audit findings, expanded dependency graph remediation, deterministic archives, and OpenTelemetry remediation.
Contracts and validation
Dockerfile*, agents/openclaw/*, docs/security/*, test/*
Updates dependency pins, provenance expectations, review documentation, source contracts, and unit/integration coverage.

Estimated code review effort: 5 (Critical) | ~120 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Workflow
  participant Buildx
  participant Trivy
  participant ORAS
  participant GHCR
  Workflow->>Buildx: Build pinned multi-arch OCI candidate
  Workflow->>Trivy: Scan candidate and historical images
  Trivy-->>Workflow: Return CVE and database-hash evidence
  Workflow->>ORAS: Copy validated OCI index
  ORAS->>GHCR: Publish immutable revision tag
  GHCR-->>Workflow: Return published manifest
  Workflow->>Workflow: Verify digests and upload evidence
Loading

Possibly related issues

Possibly related PRs

  • NVIDIA/NemoClaw#7280: Modifies the OpenClaw plugin archive remediation plumbing for reviewed Axios dependency replacements.
  • NVIDIA/NemoClaw#7286: Modifies the shared OpenClaw transitive-remediation machinery used by Dockerfile, audit, and install flows.
  • NVIDIA/NemoClaw#7294: Adds related opt-in Docker end-to-end coverage for the historical OpenClaw security-revision wrapper and rollback behavior.

Suggested labels: integration: openclaw, area: ci, chore

Suggested reviewers: cv, jyaunches, apurvvkumaria

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 2.84% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: backporting historical OpenClaw security patches for images.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/openclaw-tar-cve-backfill

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

@github-code-quality

github-code-quality Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Code Coverage Overview

Languages: TypeScript

TypeScript / code-coverage/plugin

The overall coverage in commit 84a4ea8 in the fix/openclaw-tar-cve... branch remains at 96%, unchanged from commit c6f46d4 in the main branch.

TypeScript / code-coverage/cli

The overall coverage in commit 84a4ea8 in the fix/openclaw-tar-cve... branch remains at 80%, unchanged from commit c6f46d4 in the main branch.

Show a code coverage summary of the most impacted files.
File main c6f46d4 fix/openclaw-tar-cve... 84a4ea8 +/-
src/lib/domain/.../connect-env.ts 97% 89% -8%
src/lib/onboard...host-anchors.ts 94% 90% -4%
src/lib/actions...eway-restart.ts 93% 90% -3%
src/lib/shields/index.ts 72% 71% -1%
src/lib/state/m...-acquisition.ts 84% 89% +5%
src/lib/onboard...ndbox-create.ts 83% 91% +8%
src/lib/onboard...-desktop-gpu.ts 77% 89% +12%
src/lib/onboard...-create-plan.ts 75% 88% +13%
src/lib/onboard...box-prebuild.ts 69% 88% +19%
src/lib/onboard...ndbox-create.ts 33% 83% +50%

Updated July 22, 2026 16:41 UTC

Signed-off-by: Aaron Erickson <aerickson@nvidia.com>
@github-actions

github-actions Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

PR Review Advisor — Informational

Advisor assessment: Informational / medium confidence
Next action: No advisor follow-up needed.
Findings: 0 blockers · 0 warnings · 0 suggestions
Status: No actionable findings remain in the canonical review ledger.

Model lanes

  • GPT-5.6 Terra (primary): Completed · medium confidence · 0 blockers · 0 warnings · 0 suggestions
  • Nemotron 3 Ultra (second opinion): Failed

Nemotron output stays in workflow artifacts and does not change the assessment above.

E2E guidance

Advisory only. E2E / PR Gate selects and runs jobs independently.

Recommended E2E: cloud-onboard, credential-sanitization, security-posture, onboard-repair, onboard-resume, rebuild-hermes, rebuild-hermes-stale-base

Workflow run details

This automated review informs maintainers. Warnings and suggestions do not require a response. A maintainer decides whether to merge.

@ericksoa ericksoa changed the title fix(images): backport OpenClaw tar security patch fix(images): backport historical OpenClaw security patches Jul 21, 2026
Comment thread scripts/openclaw-plugin-axios-security-revision.mts Fixed
Comment thread scripts/openclaw-plugin-axios-security-revision.mts Fixed
Comment thread scripts/openclaw-plugin-axios-security-revision.mts Fixed

@apurvvkumaria apurvvkumaria left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Requesting changes on exact head 36e8c5f014607add6dd9f81c06f8ca8fa918bf03.

There are three correctness/security blockers in addition to the existing automated findings:

  1. The plugin-install wrapper is bypassable and can patch the wrong state directory. scripts/openclaw-security-revision-wrapper.sh:11 recognizes the remediation path only when plugins install occupy argv positions 1–2, and lines 25–32 always scan $HOME/.openclaw. OpenClaw accepts root options such as --profile/--dev and an OPENCLAW_STATE_DIR override. Therefore openclaw --profile qa plugins install ... bypasses remediation entirely; openclaw plugins install ... --profile qa installs under the profile state directory but then scans the default state directory. In both cases a reviewed plugin can remain on the vulnerable Axios graph. Parse OpenClaw's global options consistently, derive the effective state directory used by the original invocation, and add wrapper-level regression tests for prefix/suffix --profile, --dev, and custom OPENCLAW_STATE_DIR. Please also ensure plugins install --help does not mutate existing plugins.

  2. The new publishing workflow bypasses the repository's production build-argument guard. Current CI fails test/openclaw-dependency-review.test.ts:469 because .github/workflows/openclaw-tar-security-revision.yaml invokes the production build with unguarded BASE_IMAGE and EXPECTED_OPENCLAW_VERSION arguments. Add the canonical Validate production Docker build args guard before the build/push step.

  3. The reviewed dependency audit is red on the exact head. reviewed-npm-audit finds a high-severity Axios graph and a critical tar graph in the pristine historical archives. The Dockerfile targets tar 7.5.19 and the wrapper intends to transform reviewed plugin installs, but the required gate currently has no evidence for the post-remediation installed graph. Please make the audit verify the final transformed graph (while retaining explicit review of the vulnerable source inputs) rather than waiving the failure. The final image/plugin graph must be the artifact that satisfies the high/critical threshold.

I also agree with the advisor's existing PRA-1 blocker: the live dependency trees and metadata are replaced non-transactionally, so an injected rename/write failure can leave an installation partially remediated. The current unresolved CodeQL filesystem-race finding should be addressed as part of that recovery boundary.

Process gate: commits 545426aae0e8, 0f130c9d35e9, 0345ff239129, and 74c0146c9534 do not contain a Signed-off-by trailer, despite the repository requirement that every PR commit carry DCO sign-off and the PR description stating that all commits do. Please correct the branch history before marking the PR ready.

The shard-7 gateway-recovery.test.ts timeout appears unrelated/flaky; I am not treating that as a code blocker for this diff. The other failures above are directly attributable to this PR and need resolution.

@apurvvkumaria apurvvkumaria left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This review supersedes my earlier review and narrows the requested changes to the items that must be resolved before this security backport is ready. It applies to exact head 36e8c5f014607add6dd9f81c06f8ca8fa918bf03.

Blocking security behavior

  1. Resolve the profile/state-directory remediation bypass. The wrapper recognizes only positional plugins install and always scans $HOME/.openclaw. OpenClaw global --profile/--dev options and OPENCLAW_STATE_DIR can therefore bypass remediation or make it scan a different state directory from the one that received the plugin. Normalize the supported global options, use the effective OpenClaw state directory, and add focused wrapper tests for prefix/suffix --profile, --dev, and custom OPENCLAW_STATE_DIR.

  2. Make runtime plugin remediation fail closed. After the original install succeeds, a staging, swap, metadata, or verification failure can leave the newly installed vulnerable plugin present. The minimum acceptable behavior is to remove the failed fresh installation or restore the prior plugin state before returning failure. Full transactional recovery for the Docker image overlay is not required because a failed image build is discarded and cannot be published.

Required pre-merge gates

  1. Add the canonical production build-argument guard. test/openclaw-dependency-review.test.ts:469 correctly rejects the new production workflow because its BASE_IMAGE and EXPECTED_OPENCLAW_VERSION build arguments are not covered by the repository guard.

  2. Clear the reviewed dependency audit with bounded evidence. The audit is examining intentionally vulnerable, exact-SRI historical source archives; its failure does not by itself prove the final revised image is vulnerable. A narrowly scoped exception tied to the exact reviewed inputs is acceptable if the workflow also verifies the post-remediation installed graph and fails when high/critical vulnerable versions remain. The required aggregate CI check must be green before merge.

Explicitly non-blocking / fix-forward

A new follow-up issue, #7288, has been created to track these non-blocking fix-forward items and is linked to the main issue, #7272.

  • Full rollback support for the Docker build-time tar overlay.
  • The same-user CodeQL filesystem race, absent evidence of a privilege-boundary crossing.
  • plugins install --help side effects.
  • Broader fault-injection and wrapper integration coverage beyond the focused blocker regressions above.
  • The unrelated gateway-recovery.test.ts timeout.

I withdraw the earlier DCO objection. NemoClaw requires a valid PR-body Signed-off-by declaration and GitHub-Verified commits; this PR has the declaration, all eight commits are Verified, and the required DCO check passes.

@apurvvkumaria
apurvvkumaria dismissed their stale review July 21, 2026 04:16

Superseded by corrected review #7276 (review). The earlier review overstated the blocker set and incorrectly treated per-commit Signed-off-by trailers as required.

@apurvvkumaria

apurvvkumaria commented Jul 21, 2026

Copy link
Copy Markdown
Collaborator

Update: #7289 has been retargeted to validate only the current-image remediation from #7286. It no longer exercises or depends on this PR's historical runtime wrapper, and #7276 is not a merge dependency for #7289.

ericksoa added 2 commits July 20, 2026 22:51
Signed-off-by: Aaron Erickson <aerickson@nvidia.com>
Signed-off-by: Aaron Erickson <aerickson@nvidia.com>
Signed-off-by: Aaron Erickson <aerickson@nvidia.com>

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

ericksoa added 2 commits July 22, 2026 04:12
Signed-off-by: Aaron Erickson <aerickson@nvidia.com>
Signed-off-by: Aaron Erickson <aerickson@nvidia.com>

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

writeJson(packageJsonPath, packageJson);
}

function patchOtelSdkNodePackageGraph(packageDirectory: string): void {
writeJson(packageJsonPath, packageJson);
}

function patchOtelSdkNodePackageGraph(packageDirectory: string): void {
Signed-off-by: Aaron Erickson <aerickson@nvidia.com>

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Signed-off-by: Aaron Erickson <aerickson@nvidia.com>

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@miyoungc miyoungc mentioned this pull request Jul 24, 2026
26 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: security Security controls, permissions, secrets, or hardening

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants