Skip to content

fix(security): scan named agent workspaces for secret writes - #10527

Merged
cv merged 6 commits into
NVIDIA:mainfrom
udsy19:fix/secret-scanner-named-workspace-memory
Aug 31, 2026
Merged

cv merged 6 commits into
NVIDIA:mainfrom
udsy19:fix/secret-scanner-named-workspace-memory

Conversation

@udsy19

@udsy19 udsy19 commented Aug 28, 2026 •

Copy link
Copy Markdown
Contributor

Outcome

A write into a named agent workspace (/sandbox/.openclaw/workspace-<agent>/)
is now scanned for secrets like a write into the default workspace/. Before
this change it was not scanned at all.

Reason

MEMORY_PATH_SEGMENTS carries only the default /.openclaw/workspace/
(nemoclaw/src/security/secret-scanner.ts:147), and the before_tool_call
hook classifies the resolved absolute path (nemoclaw/src/index.ts:377). Named
workspaces were documented in #2383; the classifier was last extended in #4519,
which added the relative workspace-<agent>/memory/... form
(nemoclaw/src/security/secret-scanner.ts:188) but not the absolute one. So
the two forms of one path disagree.

Related issues

Fixes #10525

Changes

  • nemoclaw/src/security/secret-scanner.ts: add NAMED_WORKSPACE_SEGMENT,
    anchored on /.openclaw/ so project directories named workspace-* keep
    classifying as non-memory.
  • nemoclaw/src/security/secret-scanner.test.ts: extend the existing
    matches named-workspace daily memory paths and does not match unanchored workspace in project paths cases.

Verification

  • npx vitest run --project plugin — 37 files, 1053 passed
  • negative control, production file reverted to main, new test kept:
 × matches named-workspace daily memory paths
 Tests  1 failed | 55 passed (56)
  • reverting only the anchor (/workspace-[^/]+\//) instead fails
    does not match unanchored workspace in project paths — 1 failed | 55 passed
  • unmodified upstream test file against the fixed module — 56 passed
  • npm --prefix nemoclaw run typecheck, npx oxlint, npx oxfmt --check — clean
  • no secrets, API keys, or credentials in the diff
  • Documentation review: docs-updated
  • Documentation evidence: Updated and simplified docs/security/gateway-authentication-controls.mdx; npm run docs passed.
  • Documentation agent: openai/openai/gpt-5.6-sol
  • Broad gate: passed — npm run validate:pr passed at 1310cbc, including plugin and CLI TypeScript checks.

Signed-off-by: Udaya Tejas [email protected]

Summary by CodeRabbit

  • Bug Fixes

    • Improved detection of persistent memory paths in named workspaces.
    • Prevented unanchored workspace paths from being incorrectly classified as memory locations.
    • Added support for workspace configuration and memory paths under the absolute .openclaw directory.
    • Confirmed that secrets written to named workspace memory paths are blocked.
  • Documentation

    • Updated security documentation to clarify coverage for OpenClaw and NemoClaw state, named workspaces, and canonical workspace files.

Multi-agent sandboxes give each named agent its own workspace at
/sandbox/.openclaw/workspace-<agent>/, with its own memory/ daily notes.
The memory-path classifier that gates the secret scanner only carried the
default /.openclaw/workspace/ segment, so an absolute write into a named
workspace matched no classifier and skipped the scan. The gateway-managed
runtime resolves every write tool path to that absolute form, so this is
the primary path, not an edge case: isMemoryPath already returns true for
the relative workspace-<agent>/memory/... form.

Anchor the new segment on /.openclaw/ so unrelated project directories
named workspace-* keep classifying as non-memory.

Signed-off-by: Udaya Tejas <[email protected]>
@copy-pr-bot

copy-pr-bot Bot commented Aug 28, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@coderabbitai

coderabbitai Bot commented Aug 28, 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

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: d59a068a-f8ac-4f52-8d02-252acef5ffbe

📥 Commits

Reviewing files that changed from the base of the PR and between 96e1efe and 1310cbc.

📒 Files selected for processing (1)
  • docs/security/gateway-authentication-controls.mdx
🚧 Files skipped from review as they are similar to previous changes (1)
  • docs/security/gateway-authentication-controls.mdx

Included review availability: Your plan provides up to 12 included reviews per hour; 10 remain after this review.


📝 Walkthrough

Walkthrough

The secret scanner now classifies absolute paths under named .openclaw/workspace-<agent> directories as memory paths. Tests cover valid gateway-resolved paths, secret blocking, and rejection of unanchored project paths.

Changes

Named workspace memory scanning

Layer / File(s) Summary
Detect and validate named workspace paths
nemoclaw/src/security/secret-scanner.ts, nemoclaw/src/security/secret-scanner.test.ts, nemoclaw/src/register.test.ts, docs/security/gateway-authentication-controls.mdx
The scanner matches default and named OpenClaw workspace paths under /.openclaw/. Tests cover memory and support files, secret blocking, and an unanchored workspace-main path that must not match. The documentation describes the updated coverage.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Merge Risk: ⚪ Minimal · up to 1310c

The change extends secret scanning to named agent workspaces while preserving project-path classification, with validation reported clean at the current head. No actionable merge-blocking risk remains beyond normal checks and review.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The changes satisfy issue #10525 by recognizing absolute named workspace paths under /.openclaw/, rejecting unrelated unanchored workspace-* paths, and verifying that secrets in named workspace wr…
Out of Scope Changes check ✅ Passed The source change, tests, and documentation update directly support the named workspace secret-scanning objective. No unrelated code changes are identified.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 3 files. (1 skipped: 1 …
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: scanning named agent workspaces for secret writes.
Full details: Linked Issues check

Explanation

The changes satisfy issue #10525 by recognizing absolute named workspace paths under /.openclaw/, rejecting unrelated unanchored workspace-* paths, and verifying that secrets in named workspace writes are blocked.

Full details: Docstring Coverage

Explanation

Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 3 files. (1 skipped: 1 unsupported.)

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

@wscurran wscurran added area: sandbox OpenShell sandbox lifecycle, runtime, config, or recovery area: security Security controls, permissions, secrets, or hardening bug-fix PR fixes a bug or regression labels Aug 28, 2026
@wscurran

Copy link
Copy Markdown
Contributor

✨ Thanks for the fix. This addresses a security gap where named agent workspace writes were not scanned for secrets. Maintainers will review the security-sensitive changes.


Related open PRs:


Related open issues:

@coderabbitai

coderabbitai Bot commented Aug 30, 2026

Copy link
Copy Markdown
Contributor

Note

GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer.

@cv

cv commented Aug 30, 2026

Copy link
Copy Markdown
Collaborator

Found a small problem with the PR advisor. I'm making a separate PR to fix it, and will merge it into this branch shortly.

cv added a commit that referenced this pull request Aug 30, 2026
<!-- markdownlint-disable MD041 -->
## Outcome

PR Review Advisor specialists receive the workflow-selected comparison
refs inside OpenShell sandboxes.

## Reason

Fork PR Advisor jobs prepared target/base and HEAD, but sandboxed
specialist execution fell back to origin/main because the refs were not
supplied as command arguments. The read-only checkout has no origin/main
ref, so every specialist failed before producing artifacts.

### Related issues

Refs #10527

## Changes

- Pass the required base and head refs explicitly to sandboxed Advisor
analysis and specialist entrypoints.
- Cover both ordinary analysis and specialist execution at the OpenShell
command boundary.

## Verification

- Contributor validation: npm run validate:pr passed against canonical
origin/main 7478a88.
- Tests: npx vitest run --project integration
test/automation/pull-requests/pr-review-advisor-openshell.test.ts (38
passed); npm run validate:pr passed.
- Broad gate: npm run validate:pr passed, including repository checks
and CLI TypeScript validation.
- Secrets review: The diff contains no secrets, API keys, or credentials
<!-- nemoclaw-docs-review:start -->
- Documentation review: `no-docs-needed`
- Documentation evidence: Internal Advisor workflow command-boundary
repair; no user-facing documentation surface changes.
- Documentation agent: openai/openai/gpt-5.6-sol
<!-- docs-review-head-sha: 48c1193 -->
<!-- docs-review-agents-blob-sha:
dd3528f -->
<!-- nemoclaw-docs-review:end -->
<!-- nemoclaw-targeted-validation:start -->
- Targeted validation: Focused Advisor command and workflow-boundary
suites passed (117 tests); the review follow-up E2E-support suite passed
(78 tests); npm run validate:pr passed. Exact-commit workflow_dispatch
validation passed at
https://github.com/NVIDIA/NemoClaw/actions/runs/33335093964: discovery
and all nine specialist lifecycle, artifact upload, and
outcome-verification jobs succeeded. Commit
48c1193 additionally requires exact
workflow ref expressions and rejects target/base~1 and HEAD~1
lookalikes.
<!-- nemoclaw-targeted-validation:end -->
<!-- nemoclaw-broad-gate:start -->
- Broad gate: passed — npm run validate:pr passed at
48c1193, including YAML, repository,
source-shape, growth, and CLI TypeScript checks.
<!-- nemoclaw-broad-gate:end -->

---

Signed-off-by: Carlos Villela <[email protected]>


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **Bug Fixes**
* Improved pull request review analysis by consistently specifying the
target base and current head revisions.
* Updated specialist review sessions to use the correct execution flow
and behavior settings.
* Enhanced automated checks to verify revision-aware analysis and
specialist execution.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Signed-off-by: Carlos Villela <[email protected]>
@github-actions

Copy link
Copy Markdown
Contributor

PR Review Advisor finished for commit 1310cbc. Include the Advisor findings in the complete PR feedback collection. Verify and group valid findings before repair.

All previous runs

@cv
cv merged commit 3222df2 into NVIDIA:main Aug 31, 2026
90 of 94 checks passed
@wscurran wscurran added area: docs Documentation, examples, guides, or docs build integration: openclaw OpenClaw integration behavior labels Nov 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: docs Documentation, examples, guides, or docs build area: sandbox OpenShell sandbox lifecycle, runtime, config, or recovery area: security Security controls, permissions, secrets, or hardening bug-fix PR fixes a bug or regression integration: openclaw OpenClaw integration behavior

Projects

None yet

Development

Successfully merging this pull request may close these issues.

security: secret scanner never runs for writes into a named agent workspace

3 participants