Skip to content

fix(policy): allow the Claude Code login host in the claude-code preset - #7680

Merged
cv merged 2 commits into
mainfrom
fix/claude-code-oauth-host
Jul 28, 2026
Merged

fix(policy): allow the Claude Code login host in the claude-code preset#7680
cv merged 2 commits into
mainfrom
fix/claude-code-oauth-host

Conversation

@laitingsheng

@laitingsheng laitingsheng commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Summary

The bundled claude-code network-policy preset never allowed platform.claude.com, the host Claude Code posts its browser OAuth authorization code to, so the login path the bundled skill documents first could not complete: the CLI reported Login failed: Socket is closed while the sandbox logged endpoint platform.claude.com:443 is not allowed by any policy. The preset now allows GET and POST on /v1/oauth/** for that host, so a Pro/Max subscriber can finish the browser login with the preset as shipped.

Related Issue

Fixes #7637

Changes

  • nemoclaw-blueprint/policies/presets/claude-code.yaml: add a platform.claude.com:443 endpoint with protocol: rest and enforcement: enforce, allowing GET and POST on /v1/oauth/** only. The reporter measured the live flow and observed only POST /v1/oauth/token, so the rest of the host stays closed. Reword the preset description:, which policy list renders, to name the browser login.
  • test/effective-policy-contracts.test.ts: extend the effective host list for claude_code, and add a test that pins the new endpoint's port, protocol, enforcement, and its exact two OAuth rules so the scope cannot widen to /** unnoticed.
  • test/helpers/vitest-watch-triggers.ts and test/vitest-watch-triggers.test.ts: map claude-code.yaml to the contract test. The preset is YAML, so the import graph cannot see the dependency; the mapping is the concrete opaque-input case the helper exists for.
  • docs/security/best-practices.mdx: update the claude-code preset row to name the browser login and state the allowed path scope.

This adds no abstraction, configuration, fallback, migration, or compatibility path.

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)

Quality Gates

  • Tests added or updated for changed behavior
  • Existing tests cover changed behavior — justification:
  • Tests not applicable — justification:
  • Docs updated for user-facing behavior changes
  • Docs not applicable — justification:
  • Sensitive paths changed (security, policy, credentials, preflight, onboarding, inference, runner, sandbox, or messaging)
  • Sensitive-path review completed or maintainer-approved waiver recorded — reviewer/approval link/justification:
  • Non-success, skipped, or missing CI check accepted by maintainer — check name, approval link, and follow-up issue:

npm run docs exits 0 and fern check reports 0 errors, but it also reports 2 warnings that are present on main and unrelated to this change, so the "builds without warnings" verification item below is left unchecked.

Documentation Writer Review

  • Documentation writer subagent reviewed the completed changes
  • Result: docs-updated
  • Evidence: docs/security/best-practices.mdx. The review found no blocking language findings and confirmed docs/reference/network-policies.mdx needs no change, because lines 178-180 enumerate no hosts, methods, or paths for this preset. It raised one wording nit: the risk cell described the grant more narrowly than the policy grants it, where peer rows such as pypi and tavily state their scope outright. Commit 9686bb8 applies the reviewer's own proposed rewrite to that cell and is the only change after the reviewed commit 4d1f1bb.
  • Agent: Claude Code

DGX Station Hardware Evidence

  • Tested on DGX Station
  • Tested commit:
  • Station profile/scenario:
  • Result:
  • Supporting evidence:

Verification

  • PR description includes a Signed-off-by: line and every commit appears as Verified in GitHub
  • Normal pre-commit, commit-msg, and pre-push hooks passed, or npm run check:diff passed when hooks were skipped or unavailable
  • Targeted behavior tests pass for the current change set, or tests are marked not applicable above — command/result or justification: npx vitest run --project integration test/effective-policy-contracts.test.ts test/vitest-watch-triggers.test.ts — 2 files, 18 tests, all pass. Stashing the preset change alone and rerunning fails both Claude assertions, so the new coverage catches the reported defect.
  • Applicable broad gate passed — npm test for broad runtime/test-harness changes; npm run check for repo-wide validation/coverage changes — command/result:
  • Quality Gates section completed with required justifications or waivers
  • No secrets, API keys, or credentials committed
  • npm run 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)

Signed-off-by: Tinson Lai tinsonl@nvidia.com

Summary by CodeRabbit

  • Policy Updates

    • Updated the claude-code preset to support browser login, telemetry, and crash-report access.
    • Added narrowly scoped OAuth connectivity to platform.claude.com for /v1/oauth/** authorization flows using GET and POST.
    • Clarified that the preset should not be used for NemoClaw inference routing.
  • Documentation

    • Expanded security guidance covering OAuth behavior and independently installed Claude Code CLI access.

Claude Code exchanges its browser OAuth authorization code with
platform.claude.com, which the preset never allowed, so the login the
bundled skill documents first failed with "Socket is closed" while the
sandbox logged "endpoint platform.claude.com:443 is not allowed by any
policy". Allow GET and POST on /v1/oauth/** only; the live flow uses
POST /v1/oauth/token, so the rest of the host stays closed.

Fixes #7637

Signed-off-by: Tinson Lai <tinsonl@nvidia.com>
The claude-code row said the preset allows "the OAuth paths on
platform.claude.com", which understates the grant. Peer rows state their
scope outright, so say that GET and POST are allowed on /v1/oauth/**.

Signed-off-by: Tinson Lai <tinsonl@nvidia.com>
@coderabbitai

coderabbitai Bot commented Jul 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: e9833929-f829-44cf-b9ea-3c4a7e0cc502

📥 Commits

Reviewing files that changed from the base of the PR and between 2540869 and 9686bb8.

📒 Files selected for processing (5)
  • docs/security/best-practices.mdx
  • nemoclaw-blueprint/policies/presets/claude-code.yaml
  • test/effective-policy-contracts.test.ts
  • test/helpers/vitest-watch-triggers.ts
  • test/vitest-watch-triggers.test.ts

📝 Walkthrough

Walkthrough

The Claude Code preset now permits scoped OAuth requests to platform.claude.com, with updated security documentation, effective-policy assertions, and Vitest watch-trigger coverage.

Changes

Claude Code OAuth policy

Layer / File(s) Summary
Scoped OAuth endpoint policy
nemoclaw-blueprint/policies/presets/claude-code.yaml, docs/security/best-practices.mdx
The preset and policy documentation add GET and POST access to platform.claude.com/v1/oauth/** and update Claude Code access descriptions.
Effective policy validation
test/effective-policy-contracts.test.ts
Contract tests assert the new host and restrict its effective rules to the OAuth path and methods.
Watch-trigger integration
test/helpers/vitest-watch-triggers.ts, test/vitest-watch-triggers.test.ts
Changes to the Claude Code preset trigger the corresponding effective-policy contract test, with mapping coverage added.

Estimated code review effort: 2 (Simple) | ~10 minutes

Suggested labels: area: policy

Suggested reviewers: cv, ahunnargikar-nvidia, aasthajh

🚥 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 and concisely describes the main change: allowing Claude Code login host access in the claude-code preset.
Linked Issues check ✅ Passed The changes match issue #7637 by adding platform.claude.com with GET/POST access limited to /v1/oauth/** and updating related tests/docs.
Out of Scope Changes check ✅ Passed The docs, contract tests, and watch-trigger updates are all directly supporting the scoped policy change and do not appear unrelated.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ 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/claude-code-oauth-host

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

@github-code-quality

github-code-quality Bot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Code Coverage Overview

Languages: TypeScript

TypeScript / code-coverage/plugin

The overall coverage in commit 9686bb8 in the fix/claude-code-oaut... branch remains at 96%, unchanged from commit 2540869 in the main branch.

TypeScript / code-coverage/cli

The overall coverage in commit 9686bb8 in the fix/claude-code-oaut... branch remains at 81%, unchanged from commit 6c43fe2 in the main branch.

Show a code coverage summary of the most impacted files.
File main 6c43fe2 fix/claude-code-oaut... 9686bb8 +/-
src/lib/domain/.../connect-env.ts 97% 89% -8%
src/lib/policy/...ne-exclusion.ts 97% 91% -6%
src/lib/sandbox...rce-identity.ts 88% 88% 0%
src/lib/readiness/host.ts 0% 100% +100%

Updated July 28, 2026 02:59 UTC

@github-actions

Copy link
Copy Markdown
Contributor

@laitingsheng laitingsheng added provider: anthropic Anthropic or Claude provider behavior area: policy Network policy, egress rules, presets, or sandbox policy bug-fix PR fixes a bug or regression labels Jul 28, 2026
@github-actions

github-actions Bot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

PR Review Advisor — No blocking findings reported

Advisor assessment: No blocking advisor findings reported
Next action: No advisor follow-up needed.
Findings: 0 blockers · 0 warnings · 0 suggestions

Model lanes

  • GPT-5.6 Terra (primary): Completed · high confidence · 0 blockers · 0 warnings · 0 suggestions
  • Nemotron 3 Ultra (second opinion): Completed · high confidence · 0 blockers · 0 warnings · 0 suggestions
  • Model comparison: normalized findings match; normalized E2E selections differ; severity counts match.

Nemotron output stays in workflow artifacts and does not change the assessment above.

E2E guidance

Advisory only. E2E / PR Gate selects and runs jobs independently.

Recommended E2E: inference-routing, network-policy

Workflow run details

This automated review informs maintainers. Warnings and suggestions do not require a response. A maintainer decides whether to merge.

@apurvvkumaria apurvvkumaria added the v0.0.97 Release target label Jul 28, 2026
@apurvvkumaria apurvvkumaria self-assigned this Jul 28, 2026
@cv
cv merged commit e01587d into main Jul 28, 2026
78 of 79 checks passed
@cv
cv deleted the fix/claude-code-oauth-host branch July 28, 2026 07:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: policy Network policy, egress rules, presets, or sandbox policy bug-fix PR fixes a bug or regression provider: anthropic Anthropic or Claude provider behavior v0.0.97 Release target

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Policy] Bundled claude-code preset omits platform.claude.com, so the documented Pro/Max browser OAuth login cannot complete

3 participants