fix(policy): restrict npm and PyPI presets to GET-only REST rules - #1672
Merged
Conversation
Contributor
📝 WalkthroughWalkthroughReplaced permissive Changes
Sequence Diagram(s)sequenceDiagram
participant Client as Client
participant Proxy as OpenShell Proxy\n(Policy Engine)
participant Registry as Registry\n(npm / PyPI)
Client->>Proxy: HTTPS request (method: GET/HEAD/POST/PUT/DELETE)
Proxy->>Proxy: TLS terminate\nInspect HTTP method & path
alt method is GET or (HEAD for PyPI)
Proxy->>Registry: Forward request over HTTPS
Registry-->>Proxy: Response
Proxy-->>Client: Forward response
else disallowed method (POST/PUT/DELETE/etc.)
Proxy-->>Client: Deny / Reset connection
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
…VIDIA#1439) Replace access: full (raw CONNECT tunnel) with protocol: rest and read-only rules on npm/PyPI presets to prevent package publishing and data exfiltration through registry endpoints. npm: GET-only (sufficient for npm install). PyPI: GET + HEAD (pip/uv use HEAD for lazy-wheel metadata checks). Signed-off-by: Dongni Yang <dongniy@nvidia.com> Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Dongni-Yang
force-pushed
the
fix/npm-pypi-restrict-access-1439
branch
from
April 9, 2026 05:50
e22aec9 to
fe67704
Compare
cv
approved these changes
Apr 9, 2026
3 tasks
4 tasks
miyoungc
added a commit
that referenced
this pull request
Apr 10, 2026
…1719) ## Summary - Remove `github` and `github_rest_api` from baseline network policy docs (now opt-in preset, #1660) - Add `github` preset to presets tables in customize-network-policy.md and best-practices.md - Add `brave` and `brew` presets to best-practices.md - Update `huggingface` description (download-only + inference router, #1663) - Update `npm` and `pypi` descriptions (GET-only, publishing blocked, #1672) - Fix binary-scoping example to reference `github` as a preset, not baseline - Add `docs/.docs-skip` exclusion file for suppressing docs on experimental/unreleased features - Update `nemoclaw-contributor-update-docs` skill with skip-features, skip-terms, and agent matrix filtering rules - Regenerate `nemoclaw-user-*` skills from updated docs ## Test plan - [x] `make docs` builds without warnings - [x] All pre-commit and pre-push hooks pass - [x] Skip-term scan passes (zero violations in branch diff) - [ ] Verify rendered pages in docs site preview 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Introduced skip-list configuration for controlling documentation generation based on commit patterns and excluded terminology. * **Documentation** * Updated network policy presets with new `github`, `brave`, and `brew` options. * Refined preset descriptions for `huggingface`, `npm`, and `pypi` to clarify access scopes. * Clarified that GitHub access is no longer baseline and requires applying the `github` preset during onboarding. <!-- end of auto-generated comment: release notes by coderabbit.ai --> Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
ericksoa
pushed a commit
to cheese-head/NemoClaw
that referenced
this pull request
Apr 14, 2026
…VIDIA#1719) ## Summary - Remove `github` and `github_rest_api` from baseline network policy docs (now opt-in preset, NVIDIA#1660) - Add `github` preset to presets tables in customize-network-policy.md and best-practices.md - Add `brave` and `brew` presets to best-practices.md - Update `huggingface` description (download-only + inference router, NVIDIA#1663) - Update `npm` and `pypi` descriptions (GET-only, publishing blocked, NVIDIA#1672) - Fix binary-scoping example to reference `github` as a preset, not baseline - Add `docs/.docs-skip` exclusion file for suppressing docs on experimental/unreleased features - Update `nemoclaw-contributor-update-docs` skill with skip-features, skip-terms, and agent matrix filtering rules - Regenerate `nemoclaw-user-*` skills from updated docs ## Test plan - [x] `make docs` builds without warnings - [x] All pre-commit and pre-push hooks pass - [x] Skip-term scan passes (zero violations in branch diff) - [ ] Verify rendered pages in docs site preview 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Introduced skip-list configuration for controlling documentation generation based on commit patterns and excluded terminology. * **Documentation** * Updated network policy presets with new `github`, `brave`, and `brew` options. * Refined preset descriptions for `huggingface`, `npm`, and `pypi` to clarify access scopes. * Clarified that GitHub access is no longer baseline and requires applying the `github` preset during onboarding. <!-- end of auto-generated comment: release notes by coderabbit.ai --> Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
gemini2026
pushed a commit
to gemini2026/NemoClaw
that referenced
this pull request
Apr 14, 2026
…IDIA#1672) ## Summary - Replace `access: full` (raw CONNECT tunnel) with `protocol: rest` + read-only rules in `presets/npm.yaml` and `presets/pypi.yaml` - Prevents package publishing (`npm publish`, `pip upload`) and data exfiltration through registry endpoints - npm: GET-only (sufficient for `npm install`) - PyPI: GET + HEAD (`pip`/`uv` use HEAD for lazy-wheel metadata checks) - Updates test assertions to match new expected policy shape Closes NVIDIA#1439 ## Affected files - `nemoclaw-blueprint/policies/presets/npm.yaml` — `registry.npmjs.org`, `registry.yarnpkg.com` - `nemoclaw-blueprint/policies/presets/pypi.yaml` — `pypi.org`, `files.pythonhosted.org` - `test/policies.test.js` — updated assertions + new test for pypi HEAD ## Issue checklist | Issue item | Status | Notes | |---|---|---| | `presets/npm.yaml` uses `access: full` | Fixed | Replaced with `protocol: rest` + GET-only | | `presets/pypi.yaml` uses `access: full` | Fixed | Replaced with `protocol: rest` + GET + HEAD | | `openclaw-sandbox.yaml` lines 131-137 | N/A | GitHub policies — `access: full` is intentional for git push/clone | | `openclaw-sandbox.yaml` lines 163-166 | N/A | `binaries:` entries for clawhub — not related to npm/pypi | | `openclaw-sandbox.yaml` npm entry (lines 194-209) | Already fixed | Uses `protocol: rest` + GET-only in main | | Explicit `deny` rules (recommended fix) | Not needed | With `protocol: rest` + allow-list, everything not allowed is implicitly denied — matches `huggingface.yaml` pattern | ## Why PyPI needs HEAD `pip install` and `uv pip install` use HEAD requests for lazy-wheel downloads and range-request support (checking `Accept-Ranges: bytes` before partial downloads). GET-only would degrade pip to full-file downloads. HEAD is read-only and poses no security risk. ## Reproduction verification ``` # access: full is gone from both presets $ grep 'access: full' presets/npm.yaml presets/pypi.yaml (no matches) # protocol: rest present on all 4 endpoints $ grep -c 'protocol: rest' presets/npm.yaml → 2 $ grep -c 'protocol: rest' presets/pypi.yaml → 2 # Only safe read methods allowed $ grep -cE 'method: (PUT|POST|DELETE)' presets/npm.yaml → 0 $ grep -cE 'method: (PUT|POST|DELETE)' presets/pypi.yaml → 0 ``` ## Test plan - [x] `npx vitest run test/policies.test.js` — all 60 tests pass - [ ] Verify `npm install` works inside sandbox with updated npm preset - [ ] Verify `pip install` works inside sandbox with updated pypi preset - [ ] Verify `npm publish` / `pip upload` is blocked inside sandbox Signed-off-by: Dongni Yang <dongniy@nvidia.com> 🤖 Generated with [Claude Code](https://claude.com/claude-code) Signed-off-by: Dongni Yang <dongniy@nvidia.com> Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
gemini2026
pushed a commit
to gemini2026/NemoClaw
that referenced
this pull request
Apr 14, 2026
…VIDIA#1719) ## Summary - Remove `github` and `github_rest_api` from baseline network policy docs (now opt-in preset, NVIDIA#1660) - Add `github` preset to presets tables in customize-network-policy.md and best-practices.md - Add `brave` and `brew` presets to best-practices.md - Update `huggingface` description (download-only + inference router, NVIDIA#1663) - Update `npm` and `pypi` descriptions (GET-only, publishing blocked, NVIDIA#1672) - Fix binary-scoping example to reference `github` as a preset, not baseline - Add `docs/.docs-skip` exclusion file for suppressing docs on experimental/unreleased features - Update `nemoclaw-contributor-update-docs` skill with skip-features, skip-terms, and agent matrix filtering rules - Regenerate `nemoclaw-user-*` skills from updated docs ## Test plan - [x] `make docs` builds without warnings - [x] All pre-commit and pre-push hooks pass - [x] Skip-term scan passes (zero violations in branch diff) - [ ] Verify rendered pages in docs site preview 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Introduced skip-list configuration for controlling documentation generation based on commit patterns and excluded terminology. * **Documentation** * Updated network policy presets with new `github`, `brave`, and `brew` options. * Refined preset descriptions for `huggingface`, `npm`, and `pypi` to clarify access scopes. * Clarified that GitHub access is no longer baseline and requires applying the `github` preset during onboarding. <!-- end of auto-generated comment: release notes by coderabbit.ai --> Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
access: full(raw CONNECT tunnel) withprotocol: rest+ read-only rules inpresets/npm.yamlandpresets/pypi.yamlnpm publish,pip upload) and data exfiltration through registry endpointsnpm install)pip/uvuse HEAD for lazy-wheel metadata checks)Closes #1439
Affected files
nemoclaw-blueprint/policies/presets/npm.yaml—registry.npmjs.org,registry.yarnpkg.comnemoclaw-blueprint/policies/presets/pypi.yaml—pypi.org,files.pythonhosted.orgtest/policies.test.js— updated assertions + new test for pypi HEADIssue checklist
presets/npm.yamlusesaccess: fullprotocol: rest+ GET-onlypresets/pypi.yamlusesaccess: fullprotocol: rest+ GET + HEADopenclaw-sandbox.yamllines 131-137access: fullis intentional for git push/cloneopenclaw-sandbox.yamllines 163-166binaries:entries for clawhub — not related to npm/pypiopenclaw-sandbox.yamlnpm entry (lines 194-209)protocol: rest+ GET-only in maindenyrules (recommended fix)protocol: rest+ allow-list, everything not allowed is implicitly denied — matcheshuggingface.yamlpatternWhy PyPI needs HEAD
pip installanduv pip installuse HEAD requests for lazy-wheel downloads and range-request support (checkingAccept-Ranges: bytesbefore partial downloads). GET-only would degrade pip to full-file downloads. HEAD is read-only and poses no security risk.Reproduction verification
Test plan
npx vitest run test/policies.test.js— all 60 tests passnpm installworks inside sandbox with updated npm presetpip installworks inside sandbox with updated pypi presetnpm publish/pip uploadis blocked inside sandboxSigned-off-by: Dongni Yang dongniy@nvidia.com
🤖 Generated with Claude Code