fix(policy): convert npm_registry from access: full to REST GET-only#1358
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThe Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant Proxy as "Sandbox Proxy\n(protocol: rest\nenforcement: enforce\ntls: terminate)"
participant NPM as "registry.npmjs.org:443"
Client->>Proxy: TLS handshake (terminated at Proxy)
Client->>Proxy: HTTP GET /package (only allowed method)
Proxy->>NPM: Forward GET over TLS
NPM-->>Proxy: 200 OK (package data)
Proxy-->>Client: 200 OK (response)
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 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 |
prekshivyas
left a comment
There was a problem hiding this comment.
Thanks @latenighthackathon — this is a good security tightening.
The change itself looks correct:
protocol: rest/enforcement: enforce/tls: terminatematches the established pattern from the GitHub endpoints in #1225 ✓GET /**is appropriate — agents only fetch packages, never publish ✓- Blocks write operations (
npm publish,PUT,DELETE) from the sandbox ✓ - Enables per-request logging and SecretResolver credential injection ✓
One concern before merging: the manual test plan items are all unchecked:
- Verify
openclaw plugins installsucceeds with GET-only policy - Verify
npm installinside sandbox completes normally - Confirm write attempts (e.g.
npm publish) are blocked by the policy
The tls: terminate means the proxy terminates TLS and re-establishes it to registry.npmjs.org:443. If npm does any form of certificate pinning or integrity checking on the TLS session, this could break installs silently. Could you confirm the manual tests pass and check the boxes before we merge?
|
@prekshivyas Thanks for the review and the valid concern about Test results: Unit tests: All 46 policy and security-method-wildcard tests pass (vitest, Node 22.16). E2E validation on live NemoClaw sandbox (WSL2 + Docker Desktop):
All three test plan items verified:
On the TLS concern: |
ericksoa
left a comment
There was a problem hiding this comment.
Thanks for this contribution — clean change and consistent with the existing REST endpoint pattern. Could you please rebase onto current main? Once that's done we'll likely accept this.
8a45bbd to
adef897
Compare
|
Rebased onto current main. Thanks for the feedback @ericksoa! |
Replace L4 pass-through (access: full) with L7-enforced REST policy restricted to GET. Agents only fetch packages from the npm registry and never publish, so write methods are not needed. Enables per-request rule evaluation, per-request logging, and SecretResolver credential injection on this endpoint. Closes NVIDIA#1355 Signed-off-by: latenighthackathon <latenighthackathon@users.noreply.github.com>
a36d8f2 to
73c8ea7
Compare
|
@ericksoa Thanks for the review! Rebased onto current main — clean linear history, ready for review. |
|
@ericksoa Friendly ping — rebased onto current main yesterday with clean linear history. Ready for your approving review whenever you have a moment, thanks! |
ericksoa
left a comment
There was a problem hiding this comment.
Reviewed: clean security hardening — converts npm_registry from L4 pass-through to L7 REST GET-only, consistent with all other REST endpoints in the policy. npm audit POSTs will be blocked but fail gracefully (confirmed by e2e). LGTM.
…VIDIA#1358) ## Summary - Replace L4 pass-through (`access: full`) on `npm_registry` endpoint with L7-enforced REST policy restricted to `GET /**` - Agents only fetch packages from the npm registry and never publish, so write methods are not needed - Enables per-request rule evaluation, per-request logging, and SecretResolver credential injection ## Motivation - Issue NVIDIA#1111 called out converting `npm_registry` alongside the GitHub endpoints - Discussed and agreed upon during review of PR NVIDIA#1225 but deferred to keep that PR scoped - CodeRabbit filed NVIDIA#1355 to track this follow-up ## Test plan - [ ] Verify `openclaw plugins install` succeeds with GET-only policy - [ ] Verify `npm install` inside sandbox completes normally - [ ] Confirm write attempts (e.g. `npm publish`) are blocked by the policy Closes NVIDIA#1355 Signed-off-by: latenighthackathon <latenighthackathon@users.noreply.github.com> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Security** * Registry access is now read-only (HTTP GET only) and TLS termination is enforced for registry connections, tightening network access and transport security for package registry interactions. <!-- end of auto-generated comment: release notes by coderabbit.ai --> Signed-off-by: latenighthackathon <latenighthackathon@users.noreply.github.com> Co-authored-by: latenighthackathon <latenighthackathon@users.noreply.github.com>
Summary
access: full) onnpm_registryendpoint with L7-enforced REST policy restricted toGET /**Motivation
npm_registryalongside the GitHub endpointsTest plan
openclaw plugins installsucceeds with GET-only policynpm installinside sandbox completes normallynpm publish) are blocked by the policyCloses #1355
Signed-off-by: latenighthackathon latenighthackathon@users.noreply.github.com
Summary by CodeRabbit