Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 23 additions & 2 deletions .github/actions/build-base-image-platform/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,14 @@ inputs:
description: Optional OpenClaw version build argument.
required: false
default: ""
mcporter-audit-receipt:
description: Optional same-run reviewed mcporter audit receipt path.
required: false
default: ""
mcporter-audit-raw-report:
description: Optional same-run reviewed mcporter raw audit report path.
required: false
default: ""

runs:
using: composite
Expand All @@ -64,6 +72,8 @@ runs:
env:
AGENT: ${{ inputs.agent }}
OPENCLAW_VERSION_INPUT: ${{ inputs.openclaw-version }}
MCPORTER_AUDIT_RECEIPT: ${{ inputs.mcporter-audit-receipt }}
MCPORTER_AUDIT_RAW_REPORT: ${{ inputs.mcporter-audit-raw-report }}
run: |
set -euo pipefail
build_args=()
Expand All @@ -87,7 +97,13 @@ runs:
exit 1
fi
fi
printf 'openclaw_build_arg=%s\n' "$openclaw_build_arg" >> "$GITHUB_OUTPUT"
audit_build_args=""
if [ "$AGENT" = "openclaw" ]; then
test -f "$MCPORTER_AUDIT_RECEIPT"
test -f "$MCPORTER_AUDIT_RAW_REPORT"
audit_build_args="NEMOCLAW_MCPORTER_AUDIT_RECEIPT_SHA256=$(sha256sum "$MCPORTER_AUDIT_RECEIPT" | cut -d' ' -f1)"$'\n'"NEMOCLAW_MCPORTER_AUDIT_RAW_REPORT_SHA256=$(sha256sum "$MCPORTER_AUDIT_RAW_REPORT" | cut -d' ' -f1)"
fi
printf 'openclaw_build_arg=%s\naudit_build_args<<EOF\n%s\nEOF\n' "$openclaw_build_arg" "$audit_build_args" >> "$GITHUB_OUTPUT"

- name: Build and push platform digest
id: build
Expand All @@ -102,7 +118,12 @@ runs:
outputs: type=image,name=${{ inputs.registry }}/${{ inputs.image }},push-by-digest=true,name-canonical=true,push=true
cache-from: type=registry,ref=${{ inputs.registry }}/${{ inputs.image }}:buildcache-${{ inputs.arch }}
cache-to: type=registry,ref=${{ inputs.registry }}/${{ inputs.image }}:buildcache-${{ inputs.arch }},mode=max
build-args: ${{ steps.production-build-args.outputs.openclaw_build_arg }}
build-args: |
${{ steps.production-build-args.outputs.openclaw_build_arg }}
${{ steps.production-build-args.outputs.audit_build_args }}
secret-files: |
${{ inputs.agent == 'openclaw' && format('nemoclaw-mcporter-audit-receipt={0}', inputs.mcporter-audit-receipt) || '' }}
${{ inputs.agent == 'openclaw' && format('nemoclaw-mcporter-audit-raw-report={0}', inputs.mcporter-audit-raw-report) || '' }}

- name: Validate Deep Agents Code dos2unix executable
if: ${{ inputs.agent == 'langchain-deepagents-code' }}
Expand Down
64 changes: 62 additions & 2 deletions .github/actions/ci-reviewed-npm-audit/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,13 @@ inputs:
report-dir:
description: Report directory relative to target-root.
required: true
cache-directory:
description: Absolute directory used for identity-bound reviewed npm audit records.
required: true
trusted-cache-write:
description: Whether this trusted caller may publish reusable audit records.
required: false
default: "false"

runs:
using: composite
Expand All @@ -20,22 +27,75 @@ runs:
with:
node-version: "22.23.2"

- name: Resolve reviewed npm audit cache buckets
id: cache-buckets
shell: bash
run: |
set -euo pipefail
current_bucket="$(( $(date -u +%s) / 43200 ))"
previous_bucket="$(( current_bucket - 1 ))"
input_digest="$(node --input-type=module - '${{ inputs.target-root }}' "$GITHUB_ACTION_PATH/../../../ci/reviewed-npm-audit.json" <<'NODE'
import { createHash } from "node:crypto";
import { readFileSync } from "node:fs";
import { join } from "node:path";
const [targetRoot, configFile] = process.argv.slice(2);
const configSource = readFileSync(configFile, "utf8");
const config = JSON.parse(configSource);
const directories = ["", ...config.lockedGraphs.map((graph) => graph.directory)].sort();
const hash = createHash("sha256");
hash.update(configSource);
hash.update(JSON.stringify({ argv: ["audit", "--omit=dev", "--json"], npmVersion: "10.9.4", registry: "https://registry.npmjs.org/", schemaVersion: 1 }));
for (const directory of directories) {
for (const file of ["package.json", "package-lock.json"]) {
const relative = join(directory, file);
hash.update(relative);
hash.update(readFileSync(join(targetRoot, relative)));
}
}
process.stdout.write(hash.digest("hex"));
NODE
)"
printf 'current=%s\nprevious=%s\ninput-digest=%s\n' "$current_bucket" "$previous_bucket" "$input_digest" >> "$GITHUB_OUTPUT"
mkdir -p "${{ inputs.cache-directory }}"

- name: Restore current reviewed npm audit cache bucket
id: cache-current
uses: actions/cache/restore@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4
with:
path: ${{ inputs.cache-directory }}
key: reviewed-npm-audit-v1-${{ runner.os }}-${{ steps.cache-buckets.outputs.input-digest }}-${{ steps.cache-buckets.outputs.current }}

- name: Restore previous reviewed npm audit cache bucket
if: steps.cache-current.outputs.cache-hit != 'true'
uses: actions/cache/restore@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4
with:
path: ${{ inputs.cache-directory }}
key: reviewed-npm-audit-v1-${{ runner.os }}-${{ steps.cache-buckets.outputs.input-digest }}-${{ steps.cache-buckets.outputs.previous }}

- name: Download and verify production npm
shell: bash
env:
NEMOCLAW_REVIEWED_NPM_VERSION: "10.9.4"
NEMOCLAW_REVIEWED_NPM_INTEGRITY: >-
sha512-OnUG836FwboQIbqtefDNlyR0gTHzIfwRfE3DuiNewBvnMnWEpB0VEXwBlFVgqpNzIgYo/MHh3d2Hel/pszapAA==
run: '"$GITHUB_ACTION_PATH/verify-and-install-npm.sh"'
run: env -u NODE_AUTH_TOKEN -u NPM_TOKEN -u NPM_CONFIG__AUTH_TOKEN "$GITHUB_ACTION_PATH/verify-and-install-npm.sh"

- name: Materialize and audit reviewed npm graphs
shell: bash
env:
NEMOCLAW_REVIEWED_NPM_AUDIT_TARGET_ROOT: ${{ inputs.target-root }}
NEMOCLAW_REVIEWED_NPM_AUDIT_REPORT_DIR: ${{ inputs.report-dir }}
NEMOCLAW_REVIEWED_NPM_AUDIT_CACHE_DIR: ${{ inputs.cache-directory }}
NPM_CONFIG_REGISTRY: https://registry.npmjs.org/
NPM_CONFIG_USERCONFIG: /dev/null
run: node --experimental-strip-types "$GITHUB_ACTION_PATH/../../../scripts/audit-reviewed-npm-graph.mts"
run: env -u NODE_AUTH_TOKEN -u NPM_TOKEN -u NPM_CONFIG__AUTH_TOKEN node --experimental-strip-types "$GITHUB_ACTION_PATH/../../../scripts/audit-reviewed-npm-graph.mts"

- name: Save current reviewed npm audit cache bucket
if: inputs.trusted-cache-write == 'true' && steps.cache-current.outputs.cache-hit != 'true'
uses: actions/cache/save@0400d5f644dc74513175e3cd8d07132dd4860809 # v4.2.4
with:
path: ${{ inputs.cache-directory }}
key: reviewed-npm-audit-v1-${{ runner.os }}-${{ steps.cache-buckets.outputs.input-digest }}-${{ steps.cache-buckets.outputs.current }}

- name: Upload reviewed npm audit reports
if: always()
Expand Down
9 changes: 9 additions & 0 deletions .github/workflows/base-image-platform.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,13 @@ jobs:
with:
persist-credentials: false

- name: Download same-run reviewed npm audit evidence
if: inputs.agent == 'openclaw'
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: reviewed-npm-audit
path: ${{ runner.temp }}/reviewed-npm-audit

- name: Build and publish platform digest
id: platform
uses: ./.github/actions/build-base-image-platform
Expand All @@ -77,3 +84,5 @@ jobs:
registry-username: ${{ github.actor }}
registry-password: ${{ secrets.registry_password }}
openclaw-version: ${{ inputs.openclaw-version }}
mcporter-audit-receipt: ${{ inputs.agent == 'openclaw' && format('{0}/reviewed-npm-audit/mcporter-runtime.receipt.json', runner.temp) || '' }}
mcporter-audit-raw-report: ${{ inputs.agent == 'openclaw' && format('{0}/reviewed-npm-audit/mcporter-runtime.raw.json', runner.temp) || '' }}
2 changes: 2 additions & 0 deletions .github/workflows/base-image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,8 @@ jobs:
with:
target-root: ${{ github.workspace }}
report-dir: artifacts/reviewed-npm-audit
cache-directory: ${{ runner.temp }}/reviewed-npm-audit-cache
trusted-cache-write: ${{ github.repository == 'NVIDIA/NemoClaw' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch') }}

# A failed-job rerun can reuse either successful platform job from an earlier
# attempt. Keep each digest on a distinct job output so completion order cannot
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ jobs:
scripts/lib/openclaw-npm-remediation.mts
scripts/lib/reviewed-npm-archive.mts
scripts/lib/reviewed-npm-audit.mts
scripts/lib/npm-audit-receipt.mts
sparse-checkout-cone-mode: false

- name: Set up Node for reviewed package download
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,8 @@ jobs:
with:
target-root: ${{ github.workspace }}
report-dir: artifacts/reviewed-npm-audit
cache-directory: ${{ runner.temp }}/reviewed-npm-audit-cache
trusted-cache-write: "true"

real-openclaw-dist-harness:
runs-on: ubuntu-latest
Expand Down
35 changes: 35 additions & 0 deletions .github/workflows/managed-images.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ jobs:
ci/npm-audit-exceptions.json
ci/reviewed-npm-audit.json
scripts/audit-reviewed-npm-graph.mts
scripts/lib/npm-audit-receipt.mts
scripts/lib/openclaw-npm-remediation.mts
scripts/lib/reviewed-npm-archive.mts
scripts/lib/reviewed-npm-audit.mts
Expand All @@ -121,6 +122,7 @@ jobs:
with:
target-root: ${{ github.workspace }}/candidate
report-dir: artifacts/reviewed-npm-audit
cache-directory: ${{ runner.temp }}/reviewed-npm-audit-cache

pr-staging-qa-deep-code:
name: Staging QA base permission regression (Deep Agents Code)
Expand Down Expand Up @@ -459,6 +461,24 @@ jobs:
chmod 0664 "$artifact_path"
done

- name: Download same-run reviewed npm audit evidence
if: matrix.agent == 'openclaw'
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: reviewed-npm-audit
path: ${{ runner.temp }}/reviewed-npm-audit

- name: Prepare same-run mcporter audit evidence
if: matrix.agent == 'openclaw'
id: mcporter-audit
shell: bash
run: |
set -euo pipefail
receipt="$RUNNER_TEMP/reviewed-npm-audit/mcporter-runtime.receipt.json"
raw="$RUNNER_TEMP/reviewed-npm-audit/mcporter-runtime.raw.json"
test -f "$receipt"; test -f "$raw"
printf 'receipt=%s\nraw=%s\nreceipt_sha256=%s\nraw_sha256=%s\n' "$receipt" "$raw" "$(sha256sum "$receipt" | cut -d' ' -f1)" "$(sha256sum "$raw" | cut -d' ' -f1)" >> "$GITHUB_OUTPUT"

- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@bb05f3f5519dd87d3ba754cc423b652a5edd6d2c # v4.2.0
Expand Down Expand Up @@ -571,6 +591,11 @@ jobs:
BASE_IMAGE=${{ steps.base.outputs.ref }}
NEMOCLAW_MANAGED_IMAGE_CAPABILITY_UNION=1
NEMOCLAW_MANAGED_IMAGE_RUNTIME_USER=root
${{ matrix.agent == 'openclaw' && format('NEMOCLAW_MCPORTER_AUDIT_RECEIPT_SHA256={0}', steps.mcporter-audit.outputs.receipt_sha256) || '' }}
${{ matrix.agent == 'openclaw' && format('NEMOCLAW_MCPORTER_AUDIT_RAW_REPORT_SHA256={0}', steps.mcporter-audit.outputs.raw_sha256) || '' }}
secret-files: |
${{ matrix.agent == 'openclaw' && format('nemoclaw-mcporter-audit-receipt={0}', steps.mcporter-audit.outputs.receipt) || '' }}
${{ matrix.agent == 'openclaw' && format('nemoclaw-mcporter-audit-raw-report={0}', steps.mcporter-audit.outputs.raw) || '' }}
cache-from: type=registry,ref=ghcr.io/nvidia/nemoclaw/${{ matrix.agent }}-sandbox:buildcache-linux-amd64
provenance: false
sbom: false
Expand Down Expand Up @@ -783,6 +808,11 @@ jobs:
BASE_IMAGE=${{ steps.base.outputs.local == 'true' && 'nemoclaw-pr-base' || steps.base.outputs.ref }}
NEMOCLAW_MANAGED_IMAGE_CAPABILITY_UNION=1
NEMOCLAW_MANAGED_IMAGE_RUNTIME_USER=root
${{ matrix.agent == 'openclaw' && format('NEMOCLAW_MCPORTER_AUDIT_RECEIPT_SHA256={0}', steps.mcporter-audit.outputs.receipt_sha256) || '' }}
${{ matrix.agent == 'openclaw' && format('NEMOCLAW_MCPORTER_AUDIT_RAW_REPORT_SHA256={0}', steps.mcporter-audit.outputs.raw_sha256) || '' }}
secret-files: |
${{ matrix.agent == 'openclaw' && format('nemoclaw-mcporter-audit-receipt={0}', steps.mcporter-audit.outputs.receipt) || '' }}
${{ matrix.agent == 'openclaw' && format('nemoclaw-mcporter-audit-raw-report={0}', steps.mcporter-audit.outputs.raw) || '' }}
cache-from: type=registry,ref=ghcr.io/nvidia/nemoclaw/${{ matrix.agent }}-sandbox:buildcache-linux-amd64
provenance: false
sbom: false
Expand Down Expand Up @@ -1804,6 +1834,11 @@ jobs:
TARGETARCH=${{ matrix.arch }}
NEMOCLAW_MANAGED_IMAGE_CAPABILITY_UNION=1
NEMOCLAW_MANAGED_IMAGE_RUNTIME_USER=root
${{ matrix.agent == 'openclaw' && format('NEMOCLAW_MCPORTER_AUDIT_RECEIPT_SHA256={0}', steps.mcporter-audit.outputs.receipt_sha256) || '' }}
${{ matrix.agent == 'openclaw' && format('NEMOCLAW_MCPORTER_AUDIT_RAW_REPORT_SHA256={0}', steps.mcporter-audit.outputs.raw_sha256) || '' }}
secret-files: |
${{ matrix.agent == 'openclaw' && format('nemoclaw-mcporter-audit-receipt={0}', steps.mcporter-audit.outputs.receipt) || '' }}
${{ matrix.agent == 'openclaw' && format('nemoclaw-mcporter-audit-raw-report={0}', steps.mcporter-audit.outputs.raw) || '' }}
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved
cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ matrix.image }}:buildcache-${{ matrix.artifact_platform }}
cache-to: type=registry,ref=${{ env.REGISTRY }}/${{ matrix.image }}:buildcache-${{ matrix.artifact_platform }},mode=max
provenance: mode=max
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/openshell-sdk-package-pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ jobs:
scripts/lib/openclaw-npm-remediation.mts
scripts/lib/reviewed-npm-archive.mts
scripts/lib/reviewed-npm-audit.mts
scripts/lib/npm-audit-receipt.mts
sparse-checkout-cone-mode: false

- name: Setup Node.js for reviewed package download
Expand Down
10 changes: 10 additions & 0 deletions .github/workflows/pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ jobs:
scripts/lib/openclaw-npm-remediation.mts
scripts/lib/reviewed-npm-archive.mts
scripts/lib/reviewed-npm-audit.mts
scripts/lib/npm-audit-receipt.mts
sparse-checkout-cone-mode: false

- name: Download verified OpenShell SDK archive
Expand Down Expand Up @@ -200,6 +201,7 @@ jobs:
scripts/lib/openclaw-npm-remediation.mts
scripts/lib/reviewed-npm-archive.mts
scripts/lib/reviewed-npm-audit.mts
scripts/lib/npm-audit-receipt.mts
sparse-checkout-cone-mode: false

- name: Locate exact base-controlled SDK package run
Expand Down Expand Up @@ -385,6 +387,7 @@ jobs:
scripts/lib/openclaw-npm-remediation.mts
scripts/lib/reviewed-npm-archive.mts
scripts/lib/reviewed-npm-audit.mts
scripts/lib/npm-audit-receipt.mts
sparse-checkout-cone-mode: false

- name: Download verified OpenShell SDK archive
Expand Down Expand Up @@ -444,6 +447,7 @@ jobs:
scripts/lib/openclaw-npm-remediation.mts
scripts/lib/reviewed-npm-archive.mts
scripts/lib/reviewed-npm-audit.mts
scripts/lib/npm-audit-receipt.mts
sparse-checkout-cone-mode: false

- name: Download verified OpenShell SDK archive
Expand Down Expand Up @@ -502,6 +506,7 @@ jobs:
scripts/lib/openclaw-npm-remediation.mts
scripts/lib/reviewed-npm-archive.mts
scripts/lib/reviewed-npm-audit.mts
scripts/lib/npm-audit-receipt.mts
sparse-checkout-cone-mode: false

- name: Download verified OpenShell SDK archive
Expand Down Expand Up @@ -539,13 +544,15 @@ jobs:
scripts/lib/openclaw-npm-remediation.mts
scripts/lib/reviewed-npm-archive.mts
scripts/lib/reviewed-npm-audit.mts
scripts/lib/npm-audit-receipt.mts
sparse-checkout-cone-mode: false

- name: Audit reviewed production npm graphs
uses: ./.trusted-reviewed-npm-audit/.github/actions/ci-reviewed-npm-audit
with:
target-root: ${{ github.workspace }}
report-dir: artifacts/reviewed-npm-audit
cache-directory: ${{ runner.temp }}/reviewed-npm-audit-cache

cli-test-shards:
needs: [changes, compile-artifacts, openshell-sdk-package]
Expand Down Expand Up @@ -589,6 +596,7 @@ jobs:
scripts/lib/openclaw-npm-remediation.mts
scripts/lib/reviewed-npm-archive.mts
scripts/lib/reviewed-npm-audit.mts
scripts/lib/npm-audit-receipt.mts
sparse-checkout-cone-mode: false

- name: Download verified OpenShell SDK archive
Expand Down Expand Up @@ -715,6 +723,7 @@ jobs:
scripts/lib/openclaw-npm-remediation.mts
scripts/lib/reviewed-npm-archive.mts
scripts/lib/reviewed-npm-audit.mts
scripts/lib/npm-audit-receipt.mts
sparse-checkout-cone-mode: false

- name: Download verified OpenShell SDK archive
Expand Down Expand Up @@ -765,6 +774,7 @@ jobs:
scripts/lib/openclaw-npm-remediation.mts
scripts/lib/reviewed-npm-archive.mts
scripts/lib/reviewed-npm-audit.mts
scripts/lib/npm-audit-receipt.mts
sparse-checkout-cone-mode: false

- name: Download verified OpenShell SDK archive
Expand Down
Loading
Loading