Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
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
22 changes: 19 additions & 3 deletions .github/workflows/podman-cpu-proof.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,15 @@ on:
- "src/lib/onboard/docker-driver-gateway-*.ts"
- "src/lib/onboard/managed-bootstrap/podman-*.ts"
- "src/lib/onboard/experimental/portable-demo-lifecycle.ts"
- "src/lib/onboard/experimental/portable-runtime-*.ts"
- "src/lib/onboard/portable-retirement-authority.ts"
- "src/lib/onboard.ts"
- "src/lib/actions/uninstall/portable-runtime-cleanup.ts"
- "src/lib/actions/uninstall/all-gateway-ports.ts"
- "src/lib/actions/uninstall/run-plan.ts"
- "src/commands/internal/uninstall/run-plan.ts"
- "src/lib/state/portable-uninstall-retirement.ts"
- "src/lib/state/registry/lock.ts"
- "src/lib/onboard/runtime-provider/container-state-mutation.ts"
- "src/lib/onboard/runtime-provider/docker-state-mutation.ts"
- "src/lib/onboard/runtime-provider/podman*.ts"
Expand All @@ -23,6 +32,7 @@ on:
- "test/e2e/live/podman-cpu-lifecycle-helpers.ts"
- "test/e2e/live/podman-cpu-lifecycle-policy.yaml"
- "test/e2e/live/podman-cpu-lifecycle.test.ts"
- "test/e2e/live/podman-portable-uninstall.test.ts"
- "test/e2e/registry/native-runtime-qualification.ts"
- "test/e2e/support/native-runtime-qualification.test.ts"
- "src/lib/onboard/experimental/portable-demo-lifecycle.test.ts"
Expand Down Expand Up @@ -65,8 +75,11 @@ jobs:
- name: Install locked test dependencies
run: npm ci --ignore-scripts

- name: Build shared sandbox-name contract
run: npm run build:policy-boundary
- name: Build and link candidate CLI
run: |
npm run build:cli
npm link --ignore-scripts
nemoclaw --version

- name: Install pinned OpenShell runtime
shell: bash
Expand Down Expand Up @@ -257,7 +270,10 @@ jobs:
} >>"$GITHUB_ENV"

- name: Prove pinned OpenShell activation and registered-agent Podman CPU lifecycle
run: npx vitest run --project e2e-live test/e2e/live/podman-cpu-lifecycle.test.ts
run: |
npx vitest run --project e2e-live \
test/e2e/live/podman-cpu-lifecycle.test.ts \
test/e2e/live/podman-portable-uninstall.test.ts

- name: Verify Docker stayed unavailable
if: always()
Expand Down
22 changes: 22 additions & 0 deletions SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,28 @@ Subscribe to notifications on that page to receive alerts when new bulletins are

Component-level threat models for security-critical NemoClaw subsystems are documented here so a reviewer or auditor can understand what each subsystem is designed to prevent, which surfaces it protects, and where its guarantees end.

### Portable Uninstall Retirement Record (`#9189`)

**Summary.** Portable uninstall retains `~/.nemoclaw/portable-uninstall-retirement.json` after `--destroy-user-data`.
The current user owns its mode-`0700` parent and the mode-`0600` record.
A later completed onboarding removes the record only after its new authority is durable.

**Threat.** A host crash can interrupt receipt, sandbox registry, or portable configuration removal.
Without a durable discriminator, a retry can enter generic Docker, OpenShell, or model cleanup and remove resources outside the portable receipts.

**Guarantee.** The record keeps every retry on receipt-owned portable cleanup.
It contains a random cleanup ID, receipt basenames derived from SHA-256 hashes of sandbox names, safe relative target identities, and length-framed transaction-scoped SHA-256 content fingerprints.
The fingerprints are dictionary-testable pseudonymous local data.
The record contains no raw sandbox or gateway names, absolute paths, environment values, configuration bytes, credentials, or secrets.
NemoClaw holds one process-bound host fence across every cooperative onboarding, rebuild, and uninstall writer while it publishes or supersedes the record.

**Where the guarantee ends.** NemoClaw state owned by the same operating-system user is not a trust boundary against a malicious process running as that user.
Such a process can change the state before or after a checked filesystem operation.
NemoClaw detects mismatched file identities and fingerprints and exits without restoring or removing the ambiguous generation.
This control covers cooperating NemoClaw processes, crashes, retries, and recycled process IDs.

**Enforced by:** `src/lib/state/portable-uninstall-retirement.test.ts`, `src/lib/actions/uninstall/portable-runtime-cleanup.test.ts`, `src/lib/onboard/portable-resume-lock-boundary.test.ts`, and `src/lib/state/registry-lock.test.ts` cover crash boundaries, async ownership, lock generations, record contents, and completed-onboarding supersession.

### Ollama Auth Proxy Loopback Bind Probe (`#6014`)

**Summary.** The Ollama auth proxy is the token-authenticated network gate in front of a locally-running Ollama backend on every topology where `shouldFrontOllamaWithProxy()` returns true (native Linux, macOS, WSL with a native dockerd runtime). Ollama itself has no built-in authentication. The proxy adds a bearer-token check on its own listen port and forwards to Ollama on the backend port.
Expand Down
12 changes: 6 additions & 6 deletions ci/source-architecture-budget.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"src/lib/onboard/gateway-binding.ts": 52,
"src/lib/runner.ts": 87,
"src/lib/security/redact.ts": 52,
"src/lib/state/onboard-session.ts": 36,
"src/lib/state/onboard-session.ts": 37,
"src/lib/state/registry.ts": 101,
"src/lib/state/state-root.ts": 21,
"src/lib/subprocess-env.ts": 24,
Expand All @@ -43,23 +43,23 @@
"src/lib/actions/sandbox/status-snapshot.ts": 20,
"src/lib/actions/sandbox/policy-channel.ts": 30,
"src/lib/actions/sandbox/process-recovery.ts": 21,
"src/lib/actions/sandbox/rebuild-pipeline.ts": 28,
"src/lib/actions/sandbox/rebuild-pipeline.ts": 29,
"src/lib/actions/sandbox/snapshot.ts": 40,
"src/lib/actions/uninstall/run-plan.ts": 26,
"src/lib/actions/uninstall/run-plan.ts": 25,
"src/lib/inference/onboard-probes.ts": 21,
"src/lib/inference/vllm.ts": 21,
"src/lib/onboard.ts": 202,
"src/lib/onboard.ts": 203,
"src/lib/onboard/machine/handlers/sandbox.ts": 21,
"src/lib/sandbox/config.ts": 22,
"src/lib/shields/index.ts": 23
}
},
"allowedCycles": [],
"maxRootFiles": {
"src/lib/onboard": 307,
"src/lib/onboard": 308,
"src/lib/actions": 19,
"src/lib/actions/sandbox": 183,
"src/lib/state": 38,
"src/lib/state": 39,
"src/lib/inference": 63,
"scripts": 47
}
Expand Down
60 changes: 56 additions & 4 deletions docs/manage-sandboxes/uninstall-nemoclaw.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ Resolve the reported error, inspect the remaining models and runtimes, and rerun
Without `--delete-models`, uninstall preserves both model stores.
When sibling gateway environments remain, uninstall preserves both model stores even if you pass `--delete-models`.
An all-gateway-port sweep deletes them only after every selected gateway cleanup succeeds and no sibling environment remains.
For a full uninstall of the portable experimental profile, `--delete-models` preserves every Podman image.
The flag does not scan arbitrary directories or delete model caches on remote peers.

## Uninstall Every Gateway Port
Expand Down Expand Up @@ -91,12 +92,13 @@ $$nemoclaw uninstall --all-gateway-ports

When the sweep finds more than one port, it lists the ports, confirms once, then uninstalls each port in turn and the currently selected port last.
When it finds only the selected port, it uses the standard uninstall confirmation and runs that port once.
Running the selected port last lets that final pass remove the shared CLI, services, images, providers, configuration, models, and swap once no other environment needs them.
Outside portable cleanup, running the selected port last lets that final pass remove the shared CLI, services, images, providers, configuration, models, and swap once no other environment needs them.
`--delete-models`, `--destroy-user-data`, and `--keep-openshell` apply to every port in the sweep.
If the sweep cannot enumerate the gateway state roots safely, it exits before uninstalling any port.
The sweep cannot select an unidentified environment until its gateway port can be determined.
If one port fails to uninstall, the sweep reports that port, continues with the remaining ports, and exits nonzero.
The failed port still counts as a live environment, so the final pass keeps the shared host resources instead of removing state that the surviving environment needs.
For the portable experimental profile, this preservation includes the shared Podman resources, current-user selectors, `~/.config/nemoclaw/portable/containers.conf`, and lifecycle receipts.
The sweep does not roll back cleanup that completed before a failure.
Resolve the reported error, inspect the remaining gateways with `openshell gateway list`, and rerun the sweep or the reported per-port command.
Default-port uninstall removes NemoClaw-managed entries in `openshell/gateway.env`.
Expand Down Expand Up @@ -140,7 +142,57 @@ Fresh state roots and already scoped configurations continue to use the state-ro
The legacy `default` namespace is not isolated across gateways, so it cannot satisfy the scoped-uninstall proof while sibling gateways remain.
Scoped uninstall stops before it deletes a sandbox, registry row, or gateway registration and preserves the selected gateway's runtime evidence and local state.
Because the supported OpenShell Podman schema does not expose `sandbox_namespace`, scoped Podman uninstall fails closed before signaling and preserves the gateway runtime evidence and local state.
Full single-gateway Podman uninstall continues to use normal graceful teardown.
A full uninstall for the portable experimental profile detects ownership only from durable lifecycle state.
It records the initial lifecycle receipts and sandbox registry state for comparison.
NemoClaw first acquires the process-bound portable host lock at `~/.nemoclaw-portable-host.lock`.
This host-wide fence coordinates portable onboarding, rebuild, and uninstall.
It then acquires every receipt lifecycle lock in sorted order before it acquires the process-bound sandbox registry lock.
Portable lock acquisition fails before cleanup unless NemoClaw can establish the current Linux process's exact boot identity and process start tick.
A live lock owner with that exact identity is never displaced because of the lock's age.
A contender waits only for the bounded acquisition interval and exits nonzero if the lock remains held.
With every lock held, NemoClaw verifies that the recorded receipts and registry state have not changed.
This one-to-one ownership check applies only to NemoClaw's host `sandboxes.json`.
Each receipt must have one current matching row in that file, and the file must contain no extra sandbox row.
Missing, mismatched, or extra rows make NemoClaw exit nonzero before it changes a container or host state.
An unrelated row, including a non-portable row, makes ownership ambiguous and triggers this fail-closed result before any effect, even with `--destroy-user-data`.
An unrelated sandbox registered only with OpenShell is outside that host registry and remains usable.
NemoClaw holds those same sorted lifecycle locks and the process-bound registry lock throughout exact Podman container removal, exact-name OpenShell sandbox deletion, portable registry removal, selector cleanup, and the final retirement operation for the receipts, sandbox registry rows, and `~/.config/nemoclaw/portable/containers.conf`.
Before it retires `~/.config/nemoclaw/portable/containers.conf` or lifecycle receipts, NemoClaw revalidates the current user's local Podman socket authority and lifecycle generation.
It also revalidates the exact receipt-owned sandbox containers, their expected OpenShell labels and current running state, and the managed portable registry container.
NemoClaw uses the pinned local Podman socket to remove only the exact receipt-owned sandbox containers.
Before every exact receipt-name OpenShell sandbox deletion, NemoClaw runs `openshell status -g <gateway>` to prove that the gateway name recorded by the matching registry row is connected.
It then runs `openshell sandbox delete -g <gateway> <sandbox>` for that exact gateway and sandbox name.
After deletion, bounded `openshell sandbox get -g <gateway> <sandbox>` probes must verify that the exact sandbox is absent.
It never relies on or switches the globally selected gateway, and it never falls back to implicit deletion.
A same-name sandbox on another gateway remains untouched.
It never uses `openshell sandbox delete --all` during portable OpenShell cleanup.
If explicit deletion reports an exact receipt sandbox as absent, cleanup continues only because the gateway-scoped status probe proved that exact gateway is connected and reachable.
A missing gateway, missing provider, transport failure, verification timeout, generic or ambiguous `NotFound` result, or absence that the status probe cannot prove is fatal.
Uninstall exits nonzero and preserves the portable registry row and container, selectors, receipts, `~/.config/nemoclaw/portable/containers.conf`, gateway state, shared OpenShell provider and gateway registrations, and unrelated OpenShell-only sandboxes.
Portable cleanup preserves shared OpenShell provider and gateway registrations, the gateway service and process, and shared OpenShell binaries and configuration.
It also preserves unrelated OpenShell-registered sandboxes.
Before it removes the portable registry container or selectors, NemoClaw verifies that the original lifecycle receipts and sandbox registry state have not changed.
If either changed, uninstall exits nonzero before later gateway-state or `~/.config/nemoclaw/portable/containers.conf` deletion.
After that verification, NemoClaw removes the prevalidated portable registry container by its exact ID.
It unsets a current-user systemd manager selector only when its current value matches NemoClaw's recorded or derived portable projection.
This check covers `CONTAINERS_CONF`, `NETAVARK_FW`, `CONTAINER_HOST`, `CONTAINER_CONNECTION`, and `CONTAINER_SSHKEY`.
NemoClaw preserves unrelated or changed selector values.
It skips the generic Docker availability probe and all generic Docker container, image, and volume cleanup.
It does not remove the user's Podman installation, storage, networks, or unrelated containers.
It does not disable a user-managed socket.
On every successful portable cleanup, the final retirement operation removes the exact portable lifecycle receipts, their matching `sandboxes.json` rows, and `~/.config/nemoclaw/portable/containers.conf`, regardless of `--destroy-user-data`.
Other preserved user data follows the normal `--destroy-user-data` behavior.
After NemoClaw releases the locks, later uninstall-plan cleanup never recursively revisits the canonical receipt, sandbox registry, or `~/.config/nemoclaw/portable/containers.conf` paths.
This preserves any new lifecycle generation published after lock release.
After successful portable cleanup with `--destroy-user-data`, the sole residual regular file under `~/.nemoclaw/` is `~/.nemoclaw/portable-uninstall-retirement.json`, written at mode `0600` under a current-UID-owned, mode-`0700` `~/.nemoclaw/` directory.
Another same-user process can change the record, so this protection assumes cooperative NemoClaw writers under that UID.
NemoClaw retains the record until a later completed onboarding durably supersedes it.
It contains a random local cleanup ID, receipt basenames derived from SHA-256 hashes of sandbox names, and length-framed, transaction-scoped, dictionary-testable pseudonymous fingerprints, but no raw sandbox or gateway names, absolute paths, environment values, configuration bytes, or secrets.
A repeat invocation remains on portable cleanup and performs no Docker probe or mutation, implicit OpenShell cleanup, or model cleanup.
If NemoClaw cannot prove the required portable authority or complete a cleanup step, uninstall exits nonzero.
It preserves any existing durable retirement record and any remaining receipts, `~/.config/nemoclaw/portable/containers.conf`, gateway state, and other retry evidence, even with `--destroy-user-data`.
Resolve the reported authority or cleanup error, keep the preserved state intact, and rerun the same full uninstall command.
This cleanup does not change Docker uninstall, externally supervised gateways, `--keep-openshell`, scoped sibling-gateway cleanup, or non-portable profiles.
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved
For Docker, if any proof is absent, uninstall exits nonzero before it signals the host gateway.
NemoClaw preserves the gateway runtime evidence and local state.
Keep that state intact.
Expand All @@ -164,7 +216,7 @@ Do not add `sandbox_namespace` manually to a live gateway configuration because
In this section, `<selected-state-root>` is `~/.nemoclaw/` for the default gateway or `~/.nemoclaw/gateways/<port>/` for a non-default gateway.
For the default gateway, the uninstall command preserves `~/.nemoclaw/rebuild-backups/`, `~/.nemoclaw/backups/`, and `~/.nemoclaw/sandboxes.json` by default.
A non-default gateway uses the corresponding entries under `~/.nemoclaw/gateways/<port>/`.
When uninstall confirms that no sibling gateways remain, it also removes the shared CLI, services, images, providers, configuration, models, and swap.
Outside portable cleanup, when uninstall confirms that no sibling gateways remain, it also removes the shared CLI, services, images, providers, configuration, models, and swap.
During full uninstall, a managed distributed-vLLM receipt makes NemoClaw first revalidate the recorded plan and every cluster node, GPU, container, and SSH peer identity.
It then removes only the exact receipt-owned containers.
The managed-cluster receipt is host-global under `~/.nemoclaw/`.
Expand Down Expand Up @@ -196,7 +248,7 @@ For non-interactive runs using `--yes`, `NEMOCLAW_NON_INTERACTIVE=1`, or a non-T

`--yes` stays non-destructive by design and never purges preserved user data on its own.
After a successful or already-absent sandbox deletion, preserving other `sandboxes.json` entries does not preserve the selected sandbox entry or its gateway registration.
After uninstall confirms that no sibling gateways remain, it also removes the provider registrations and Docker image that the recorded sandboxes depend on.
Outside portable cleanup, after uninstall confirms that no sibling gateways remain, it also removes the provider registrations and Docker image that the recorded sandboxes depend on.

Uninstall warns that those records cannot be recovered automatically on reinstall, and the remediation is `$$nemoclaw <name> destroy` followed by `$$nemoclaw onboard`.
</Note>
Expand Down
Loading
Loading