fix(security): scan named agent workspaces for secret writes - #10527
fix(security): scan named agent workspaces for secret writes#10527udsy19 wants to merge 1 commit into
Conversation
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>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (2)
Included review availability: Your plan provides up to 12 included reviews per hour; 11 remain after this review. 📝 WalkthroughWalkthroughThe secret scanner now classifies absolute paths under named ChangesNamed workspace memory scanning
Estimated code review effort: 1 (Trivial) | ~5 minutes Merge Risk: ⚪ Minimal · up to 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: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
PR Review Advisor finished for commit |
|
✨ 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: |
Outcome
A write into a named agent workspace (
/sandbox/.openclaw/workspace-<agent>/)is now scanned for secrets like a write into the default
workspace/. Beforethis change it was not scanned at all.
Reason
MEMORY_PATH_SEGMENTScarries only the default/.openclaw/workspace/(
nemoclaw/src/security/secret-scanner.ts:147), and thebefore_tool_callhook classifies the resolved absolute path (
nemoclaw/src/index.ts:377). Namedworkspaces 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. Sothe two forms of one path disagree.
Related issues
Fixes #10525
Changes
nemoclaw/src/security/secret-scanner.ts: addNAMED_WORKSPACE_SEGMENT,anchored on
/.openclaw/so project directories namedworkspace-*keepclassifying as non-memory.
nemoclaw/src/security/secret-scanner.test.ts: extend the existingmatches named-workspace daily memory pathsanddoes not match unanchored workspace in project pathscases.Verification
npx vitest run --project plugin— 37 files, 1053 passedmain, new test kept:/workspace-[^/]+\//) instead failsdoes not match unanchored workspace in project paths— 1 failed | 55 passednpm --prefix nemoclaw run typecheck,npx oxlint,npx oxfmt --check— cleanSigned-off-by: Udaya Tejas udayatejas2004@gmail.com
Summary by CodeRabbit
.openclawdirectory.