Skip to content

fix(security): harden low-risk code scanning findings - #3657

Merged
ericksoa merged 10 commits into
mainfrom
fix/high-reward-low-risk-codeql
May 18, 2026
Merged

fix(security): harden low-risk code scanning findings#3657
ericksoa merged 10 commits into
mainfrom
fix/high-reward-low-risk-codeql

Conversation

@cv

@cv cv commented May 17, 2026

Copy link
Copy Markdown
Collaborator

Summary

Harden the high-reward/low-risk code scanning findings by redacting logged values, replacing predictable temp/random patterns, and tightening URL/search validation paths. This targets the first remediation bucket from the code scanning risk/reward tracker.

Related Issue

Refs #3654

Changes

  • Add recursive log redaction for JSON command output and remove credential/env names from user-facing diagnostics.
  • Replace Math.random() session/temp suffixes with crypto.randomUUID().
  • Move temp config/SSH files into private mkdtemp directories and write service PID files via secured file descriptors.
  • Parse Slack and Cloudflare hosts via URL/anchored host validation instead of broad substring URL checks.
  • Sanitize docs search terms before passing user input into Lunr query strategies.
  • Update affected tests for redacted messages and OpenShell error wording.

Type of Change

  • Code change (feature, bug fix, or refactor)
  • Code change with doc updates
  • Doc only (prose changes, no code sample modifications)
  • Doc only (includes code sample changes)

Verification

  • npx prek run --all-files passes
    • Ran twice; the full hook suite reached the CLI test phase but failed on existing 5s timeout/flaky host-environment tests unrelated to this patch. Plugin tests passed in the hook output.
  • npm test passes
  • Tests added or updated for new or changed behavior
  • No secrets, API keys, or credentials committed
  • Docs updated for user-facing behavior changes
  • make docs builds without warnings (doc changes only)
  • Doc pages follow the style guide (doc changes only)
  • New doc pages include SPDX header and frontmatter (new pages only)

Additional checks run:

  • npm run typecheck:cli passes
  • cd nemoclaw && npm run build passes
  • Targeted Vitest suite passes: src/lib/security/redact.test.ts, src/lib/adapters/openshell/client.test.ts, src/lib/onboard/summary.test.ts, src/lib/onboard/preflight.test.ts, src/lib/tunnel/services.test.ts, src/lib/state/onboard-session.test.ts, src/lib/diagnostics/debug.test.ts, src/lib/actions/dev/npm-link-or-shim.test.ts, test/rebuild-credential-preflight.test.ts
  • npx vitest run test/nemoclaw-start.test.ts -t "Slack channel guard" passes
  • cd nemoclaw && npm test -- src/onboard/config.test.ts passes

Signed-off-by: Carlos Villela cvillela@nvidia.com

Summary by CodeRabbit

Release Notes

  • New Features

    • Enhanced security redaction for sensitive data in logs and JSON output
  • Bug Fixes

    • Improved detection of Slack-related connection errors
    • Better DNS probing for container connectivity validation
  • Improvements

    • Cleaner onboarding messages that avoid exposing environment variable names and technical paths
    • More secure temporary file and directory handling with restrictive permissions
    • Generic error messages that provide clarity without revealing sensitive system information
    • Hardened sandbox rebuild logging with automatic redaction

Review Change Stack

@cv cv self-assigned this May 17, 2026
@coderabbitai

coderabbitai Bot commented May 17, 2026

Copy link
Copy Markdown
Contributor

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: 9b996ed6-7453-4d97-81fa-9c75c33988da

📥 Commits

Reviewing files that changed from the base of the PR and between 458a53b and f68362b.

📒 Files selected for processing (1)
  • src/lib/onboard.ts
✅ Files skipped from review due to trivial changes (1)
  • src/lib/onboard.ts

📝 Walkthrough

Walkthrough

This PR hardens NemoClaw by redacting sensitive data from logs and messages, sanitizing user input, replacing cryptographic random sources with proper UUIDs, securing temporary file and PID handling, and updating related tests across the codebase.

Changes

Security & Data Redaction Hardening

Layer / File(s) Summary
Redaction core and CLI JSON logging
src/lib/security/redact.ts, src/lib/security/redact.test.ts, src/lib/cli/nemoclaw-oclif-command.ts, src/lib/cli/nemoclaw-oclif-command.test.ts
redactForLog() recursively redacts sensitive object keys and strings using cycle detection; applied to CLI logJson() output; unit tests verify recursive key redaction and circular-reference handling.
Search, Slack host, and DNS probe sanitization
docs/_ext/search_assets/modules/SearchEngine.js, nemoclaw-blueprint/scripts/slack-channel-guard.js, src/lib/onboard/preflight.ts, test/nemoclaw-start.test.ts
getSafeSearchTerms() extracts and caps 10 Lunr-safe query tokens; mentionsSlackHost() detects Slack domains via URL parsing and regex fallback instead of substring matching; dnsProbeName() generates randomized .invalid probe names with line-based NXDOMAIN detection; tests verify proper Slack host matching and NXDOMAIN success detection.
Generic user-facing messages
src/lib/actions/sandbox/rebuild.ts, src/lib/onboard.ts, src/lib/onboard/summary.ts, src/lib/onboard/summary.test.ts, src/commands/internal/installer/plan.ts, src/lib/actions/dev/npm-link-or-shim.ts, src/lib/adapters/openshell/client.ts, src/lib/adapters/openshell/client.test.ts
Error messages and prompts replace explicit env var names, file paths, command arguments, and configured IDs with generic wording; onboarding summary and test assertions updated to omit environment variable names; OpenShell and installer messages simplified.
Cryptographic UUIDs for identifiers
src/lib/state/onboard-session.ts, src/lib/actions/dev/npm-link-or-shim.ts
randomUUID() replaces Math.random()-derived suffixes in session IDs and temporary shim/session filenames.
Secure temp directories and PID file hardening
nemoclaw/src/onboard/config.ts, src/lib/diagnostics/debug.ts, src/lib/tunnel/services.ts, src/lib/tunnel/services.test.ts
mkdtempSync() creates unique temp directories for onboarding config and SSH config; cleanup uses recursive rmSync(). PID-file writing hardened: opens with O_NOFOLLOW (when supported), sets 0o600 permissions, and writes via file descriptor. CloudFlare URL extraction refactored to a helper; integration test verifies PID file mode and sanitized URL output.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~50 minutes

Possibly related PRs

  • NVIDIA/NemoClaw#3651: Both PRs modify src/lib/onboard/preflight.ts to probe DNS using a randomized RFC 6761 .invalid name via dnsProbeName() and update ProbeContainerDnsOpts.probeName for the nslookup command.

Suggested labels

NemoClaw CLI, OpenShell, fix

Suggested reviewers

  • jyaunches
  • cjagwani

Poem

🐰 A rabbit hops through logs so bright,
Redacting secrets left and right,
UUIDs dance, no Math.random fright,
Temp files tucked in .invalid night,
Security's locked—the code's just right! 🔐

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 20.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'fix(security): harden low-risk code scanning findings' accurately summarizes the main objectives of the PR: security hardening focused on addressing low-risk code scanning findings.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/high-reward-low-risk-codeql

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint skipped: no ESLint configuration detected in root package.json. To enable, add eslint to devDependencies.


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

@github-actions

github-actions Bot commented May 17, 2026

Copy link
Copy Markdown
Contributor

E2E Advisor Recommendation

Required E2E: credential-sanitization-e2e, cloud-onboard-e2e, onboard-resume-e2e, rebuild-openclaw-e2e, messaging-providers-e2e, tunnel-lifecycle-e2e
Optional E2E: diagnostics-e2e, onboard-inference-smoke-e2e, network-policy-e2e, cloud-inference-e2e, macos-e2e

Dispatch hint: credential-sanitization-e2e,cloud-onboard-e2e,onboard-resume-e2e,rebuild-openclaw-e2e,messaging-providers-e2e,tunnel-lifecycle-e2e

Auto-dispatched E2E: credential-sanitization-e2e, cloud-onboard-e2e, onboard-resume-e2e, rebuild-openclaw-e2e, messaging-providers-e2e, tunnel-lifecycle-e2e via nightly-e2e.yaml at f68362b02fabe14a6a22ac68384eaeea6c92d767nightly run

Workflow run

Full advisor summary

E2E Recommendation Advisor

Base: origin/main
Head: HEAD
Confidence: high

Required E2E

  • credential-sanitization-e2e (high): Required because this PR centralizes and broadens redaction behavior across CLI JSON output, diagnostics, onboard summaries, rebuild logs, OpenShell errors, and credential/session handling. This E2E is the highest-signal existing guard for credential leakage across host and sandbox surfaces.
  • cloud-onboard-e2e (high): Required because onboarding config, preflight DNS parsing, provider credential prompts, compatible endpoint smoke output, installer-facing output, and onboard summaries changed. This validates public install/onboard, policy setup, API-key leak checks, and inference.local probe in a real user flow.
  • onboard-resume-e2e (high): Required because onboard-session ID/temp-file generation and session normalization are touched. Resume is the user-visible path most likely to catch regressions in persisted session state and lock/session-file handling.
  • rebuild-openclaw-e2e (high): Required because sandbox rebuild logic changed to redact verbose diagnostics and alter credential preflight messaging. Rebuild is a critical lifecycle flow that must preserve assistant workspace state and provider/inference configuration.
  • messaging-providers-e2e (high): Required because the Slack channel guard changed its Slack-host rejection classifier, and onboarding/messaging credential output was redacted. This existing E2E covers Telegram/Discord/Slack provider placeholders, Slack startup failure containment, L7 credential rewrite, and token isolation.
  • tunnel-lifecycle-e2e (high): Required because tunnel service lifecycle code changed. This validates cloudflared tunnel start/probe/stop behavior and catches deployment regressions in PID/log process management.

Optional E2E

  • diagnostics-e2e (high): Useful additional confidence because diagnostics debug collection changed temp SSH config handling and delegates redaction to the shared redact module. Credential-sanitization covers leak risk, but this directly validates debug tarball and quick diagnostics behavior.
  • onboard-inference-smoke-e2e (medium): Useful adjacent regression coverage for onboarding success reporting and inference route readiness, especially because onboard-compatible endpoint smoke output and preflight behavior changed.
  • network-policy-e2e (high): Optional because Slack-host parsing was changed in the Slack guard and the network-policy suite includes Slack preset live policy-add coverage; however the touched file is the channel guard rather than policy YAML/runtime enforcement.
  • cloud-inference-e2e (high): Optional broad real assistant confidence for live inference.local and skill filesystem behavior after onboarding-related output/preflight changes.
  • macos-e2e (high): Optional cross-platform confidence because config temp-dir fallback, diagnostics temp file handling, OpenShell adapter messages, and npm-link-or-shim use platform-sensitive filesystem/process behavior.

New E2E recommendations

  • security/installer-plan-redaction (medium): Existing E2E suites cover credential leaks during onboard/diagnostics/sandbox use, but there is no focused E2E that dispatches nemoclaw internal installer plan --json and verifies sensitive installer/environment inputs are redacted while non-JSON output remains intentionally generic.
    • Suggested test: Add an installer-plan redaction E2E or scenario that seeds token-like install/provider env values, runs the internal installer plan command with and without --json, and asserts no raw secrets or sensitive paths appear in logs/artifacts.
  • messaging/slack-channel-guard-host-classification (medium): The Slack channel guard now parses host tokens with URL semantics. Existing messaging provider E2E exercises Slack invalid-auth and policy behavior, but may not directly assert that Slack-host proxy/network errors are consumed while lookalike non-Slack strings are not.
    • Suggested test: Add a small Slack channel guard E2E/scenario that injects unhandledRejection cases for slack.com, subdomain.slack.com, and non-Slack lookalikes, then asserts only real Slack-host failures are handled and the gateway continues.
  • docs-search-query-sanitization (low): Docs search sanitization is isolated from runtime E2E and likely covered better by frontend/unit tests, but no E2E appears to validate Lunr query sanitization against malformed or operator-heavy documentation search strings.
    • Suggested test: Add a docs search regression test for malformed Lunr queries and long/operator-heavy inputs to ensure search returns safely instead of throwing.

Dispatch hint

  • Workflow: .github/workflows/nightly-e2e.yaml
  • jobs input: credential-sanitization-e2e,cloud-onboard-e2e,onboard-resume-e2e,rebuild-openclaw-e2e,messaging-providers-e2e,tunnel-lifecycle-e2e

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
docs/_ext/search_assets/modules/SearchEngine.js (1)

1-1: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Add required SPDX license header.

This file is missing the SPDX license header required by coding guidelines. As per coding guidelines, all .js files must include the SPDX header at the top.

📄 Required SPDX header

Add these lines at the very top of the file:

+// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
+// SPDX-License-Identifier: Apache-2.0
+
 /**
  * SearchEngine Module
  * Handles Lunr.js integration and search logic with filtering and grouping
  */
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@docs/_ext/search_assets/modules/SearchEngine.js` at line 1, This file is
missing the required SPDX license header; add the specified SPDX header lines as
the very first lines of the file (above any comments or code) so the file begins
with the license declaration; update modules/SearchEngine.js (the module
containing the SearchEngine implementation) by inserting the header at the top
of the file before the existing /** comment and any exports or definitions.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@docs/_ext/search_assets/modules/SearchEngine.js`:
- Line 1: This file is missing the required SPDX license header; add the
specified SPDX header lines as the very first lines of the file (above any
comments or code) so the file begins with the license declaration; update
modules/SearchEngine.js (the module containing the SearchEngine implementation)
by inserting the header at the top of the file before the existing /** comment
and any exports or definitions.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: b023b824-dfc3-4afd-a121-c8714abe9e59

📥 Commits

Reviewing files that changed from the base of the PR and between aa6dca9 and 71525be.

📒 Files selected for processing (17)
  • docs/_ext/search_assets/modules/SearchEngine.js
  • nemoclaw-blueprint/scripts/slack-channel-guard.js
  • nemoclaw/src/onboard/config.ts
  • src/commands/internal/installer/plan.ts
  • src/lib/actions/dev/npm-link-or-shim.ts
  • src/lib/actions/sandbox/rebuild.ts
  • src/lib/adapters/openshell/client.test.ts
  • src/lib/adapters/openshell/client.ts
  • src/lib/cli/nemoclaw-oclif-command.ts
  • src/lib/diagnostics/debug.ts
  • src/lib/onboard.ts
  • src/lib/onboard/preflight.ts
  • src/lib/onboard/summary.test.ts
  • src/lib/onboard/summary.ts
  • src/lib/security/redact.ts
  • src/lib/state/onboard-session.ts
  • src/lib/tunnel/services.ts

@copy-pr-bot

copy-pr-bot Bot commented May 17, 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 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
src/lib/onboard/preflight.test.ts (1)

1286-1286: 💤 Low value

Indentation inconsistency.

This it() block has 4 leading spaces while all other sibling test declarations in this describe block use 2 spaces. This will likely be flagged by the Biome formatter.

-    it("treats thrown runCapture errors as error reason", () => {
+  it("treats thrown runCapture errors as error reason", () => {
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/lib/onboard/preflight.test.ts` at line 1286, Fix the indentation of the
test declaration starting with it("treats thrown runCapture errors as error
reason", () => { so it uses 2 leading spaces like its sibling tests instead of
4; locate this test in src/lib/onboard/preflight.test.ts and adjust the leading
whitespace of that it() block to match the surrounding describe block's 2-space
indentation.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@src/lib/onboard/preflight.test.ts`:
- Line 1286: Fix the indentation of the test declaration starting with
it("treats thrown runCapture errors as error reason", () => { so it uses 2
leading spaces like its sibling tests instead of 4; locate this test in
src/lib/onboard/preflight.test.ts and adjust the leading whitespace of that it()
block to match the surrounding describe block's 2-space indentation.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: df9e156e-a4f1-484b-81d8-151bcf1eb002

📥 Commits

Reviewing files that changed from the base of the PR and between 213da1d and 458a53b.

📒 Files selected for processing (2)
  • src/lib/onboard/preflight.test.ts
  • src/lib/onboard/preflight.ts

@cv cv added the v0.0.45 label May 17, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Selective E2E Results — ✅ All requested jobs passed

Run: 25979435423
Target ref: 458a53b9de432c1449b143fbb7d79cc9bae3ac0a
Workflow ref: main
Requested jobs: cloud-onboard-e2e,credential-sanitization-e2e,diagnostics-e2e,rebuild-openclaw-e2e,tunnel-lifecycle-e2e,messaging-providers-e2e
Summary: 5 passed, 0 failed, 0 skipped

Job Result
cloud-onboard-e2e ✅ success
credential-sanitization-e2e ✅ success
diagnostics-e2e ✅ success
messaging-providers-e2e ✅ success
rebuild-openclaw-e2e ⚠️ cancelled
tunnel-lifecycle-e2e ✅ success

@github-actions

Copy link
Copy Markdown
Contributor

Selective E2E Results — ❌ Some jobs failed

Run: 25979731454
Target ref: 458a53b9de432c1449b143fbb7d79cc9bae3ac0a
Workflow ref: main
Requested jobs: all (no filter)
Summary: 40 passed, 1 failed, 2 skipped

Job Result
brave-search-e2e ✅ success
channels-stop-start-e2e ✅ success
cloud-e2e ✅ success
cloud-inference-e2e ✅ success
cloud-onboard-e2e ✅ success
credential-migration-e2e ✅ success
credential-sanitization-e2e ✅ success
device-auth-health-e2e ✅ success
diagnostics-e2e ✅ success
docs-validation-e2e ✅ success
double-onboard-e2e ✅ success
gpu-double-onboard-e2e ⏭️ skipped
gpu-e2e ⏭️ skipped
hermes-discord-e2e ✅ success
hermes-e2e ✅ success
hermes-inference-switch-e2e ❌ failure
hermes-slack-e2e ✅ success
inference-routing-e2e ✅ success
issue-2478-crash-loop-recovery-e2e ✅ success
kimi-inference-compat-e2e ✅ success
launchable-smoke-e2e ✅ success
messaging-compatible-endpoint-e2e ✅ success
messaging-providers-e2e ✅ success
network-policy-e2e ✅ success
onboard-repair-e2e ✅ success
onboard-resume-e2e ✅ success
openclaw-inference-switch-e2e ✅ success
openshell-gateway-upgrade-e2e ✅ success
overlayfs-autofix-e2e ✅ success
rebuild-hermes-e2e ✅ success
rebuild-hermes-stale-base-e2e ✅ success
rebuild-openclaw-e2e ✅ success
runtime-overrides-e2e ✅ success
sandbox-operations-e2e ✅ success
sandbox-survival-e2e ✅ success
shields-config-e2e ✅ success
skill-agent-e2e ✅ success
snapshot-commands-e2e ✅ success
state-backup-restore-e2e ✅ success
telegram-injection-e2e ✅ success
token-rotation-e2e ✅ success
tunnel-lifecycle-e2e ✅ success
upgrade-stale-sandbox-e2e ✅ success

Failed jobs: hermes-inference-switch-e2e. Check run artifacts for logs.

@github-actions

Copy link
Copy Markdown
Contributor

Selective E2E Results — ✅ All requested jobs passed

Run: 25981516199
Target ref: a549e493a2c2f8da2efba02c86c9a31b3203e626
Workflow ref: main
Requested jobs: cloud-onboard-e2e,credential-sanitization-e2e,messaging-providers-e2e,rebuild-openclaw-e2e,tunnel-lifecycle-e2e,diagnostics-e2e
Summary: 6 passed, 0 failed, 0 skipped

Job Result
cloud-onboard-e2e ✅ success
credential-sanitization-e2e ✅ success
diagnostics-e2e ✅ success
messaging-providers-e2e ✅ success
rebuild-openclaw-e2e ✅ success
tunnel-lifecycle-e2e ✅ success

@github-actions

Copy link
Copy Markdown
Contributor

Selective E2E Results — ❌ Some jobs failed

Run: 25999142366
Target ref: 49ec3e0047b7dff497f794c3a89fbe2e40e7491b
Workflow ref: main
Requested jobs: cloud-onboard-e2e,credential-sanitization-e2e,diagnostics-e2e,rebuild-openclaw-e2e,rebuild-hermes-e2e,messaging-providers-e2e,tunnel-lifecycle-e2e,onboard-resume-e2e
Summary: 7 passed, 1 failed, 0 skipped

Job Result
cloud-onboard-e2e ✅ success
credential-sanitization-e2e ✅ success
diagnostics-e2e ✅ success
messaging-providers-e2e ✅ success
onboard-resume-e2e ✅ success
rebuild-hermes-e2e ✅ success
rebuild-openclaw-e2e ✅ success
tunnel-lifecycle-e2e ❌ failure

Failed jobs: tunnel-lifecycle-e2e. Check run artifacts for logs.

@github-actions

Copy link
Copy Markdown
Contributor

Selective E2E Results — ✅ All requested jobs passed

Run: 26000346929
Target ref: f68362b02fabe14a6a22ac68384eaeea6c92d767
Workflow ref: main
Requested jobs: credential-sanitization-e2e,cloud-onboard-e2e,onboard-resume-e2e,rebuild-openclaw-e2e,messaging-providers-e2e,tunnel-lifecycle-e2e
Summary: 6 passed, 0 failed, 0 skipped

Job Result
cloud-onboard-e2e ✅ success
credential-sanitization-e2e ✅ success
messaging-providers-e2e ✅ success
onboard-resume-e2e ✅ success
rebuild-openclaw-e2e ✅ success
tunnel-lifecycle-e2e ✅ success

@cv
cv requested a review from ericksoa May 17, 2026 23:14

@ericksoa ericksoa left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed locally at head f68362b against current origin/main. I focused on the issue #3654 high-reward/low-risk security bucket: log/JSON redaction, Slack and trycloudflare host parsing, temporary/PID file hardening, randomness, DNS parsing, and docs search query sanitization.

No blocking correctness or security regressions found. Local validation included build:cli, typecheck:cli, the focused security test slices, the Slack channel guard slice, nested nemoclaw config tests, source-shape:check, nested nemoclaw build, and npm run check after generated artifacts were present. GitHub checks are green and there are no active review threads.

Residual note: final CodeQL alert closure still depends on the next code-scanning/default-branch alert update, but this PR is in good shape to merge.

@ericksoa
ericksoa merged commit 1832ad0 into main May 18, 2026
29 checks passed
hunglp6d pushed a commit that referenced this pull request May 18, 2026
## Summary
Harden the high-reward/low-risk code scanning findings by redacting
logged values, replacing predictable temp/random patterns, and
tightening URL/search validation paths. This targets the first
remediation bucket from the code scanning risk/reward tracker.

## Related Issue
Refs #3654

## Changes
- Add recursive log redaction for JSON command output and remove
credential/env names from user-facing diagnostics.
- Replace `Math.random()` session/temp suffixes with
`crypto.randomUUID()`.
- Move temp config/SSH files into private `mkdtemp` directories and
write service PID files via secured file descriptors.
- Parse Slack and Cloudflare hosts via URL/anchored host validation
instead of broad substring URL checks.
- Sanitize docs search terms before passing user input into Lunr query
strategies.
- Update affected tests for redacted messages and OpenShell error
wording.

## Type of Change
- [x] Code change (feature, bug fix, or refactor)
- [ ] Code change with doc updates
- [ ] Doc only (prose changes, no code sample modifications)
- [ ] Doc only (includes code sample changes)

## Verification
<!-- Check each item you ran and confirmed. Leave unchecked items you
skipped. Doc-only changes do not require npm test unless you ran it. -->
- [ ] `npx prek run --all-files` passes
- Ran twice; the full hook suite reached the CLI test phase but failed
on existing 5s timeout/flaky host-environment tests unrelated to this
patch. Plugin tests passed in the hook output.
- [ ] `npm test` passes
- [x] Tests added or updated for new or changed behavior
- [x] No secrets, API keys, or credentials committed
- [ ] Docs updated for user-facing behavior changes
- [ ] `make docs` builds without warnings (doc changes only)
- [ ] Doc pages follow the [style
guide](https://github.com/NVIDIA/NemoClaw/blob/main/docs/CONTRIBUTING.md)
(doc changes only)
- [ ] New doc pages include SPDX header and frontmatter (new pages only)

Additional checks run:
- [x] `npm run typecheck:cli` passes
- [x] `cd nemoclaw && npm run build` passes
- [x] Targeted Vitest suite passes: `src/lib/security/redact.test.ts`,
`src/lib/adapters/openshell/client.test.ts`,
`src/lib/onboard/summary.test.ts`, `src/lib/onboard/preflight.test.ts`,
`src/lib/tunnel/services.test.ts`,
`src/lib/state/onboard-session.test.ts`,
`src/lib/diagnostics/debug.test.ts`,
`src/lib/actions/dev/npm-link-or-shim.test.ts`,
`test/rebuild-credential-preflight.test.ts`
- [x] `npx vitest run test/nemoclaw-start.test.ts -t "Slack channel
guard"` passes
- [x] `cd nemoclaw && npm test -- src/onboard/config.test.ts` passes

---
<!-- DCO sign-off required by CI. Run: git config user.name && git
config user.email -->
Signed-off-by: Carlos Villela <cvillela@nvidia.com>

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

## Release Notes

* **New Features**
* Enhanced security redaction for sensitive data in logs and JSON output

* **Bug Fixes**
  * Improved detection of Slack-related connection errors
  * Better DNS probing for container connectivity validation

* **Improvements**
* Cleaner onboarding messages that avoid exposing environment variable
names and technical paths
* More secure temporary file and directory handling with restrictive
permissions
* Generic error messages that provide clarity without revealing
sensitive system information
  * Hardened sandbox rebuild logging with automatic redaction

<!-- review_stack_entry_start -->

[![Review Change
Stack](https://storage.googleapis.com/coderabbit_public_assets/review-stack-in-coderabbit-ui.svg)](https://app.coderabbit.ai/change-stack/NVIDIA/NemoClaw/pull/3657?utm_source=github_walkthrough&utm_medium=github&utm_campaign=change_stack)

<!-- review_stack_entry_end -->
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
@cv
cv deleted the fix/high-reward-low-risk-codeql branch May 27, 2026 21:16
@wscurran wscurran added the bug-fix PR fixes a bug or regression label Jun 8, 2026
apurvvkumaria pushed a commit that referenced this pull request Jul 23, 2026
…output (#7356)

## Summary

`sandbox doctor --json` resolved with the raw report, while `sandbox
status --json` has redacted its machine-readable report since #4310.
Both doctor JSON egress points now pass through the centralized
`redactForLog`, so token-shaped values in check details no longer reach
JSON consumers. Exit codes are still computed from the raw report before
redaction.

## Related Issue

Refs #4310 (the `status --json` redaction precedent this change
mirrors). The asymmetry was found while verifying the redaction contract
for the serving-process health design discussion on #7003 (refs only;
this PR does not close either issue).

## Changes

- `src/lib/actions/sandbox/doctor-report.ts`: the `renderDoctorReport`
JSON branch prints via `console.log`, which bypasses the oclif `logJson`
redaction boundary (#3657); the report is now routed through
`redactForLog` before printing.
- `src/commands/sandbox/doctor.ts`: the oclif `--json` path now returns
`redactForLog(report)`, so programmatic consumers of the resolved value
— not just the `logJson`-printed stdout — never see raw token-shaped
detail. `process.exitCode` is derived from the raw report first.
- Tests: one render-level and one command-boundary redaction test. Each
uniquely pins its egress point: the command test mocks
`runSandboxDoctor` (so `renderDoctorReport` never runs on that path),
and the render test calls `renderDoctorReport` directly (the oclif path
bypasses it via `quietJson`). Both were red before the fix.

Review notes:

- Pre-existing quirk (unchanged here, identical in `status --json`):
`redactFull`'s word-context patterns can consume a short word following
a credential-shaped env-var name, e.g. `…_API_KEY for NVIDIA managed
health…` renders as `…_API_KEY <REDACTED> NVIDIA managed health…`. A
candidate follow-up is to give `FULL_REDACT_PATTERNS` the same `{10,}`
minimum value length `CONTEXT_PATTERNS` already uses.
- The `renderDoctorReport` JSON branch currently has no production
caller (the oclif command always passes `quietJson: true` with
`--json`); it is redacted anyway because that `console.log` egress has
no other redaction layer for any future direct caller.

## Type of Change

- [x] Code change (feature, bug fix, or refactor)
- [ ] Code change with doc updates
- [ ] Doc only (prose changes, no code sample modifications)
- [ ] Doc only (includes code sample changes)

## Quality Gates

- [x] Tests added or updated for changed behavior
- [ ] Existing tests cover changed behavior — justification:
- [ ] Tests not applicable — justification:
- [ ] Docs updated for user-facing behavior changes
- [x] Docs not applicable — justification: `doctor --json` is documented
only as "Emit the report as JSON" with no field-level or verbatim-detail
contract (`docs/reference/commands.mdx`); this change enforces the
existing CLI redaction contract in `docs/security/best-practices.mdx`.
- [x] Sensitive paths changed (security, policy, credentials, preflight,
onboarding, inference, runner, sandbox, or messaging)
- [x] Sensitive-path review completed or maintainer-approved waiver
recorded — reviewer/approval link/justification: [cjagwani approved PR
SHA
`92aa402`](#7356 (review))
after reviewing the redaction coverage, resolved automated feedback,
required checks, and selected E2E.
- [ ] Non-success, skipped, or missing CI check accepted by maintainer —
check name, approval link, and follow-up issue:

## DGX Station Hardware Evidence

- [ ] Tested on DGX Station
- Tested commit: Not applicable
- Station profile/scenario: Not applicable
- Result: Not applicable
- Supporting evidence: Not applicable — this PR does not change
`scripts/prepare-dgx-station-host.sh`.

## Verification

- [x] PR description includes a `Signed-off-by:` line and every commit
appears as `Verified` in GitHub
- [x] Normal `pre-commit`, `commit-msg`, and `pre-push` hooks passed, or
`npm run check:diff` passed when hooks were skipped or unavailable —
`npm run check:diff` passed (hooks skipped locally; commitlint reports
one non-blocking `footer-leading-blank` warning)
- [x] Targeted behavior tests pass for the current change set, or tests
are marked not applicable above — `npx vitest run --project cli
src/lib/actions/sandbox/doctor-report.test.ts
src/commands/sandbox/oclif-command-adapters.test.ts
src/lib/actions/sandbox/doctor-flow.test.ts
src/lib/actions/sandbox/doctor-inference.test.ts` → 42/42 passed
- [ ] Applicable broad gate passed — `npm test` for broad
runtime/test-harness changes; `npm run check` for repo-wide
validation/coverage changes — command/result: not applicable (targeted
change)
- [x] Quality Gates section completed with required justifications or
waivers
- [x] No secrets, API keys, or credentials committed

---
Signed-off-by: Dongni-Yang <dongniy@nvidia.com>

🤖 Generated with [Claude Code](https://claude.com/claude-code)


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

## Summary by CodeRabbit

* **Bug Fixes**

* Sandbox diagnostic reports in JSON mode now redact token-shaped values
from returned and displayed details.
* Preserved failure status reporting while preventing sensitive token
values from appearing in machine-readable output.

* **Tests**

* Added coverage confirming redaction in both CLI results and printed
JSON reports.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

Signed-off-by: Dongni-Yang <dongniy@nvidia.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Co-authored-by: cjagwani <cjagwani@nvidia.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug-fix PR fixes a bug or regression

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants