Repository navigation
fix(security): replace process.env spread with allowlist in blueprint runner #1874
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 5 commits
f6183ca
d3667d2
a87f5f4
be20f26
a5e9a7b
c4e4c99
1dc6109
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,32 +1,30 @@ | ||||||||||
| --- | ||||||||||
| name: "nemoclaw-user-workspace" | ||||||||||
| description: "Backs up and restores OpenClaw workspace files before destructive operations. Use when backing up a sandbox, restoring workspace state, or preparing for a destructive operation. Explains what workspace files are, where they live, and how they persist across sandbox restarts. Use when asking about soul.md, identity.md, memory.md, agents.md, or sandbox file persistence." | ||||||||||
| description: "Hows to back up and restore OpenClaw workspace files before destructive operations. Whats workspace personality and configuration files are, where they live, and how they persist across sandbox restarts." | ||||||||||
| --- | ||||||||||
|
|
||||||||||
| <!-- SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. --> | ||||||||||
| <!-- SPDX-License-Identifier: Apache-2.0 --> | ||||||||||
|
|
||||||||||
| # NemoClaw User Workspace | ||||||||||
|
|
||||||||||
| Backs up and restores OpenClaw workspace files before destructive operations. Use when backing up a sandbox, restoring workspace state, or preparing for a destructive operation. | ||||||||||
| How to back up and restore OpenClaw workspace files before destructive operations. | ||||||||||
|
|
||||||||||
| ## Context | ||||||||||
|
|
||||||||||
| OpenClaw stores agent identity, behavior, and memory in a set of Markdown files inside the sandbox. | ||||||||||
| These files live at `/sandbox/.openclaw/workspace/` and are read by the agent at the start of every session. | ||||||||||
| OpenClaw stores its personality, user context, and behavioral configuration in a set of Markdown files inside the sandbox. | ||||||||||
| These files live at `/sandbox/.openclaw/workspace/` and are collectively called **workspace files**. | ||||||||||
|
|
||||||||||
| ## File Reference | ||||||||||
|
|
||||||||||
| Each file controls a distinct aspect of the agent's behavior and memory. | ||||||||||
|
|
||||||||||
| | File | Purpose | Upstream Docs | | ||||||||||
| |---|---|---| | ||||||||||
| | `SOUL.md` | Core personality, tone, and behavioral rules. | [SOUL template](https://docs.openclaw.ai/reference/templates/SOUL) | | ||||||||||
| | `USER.md` | Preferences, context, and facts the agent learns about you. | [USER template](https://docs.openclaw.ai/reference/templates/USER) | | ||||||||||
| | `IDENTITY.md` | Agent name, creature type, emoji, and self-presentation. | [IDENTITY template](https://docs.openclaw.ai/reference/templates/IDENTITY) | | ||||||||||
| | `AGENTS.md` | Multi-agent coordination, memory conventions, and safety guidelines. | [AGENTS template](https://docs.openclaw.ai/reference/templates/AGENTS) | | ||||||||||
| | `MEMORY.md` | Curated long-term memory distilled from daily notes. | — | | ||||||||||
| | `memory/` | Directory of daily note files (`YYYY-MM-DD.md`) for session continuity. | — | | ||||||||||
| | File | Purpose | | ||||||||||
| |---|---| | ||||||||||
| | `SOUL.md` | Defines the agent's persona, tone, and communication style. | | ||||||||||
| | `USER.md` | Stores information about the human the agent assists. | | ||||||||||
| | `IDENTITY.md` | Short identity card — name, language, emoji, creature type. | | ||||||||||
| | `AGENTS.md` | Behavioral rules, memory conventions, safety guidelines, and session workflow. | | ||||||||||
| | `MEMORY.md` | Curated long-term memory distilled from daily notes. | | ||||||||||
| | `memory/` | Directory of daily note files (`YYYY-MM-DD.md`) for session continuity. | | ||||||||||
|
|
||||||||||
| ## Where They Live | ||||||||||
|
|
||||||||||
|
|
@@ -44,34 +42,30 @@ All workspace files reside inside the sandbox filesystem: | |||||||||
| └── 2026-03-19.md | ||||||||||
| ``` | ||||||||||
|
|
||||||||||
| > **Note:** The workspace directory is hidden (`.openclaw`). | ||||||||||
| > The files are not at `/sandbox/SOUL.md`. Use the full path when downloading or uploading. | ||||||||||
|
|
||||||||||
| ## Persistence Behavior | ||||||||||
|
|
||||||||||
| Understanding when these files persist and when they are lost is critical. | ||||||||||
|
|
||||||||||
| | Event | Workspace files | | ||||||||||
| |---|---| | ||||||||||
| | Sandbox restart | **Preserved:** the sandbox PVC retains its data. | | ||||||||||
| | `nemoclaw <name> destroy` | **Lost:** the sandbox and its PVC are deleted. | | ||||||||||
| ### Survives: Sandbox Restart | ||||||||||
|
|
||||||||||
| Sandbox restarts (`openshell sandbox restart`) preserve workspace files. | ||||||||||
| The sandbox uses a **Persistent Volume Claim (PVC)** that outlives individual container restarts. | ||||||||||
|
|
||||||||||
| ### Lost: Sandbox Destroy | ||||||||||
|
|
||||||||||
| Running `nemoclaw <name> destroy` **deletes the sandbox and its PVC**. | ||||||||||
| All workspace files are permanently lost unless you back them up first. | ||||||||||
|
Comment on lines
+56
to
+57
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Make destroy/PVC wording slightly less absolute. Line 56 currently asserts direct PVC deletion. The implementation path uses sandbox delete, with storage cleanup as behavior of that operation; consider wording this as associated workspace storage removal for long-term accuracy. ✍️ Suggested wording-Running `nemoclaw <name> destroy` **deletes the sandbox and its PVC**.
+Running `nemoclaw <name> destroy` **deletes the sandbox and its associated workspace storage**.📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||
|
|
||||||||||
| > **Warning:** Always back up your workspace files before running `nemoclaw <name> destroy`. | ||||||||||
| > See Back Up and Restore (see the `nemoclaw-user-workspace` skill) for instructions. | ||||||||||
| > See Backup and Restore (see the `nemoclaw-user-workspace` skill) for instructions. | ||||||||||
|
|
||||||||||
| ## Editing Workspace Files | ||||||||||
|
|
||||||||||
| The agent reads these files at the start of every session. | ||||||||||
| You can edit them in two ways: | ||||||||||
|
|
||||||||||
| 1. **Let the agent do it:** Ask your agent to update its persona, memory, or user context during a session. | ||||||||||
| 2. **Edit manually:** Use `openshell sandbox connect` to open a terminal inside the sandbox and edit files directly, or use `openshell sandbox upload` to push edited files from your host. | ||||||||||
|
|
||||||||||
| ## Prerequisites | ||||||||||
|
|
||||||||||
| - A running NemoClaw sandbox (for backup) or a freshly created sandbox (for restore). | ||||||||||
| - The OpenShell CLI on your `PATH`. | ||||||||||
| - The sandbox name (shown by `nemoclaw list`). | ||||||||||
| 1. **Let the agent do it** — Ask your agent to update its persona, memory, or user context. | ||||||||||
| 2. **Edit manually** — Use `openshell sandbox shell` to open a terminal inside the sandbox and edit files directly, or use `openshell sandbox upload` to push edited files from your host. | ||||||||||
|
|
||||||||||
| Workspace files define your agent's personality, memory, and user context. | ||||||||||
| They persist across sandbox restarts but are **permanently deleted** when you run `nemoclaw <name> destroy`. | ||||||||||
|
|
@@ -80,9 +74,9 @@ This guide covers manual backup with CLI commands and an automated script. | |||||||||
|
|
||||||||||
| ## Step 1: When to Back Up | ||||||||||
|
|
||||||||||
| - Before running `nemoclaw <name> destroy`. | ||||||||||
| - Before major NemoClaw version upgrades. | ||||||||||
| - Periodically, if you have invested time customizing your agent. | ||||||||||
| - **Before running `nemoclaw <name> destroy`** | ||||||||||
| - Before major NemoClaw version upgrades | ||||||||||
| - Periodically, if you've invested time customizing your agent | ||||||||||
|
|
||||||||||
| ## Step 2: Manual Backup | ||||||||||
|
|
||||||||||
|
|
@@ -148,7 +142,7 @@ $ ./scripts/backup-workspace.sh restore my-assistant 20260320-120000 | |||||||||
| List backed-up files to confirm completeness: | ||||||||||
|
|
||||||||||
| ```console | ||||||||||
| $ ls ~/.nemoclaw/backups/20260320-120000/ | ||||||||||
| $ ls -la ~/.nemoclaw/backups/20260320-120000/ | ||||||||||
| AGENTS.md | ||||||||||
| IDENTITY.md | ||||||||||
| MEMORY.md | ||||||||||
|
|
@@ -157,16 +151,6 @@ USER.md | |||||||||
| memory/ | ||||||||||
| ``` | ||||||||||
|
|
||||||||||
| ## Step 6: Inspecting Files Inside the Sandbox | ||||||||||
|
|
||||||||||
| Connect to the sandbox to list or view workspace files directly: | ||||||||||
|
|
||||||||||
| ```console | ||||||||||
| $ openshell sandbox connect my-assistant | ||||||||||
| $ ls -la /sandbox/.openclaw/workspace/ | ||||||||||
| ``` | ||||||||||
|
|
||||||||||
| ## Related Skills | ||||||||||
|
|
||||||||||
| - `nemoclaw-user-reference` — Commands reference | ||||||||||
| - `nemoclaw-user-monitor-sandbox` — Monitor Sandbox Activity | ||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| // SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| /** | ||
| * Subprocess environment allowlist. | ||
| * | ||
| * Subprocesses spawned by the CLI or plugin must NOT inherit the full | ||
| * parent process.env — that leaks secrets (NVIDIA_API_KEY, GITHUB_TOKEN, | ||
| * AWS_ACCESS_KEY_ID, etc.) to child processes where they can be read and | ||
| * exfiltrated. Instead, only forward the categories below. | ||
| * | ||
| * Credentials needed by a subprocess are injected explicitly via the | ||
| * `extra` parameter. | ||
| * | ||
| * See: #1874 | ||
| * | ||
| * NOTE: src/lib/subprocess-env.ts is a mirror of this file for the CLI | ||
| * project. Keep them in sync. | ||
| */ | ||
|
|
||
| // ── Allowed individual names ─────────────────────────────────── | ||
|
|
||
| const SYSTEM = ["HOME", "USER", "LOGNAME", "SHELL", "PATH", "TERM", "HOSTNAME", "NODE_ENV"]; | ||
|
|
||
| const TEMP = ["TMPDIR", "TMP", "TEMP"]; | ||
|
|
||
| const LOCALE = ["LANG"]; // LC_* handled via prefix | ||
|
|
||
| const PROXY = ["HTTP_PROXY", "HTTPS_PROXY", "NO_PROXY", "http_proxy", "https_proxy", "no_proxy"]; | ||
|
|
||
| const TLS = ["SSL_CERT_FILE", "SSL_CERT_DIR", "NODE_EXTRA_CA_CERTS"]; | ||
|
|
||
| const TOOLCHAIN = ["DOCKER_HOST", "KUBECONFIG", "SSH_AUTH_SOCK", "RUST_LOG", "RUST_BACKTRACE"]; | ||
|
|
||
| const ALLOWED_ENV_NAMES = new Set([...SYSTEM, ...TEMP, ...LOCALE, ...PROXY, ...TLS, ...TOOLCHAIN]); | ||
|
|
||
| // ── Allowed prefixes ─────────────────────────────────────────── | ||
|
|
||
| const ALLOWED_ENV_PREFIXES = ["LC_", "XDG_", "OPENSHELL_", "GRPC_"]; | ||
|
|
||
| // ── Public API ───────────────────────────────────────────────── | ||
|
|
||
| export function buildSubprocessEnv(extra?: Record<string, string>): Record<string, string> { | ||
| const env: Record<string, string> = {}; | ||
| for (const [key, value] of Object.entries(process.env)) { | ||
| if (value === undefined) continue; | ||
| if (ALLOWED_ENV_NAMES.has(key) || ALLOWED_ENV_PREFIXES.some((p) => key.startsWith(p))) { | ||
| env[key] = value; | ||
| } | ||
| } | ||
| if (extra) { | ||
| Object.assign(env, extra); | ||
| } | ||
| return env; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix grammar in frontmatter description.
Line 3 has typos (“Hows”, “Whats”) and reads ungrammatically. This is user-facing metadata and should be corrected in the docs source, then regenerated into this skill file.
✍️ Suggested text
📝 Committable suggestion
🤖 Prompt for AI Agents