fix: stop forging NemoClaw registry receipts (#43)

Quick-deployed OpenShell clones no longer forge NemoClaw lifecycle, policy-authority, or workload receipts.
This commit is contained in:
mmckeen-nv
2026-08-28 23:08:01 -07:00
committed by GitHub
parent 1414d1ab0c
commit 7ec2969c7a
3 changed files with 14 additions and 45 deletions
+2
View File
@@ -221,6 +221,8 @@ The dashboard shells out to the OpenShell CLI for several operations:
- `openshell provider create/update/delete/list`
- `openshell inference set/get/update`
The **Quick Deploy New NemoClaw Sandbox** path clones a registered image through OpenShell, but it deliberately does not write the clone into NemoClaw's private `sandboxes.json`. Current NemoClaw entries include lifecycle identity, policy-authority, and workload receipts that must be issued by NemoClaw itself. The clone remains visible and operable through OpenShell Control; use **Fresh NemoClaw Image** when the new sandbox must participate in NemoClaw-managed lifecycle operations.
OpenClaw dashboard access is loopback-only inside the host/sandbox context, so the UI uses local proxy routes:
- `/api/openshell/dashboard/proxy`
+7 -42
View File
@@ -1,6 +1,6 @@
import { NextResponse } from "next/server"
import { execFile, spawn } from "node:child_process"
import { existsSync, mkdirSync, readFileSync, renameSync, writeFileSync } from "node:fs"
import { existsSync, readFileSync } from "node:fs"
import path from "node:path"
import { promisify } from "node:util"
import { inspectSandbox, resolveSandboxRef } from "@/app/lib/openshellHost"
@@ -342,47 +342,12 @@ async function resolveSourcePodImage(sourceSandboxRef: string | null | undefined
throw new Error("No running NemoClaw sandbox image was found for quick deploy. Create one Fresh NemoClaw Image first, or pass sourceSandboxName explicitly.")
}
function registerNemoClawImageRedeploy(sourceName: string, sandboxName: string) {
try {
const current = existsSync(NEMOCLAW_REGISTRY_FILE)
? JSON.parse(readFileSync(NEMOCLAW_REGISTRY_FILE, "utf8"))
: {}
const sandboxes = current && typeof current.sandboxes === "object" && current.sandboxes !== null
? current.sandboxes
: {}
const sourceEntry = sandboxes[sourceName] && typeof sandboxes[sourceName] === "object"
? sandboxes[sourceName]
: { name: sourceName }
sandboxes[sandboxName] = {
...sourceEntry,
name: sandboxName,
createdAt: new Date().toISOString(),
nimContainer: null,
policies: [],
imageTag: null,
}
const next = {
...current,
sandboxes,
defaultSandbox: current.defaultSandbox || sandboxName,
}
mkdirSync(path.dirname(NEMOCLAW_REGISTRY_FILE), { recursive: true })
const tempPath = `${NEMOCLAW_REGISTRY_FILE}.tmp.${process.pid}.${Date.now()}`
writeFileSync(tempPath, `${JSON.stringify(next, null, 2)}\n`, { mode: 0o600 })
renameSync(tempPath, NEMOCLAW_REGISTRY_FILE)
function skippedNemoClawImageRedeployRegistration() {
return {
ok: true as const,
registered: false as const,
skipped: true as const,
registryFile: NEMOCLAW_REGISTRY_FILE,
note: "Registered the image-redeployed sandbox in the local NemoClaw registry without assigning a host Docker image tag.",
}
} catch (error) {
return {
ok: false as const,
registryFile: NEMOCLAW_REGISTRY_FILE,
error: error instanceof Error ? error.message : "Failed to update the local NemoClaw registry",
}
note: "The quick-deployed sandbox remains an OpenShell-managed clone and was not written into NemoClaw's private registry. Current NemoClaw registry entries carry lifecycle, policy-authority, and workload receipts that only NemoClaw can issue safely.",
}
}
@@ -1062,7 +1027,7 @@ export async function POST(request: Request) {
error: "Sandbox readiness polling produced no verification result.",
}
const created = readiness.verified
const registry = created ? registerNemoClawImageRedeploy(source.name, sandboxName) : null
const registry = created ? skippedNemoClawImageRedeployRegistration() : null
const execApprovalsRepair = created ? await repairOpenClawExecApprovalsFile(sandboxName).catch((error) => ({
sandboxName,
path: "/sandbox/.openclaw/exec-approvals.json",
@@ -1128,7 +1093,7 @@ export async function POST(request: Request) {
createAttempt.timedOut
? "The OpenShell create command stayed attached after the sandbox reached Ready, so the dashboard stopped waiting for the local command."
: false,
registry && !registry.ok ? `NemoClaw registry update failed: ${registry.error}` : false,
registry?.note,
execApprovalsRepair && "note" in execApprovalsRepair ? execApprovalsRepair.note : false,
execApprovalsRepair && "error" in execApprovalsRepair ? `OpenClaw exec approvals repair failed: ${execApprovalsRepair.error}` : false,
deviceApproval?.note,
+3 -1
View File
@@ -109,7 +109,9 @@ assert.match(createRouteSource, /"--from",\s*sourceImage/, 'image redeploy must
assert.match(createRouteSource, /registryEntry\?\.imageTag\?\.trim\(\)/, 'image redeploy must resolve the source image from NemoClaw registry metadata')
assert.doesNotMatch(createRouteSource, /OPENSHELL_CLUSTER_CONTAINER|readPodImage|"kubectl"/, 'image redeploy must not depend on obsolete cluster containers or in-container kubectl')
assert.match(createRouteSource, /"--auto-providers"/, 'image redeploy must use OpenShell auto providers for provider-backed images')
assert.match(createRouteSource, /registerNemoClawImageRedeploy/, 'image redeploy must register the new sandbox without a full NemoClaw rebuild')
assert.match(createRouteSource, /skippedNemoClawImageRedeployRegistration/, 'image redeploy must report that NemoClaw registry registration was deliberately skipped')
assert.match(createRouteSource, /lifecycle, policy-authority, and workload receipts that only NemoClaw can issue safely/, 'image redeploy must explain why direct NemoClaw registry writes are unsafe')
assert.doesNotMatch(createRouteSource, /function registerNemoClawImageRedeploy|writeFileSync\(tempPath|renameSync\(tempPath/, 'image redeploy must not forge current NemoClaw registry entries by copying source-bound authority receipts')
assert.match(createRouteSource, /readyVerification\?: SandboxVerification/, 'ready-aware create command must carry the authoritative verification result')
assert.match(createRouteSource, /readyVerification: verification/, 'ready-aware create command must return the verification that proved readiness')
assert.match(createRouteSource, /createAttempt\.readyVerification\?\.verified[\s\S]*await waitForSandboxReady\(sandboxName, 90000, 2000\)/, 'image redeploy must reuse the ready-command verification instead of always polling readiness twice')