Skip to content

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

Open
udsy19 wants to merge 1 commit into
NVIDIA:mainfrom
udsy19:fix/secret-scanner-named-workspace-memory
Open

fix(security): scan named agent workspaces for secret writes#10527
udsy19 wants to merge 1 commit 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

Signed-off-by: Udaya Tejas udayatejas2004@gmail.com

Summary by CodeRabbit

  • Bug Fixes
    • Improved detection of persistent memory paths in named OpenClaw 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.

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 <udayatejas2004@gmail.com>
@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

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: cea31f4b-7509-4837-9118-f820e14eb313

📥 Commits

Reviewing files that changed from the base of the PR and between d63f7b0 and ce38fee.

📒 Files selected for processing (2)
  • nemoclaw/src/security/secret-scanner.test.ts
  • nemoclaw/src/security/secret-scanner.ts

Included review availability: Your plan provides up to 12 included reviews per hour; 11 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 and reject 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
The scanner recognizes named OpenClaw workspace paths. Tests cover daily memory and workspace-support files, plus an unanchored workspace-main path that must not match.

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

Merge Risk: ⚪ Minimal · up to ce38f

The change expands secret scanning to named agent workspaces while preserving project-path exclusions, with focused tests and standard checks passing; no actionable merge-blocking risk remains.

Suggested reviewers: ericksoa, apurvvkumaria

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the main change: scanning named agent workspaces for secret writes.
Linked Issues check ✅ Passed The changes satisfy issue #10525 by recognizing absolute named workspace paths under /.openclaw/workspace-<agent>/ while preserving rejection of unrelated workspace-* paths.
Out of Scope Changes check ✅ Passed All changes are limited to secret-scanner logic and tests required for named agent workspace detection.
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 2 files.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

@github-actions

Copy link
Copy Markdown
Contributor

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

All previous runs

@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:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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

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

2 participants