fix(sandbox/recover): enforce Hermes env-file secret boundary on probe path#5530
fix(sandbox/recover): enforce Hermes env-file secret boundary on probe path#5530laitingsheng wants to merge 4 commits into
Conversation
…e path Signed-off-by: Tinson Lai <tinsonl@nvidia.com>
📝 WalkthroughWalkthroughFixes a security regression where ChangesHermes Secret-Boundary Enforcement on Recover
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
E2E Advisor RecommendationRequired E2E: Dispatch hint: Auto-dispatched E2E: Full advisor summaryE2E Recommendation AdvisorBase: Required E2E
Optional E2E
New E2E recommendations
Dispatch hint
|
Vitest E2E Scenario RecommendationRequired Vitest E2E scenarios: Dispatch required Vitest E2E scenarios:
Full Vitest E2E advisor summaryVitest E2E Scenario AdvisorBase: Required Vitest E2E scenarios
Optional Vitest E2E scenarios
Relevant changed files
|
Code Coverage OverviewLanguages: TypeScript TypeScript / code-coverage/pluginThe overall coverage in the branch is 96%. Coverage data for the branch is not yet available. Show a code coverage summary of the most covered files.
TypeScript / code-coverage/cliThe overall coverage in the branch is 46%. Coverage data for the branch is not yet available. Show a code coverage summary of the most covered files.
Updated |
|
🌿 Preview your docs: https://nvidia-preview-pr-5530.docs.buildwithfern.com/nemoclaw |
PR Review AdvisorFindings: 0 needs attention, 3 worth checking, 1 nice ideas Review findings🛠️ Needs attention
🔎 Worth checking
🌱 Nice ideas
Consider writing more tests for
Since last review detailsCurrent findings:
This is an automated advisory review. A human maintainer must make the final merge decision. |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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.
Inline comments:
In `@src/lib/actions/sandbox/process-recovery.ts`:
- Around line 523-538: The stderr output from the validator is being suppressed
when quiet mode is enabled, but security diagnostics should always be surfaced
regardless of the quiet flag. In the block checking for
SECRET_BOUNDARY_REFUSED_MARKER or non-zero status, move the stderr logging
section (which iterates through result.stderr and logs each line) outside of or
separate from the main if (!quiet) condition so that validator error diagnostics
are always displayed to help the caller understand which secret-shaped values
need to be replaced, even when called with quiet: true.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: 0cda9f0a-deb4-4ed5-b935-03c51274c78d
📒 Files selected for processing (7)
docs/reference/commands-nemohermes.mdxdocs/reference/commands.mdxsrc/lib/actions/sandbox/connect.tssrc/lib/actions/sandbox/process-recovery.tssrc/lib/agent/hermes-recovery-boundary.tssrc/lib/agent/runtime-hermes-secret-boundary-behavioural.test.tstest/process-recovery.test.ts
…clusive secret-boundary check Signed-off-by: Tinson Lai <tinsonl@nvidia.com>
Selective E2E Results — ✅ All requested jobs passedRun: 27677577987
|
…r probe refusal at the command boundary Signed-off-by: Tinson Lai <tinsonl@nvidia.com>
Selective E2E Results — ✅ All requested jobs passedRun: 27679202263
|
…c and stop the non-probe connect path on refusal Signed-off-by: Tinson Lai <tinsonl@nvidia.com>
Selective E2E Results — ✅ All requested jobs passedRun: 27681289046
|
Summary
nemohermes <name> recoverdid not re-evaluate the documented Hermes secret boundary when the gateway was already running.recover→connect --probe-only→checkAndRecoverSandboxProcessestook theif (running)branch and returned after refreshing the port-forward, never invokingbuildHermesEnvFileBoundaryGuard()(only the relaunch path embeds it). A rawTELEGRAM_BOT_TOKENinjected into/sandbox/.hermes/.envsurvived recovery and the gateway kept serving. The probe path now executes a standalone secret-boundary check via the rootopenshell sandbox execchannel (so the kill snippet has authority over the gateway-user process), brings the gateway down on refusal, and surfaces a non-zero exit onrecover.Related Issue
Fixes #5525
Changes
hermes-recovery-boundary.tsexportsbuildHermesEnvFileBoundaryStandaloneCheck()plusSECRET_BOUNDARY_{OK,REFUSED,VALIDATOR_MISSING}_MARKERconstants. The standalone snippet runs the existing validator on/sandbox/.hermes/.env, kills any running Hermes gateway/dashboard on refusal, and emits a single stdout marker.process-recovery.tsaddsenforceHermesSecretBoundaryOnRunningGateway, invoked fromcheckAndRecoverSandboxProcessesbefore theif (running)early-return when the active agent is Hermes. Refusal short-circuits the function withsecretBoundaryRefused: trueand skips the forward-refresh path.connect.tsrunSandboxConnectProbesurfaces a refusal as exit 1 with a clear remediation line pointing at theopenshell:resolve:env:<name>placeholder.docs/reference/commands.mdxdocuments the Hermes-only secret-boundary re-evaluation onrecover; the nemohermes variant is regenerated.process-recovery.test.ts(refused / passed / validator-missing / OpenClaw no-op); 3 inruntime-hermes-secret-boundary-behavioural.test.tsexercising the standalone snippet against real bash with stubbedpython3/pkill.Type of Change
Verification
Verifiedin GitHubnpx prek run --from-ref main --to-ref HEADpassesnpm testpasses (broad runtime changes only)npm run docsbuilds without warnings (doc changes only)Signed-off-by: Tinson Lai tinsonl@nvidia.com
Summary by CodeRabbit
Documentation
recovercommand documentation to describe secret boundary re-evaluation behavior.New Features
Bug Fixes
Tests