Repository navigation
fix(policy): reject untrusted private hosts - #10659
Conversation
Custom presets without a trust declaration skipped destination classification, so link-local and other special-use hosts could pass dry-run and reach policy application. Enforce the shared private-host classifier before preview and recheck in-memory application while preserving capability-pinned private hosts. Signed-off-by: Tinson Lai <[email protected]>
Code Coverage OverviewLanguages: TypeScript TypeScript / code-coverage/pluginThe overall line coverage in commit ddb70ed in the TypeScript / code-coverage/cliThe overall line coverage in commit ddb70ed in the Show a line coverage summary of the most impacted files.
Updated |
|
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 (5)
🚧 Files skipped from review as they are similar to previous changes (5)
Included review availability: Your plan provides up to 12 included reviews per hour; 9 remain after this review. 📝 WalkthroughWalkthroughCustom policy presets now reject untrusted private and special-use endpoint hosts before policy application. Trusted endpoints and the OpenShell bridge remain supported. Tests cover validation, side-effect prevention, and dry-run policy refresh behavior. ChangesPolicy endpoint validation
Estimated code review effort: 3 (Moderate) | ~20 minutes Merge Risk: ⚪ Minimal · up to This localized policy change rejects untrusted private and special-use hosts while preserving explicitly trusted destinations and the reviewed host bridge; no actionable merge-blocking risk remains after normal checks and review. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Linked Issues checkExplanation The changes satisfy issue
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Comment |
|
PR Review Advisor finished for commit |
Signed-off-by: Prekshi Vyas <[email protected]>
|
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. |
Signed-off-by: Prekshi Vyas <[email protected]>
prekshivyas
left a comment
There was a problem hiding this comment.
Reviewed the effective policy diff and focused regression coverage. The authoritative gate reports all 50 current checks green, no conflicts, no unresolved major/critical CodeRabbit findings, risky files covered by tests, and all commits DCO/GitHub Verified. The complete prior nine-specialist Advisor review found no required changes; the current OpenAI-route specialist failures are an unrelated post-merge Advisor model-routing infrastructure regression and produced no findings.
## Outcome Improve PR Review Advisor specialist investigation quality using independently selected prompt variants from three model-backed historical-PR A/B rounds. ## Reason The clean benchmark showed that broad prompts could attribute inherited defects to a PR, miss incomplete immutable-pin migrations, and conflate producer or rejection tests with positive consumer proof. ## Changes - Require changed-file, parent-state, consumer, and contract causality. - Narrow architecture ownership and add migration-completion and reduction-simplification specialists. - Adopt independently selected delivery, documentation, and verification prompts. - Preserve tracked internal symlinks in local snapshots while removing escaping links; direct patching could not preserve this security boundary and valid transitions together. - Protect snapshot behavior with internal-link and escaping-to-internal retarget regression coverage. ## Verification - CLI and plugin builds — passed. - `npm run typecheck:cli` — passed. - `npm run checks:repository` — passed. - Focused integration tests — 47/47 passed. - Diff whitespace check — passed. - Independent documentation review — PASS. - Three A/B rounds on #10659, #10536, and #10618 with `azure/openai/gpt-5.6-terra` — completed. - No secrets, API keys, or credentials are present in the diff. ## Review notes This draft is stacked on #10813. Output length and finding count were not selection criteria; prompts were selected independently for factuality, recall, causality, calibration, and remedies. --- Signed-off-by: Carlos Villela <[email protected]> Signed-off-by: Carlos Villela <[email protected]>
Outcome
Custom policy presets now reject untrusted private, local, and special-use endpoint hosts before dry-run or policy mutation.
Explicit RFC1918, CGNAT, and IPv6 unique local trust remains capability-pinned, while the reviewed
host.openshell.internalbridge remains supported.Reason
Custom preset preparation returned before shared destination classification when no private-host trust declaration was supplied.
That allowed a link-local cloud metadata endpoint to pass NemoClaw validation even though the documented policy contract requires it to fail closed.
Related issues
Fixes #10653
Changes
Verification
node_modules/.bin/vitest run --project cli src/lib/policy/trusted-private-endpoints.test.ts src/lib/policy/preset-allowed-ips.test.ts src/lib/actions/sandbox/policy-channel-refresh.test.ts— 3 files and 58 tests passed.node_modules/.bin/vitest run --project cli src/lib/policy src/lib/actions/sandbox/policy-channel src/lib/security/trusted-private-endpoint.test.ts src/commands/sandbox/policy/mutate.test.ts— 30 files and 449 tests passed.node_modules/.bin/tsc -p tsconfig.cli.json— passed.npm run build:cli— passed.npm run format:check— passed.npm run checks:repository— passed.git diff --check— passed.f084839e59221a3fef50a27b6707042c285c3f6eis signed, DCO-compliant, and GitHub-verified with reasonvalid.Review notes
Sensitive-path review covered no-declaration preparation, explicit private-host capability issuance, the OpenShell bridge exception, in-memory application revalidation, and sibling endpoint authority isolation.
One documentation review completed and corrected the rejection diagnostic to state that explicit trust applies only to RFC1918, CGNAT, and IPv6 unique local destinations.
Existing documentation already states the intended rejection contract, so no documentation change is required.
No live-sandbox E2E was run; the command-action dry-run test proves rejection before policy mutation, while existing OpenShell link-local enforcement remains unchanged.
Signed-off-by: Tinson Lai [email protected]
Summary by CodeRabbit