Repository navigation
[3766 by Claude Opus 5.5] Sprites network policy for restricted mode and MCP reachability - #3793
Conversation
SpritesRuntime now enforces restricted mode with the Sprite's DNS allowlist policy instead of refusing every restricted run. It also declares the capability, so admission accepts these runs. Typecheck and lint pass on `packages/core/src/agents/runtime`. The new and existing Sprites, runtime-registry, MCP-grant and tool-policy tests pass (120, 0 failures). The fake Sprites client is not the real API, though: the policy rule format, the read-back check and the reset after a run have not been run against a live Sprite. Restricted mode (new file `sprites/spritesNetwork.ts`) - What the Sprite allows: the run's full allowlist, meaning the agent's base hosts plus the instance and repository additions, and the host of the granted ProPR MCP URL. Every other domain is denied. - Wildcards: in ProPR, `*.zone` covers subdomains only. Sprites' docs don't say whether their `*.zone` also covers the bare zone, so the bare zone gets an explicit deny unless it's listed itself. - IP-literal entries are dropped. Sprites matches by domain name, and it always blocks private addresses. - Before the run: the policy is applied and read back before anything is uploaded or launched. If the Sprite doesn't report exactly that policy, the run fails without starting. - After the run: release restarts the Sprite, clears the policy and checks it is clear, then wipes `/tmp` and restores the checkpoint. A Sprite whose policy can't be cleared is destroyed and replaced, never reused. Open runs don't touch the policy. - Still refused: named or private networks, an MCP grant that needs a private network, a malformed policy, and a policy that disagrees with the run's restriction. - Claude runs: restricted runs get `CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1` unless their configuration already sets it, as on Docker. This is weaker than Docker in two ways: - Sprites can't restrict ports, so an allowed host is reachable on any port. - Sprites doesn't report denied connections, so no denied hosts are recorded for these runs. MCP reachability - New `PROPR_SPRITES_MCP_URL` setting, for a public ProPR origin or a Connect gateway. It takes priority for Sprites; otherwise the existing fallback applies (`PROPR_AGENT_MCP_URL` or `API_PUBLIC_URL` + `/api/mcp`). - The URL must be HTTPS with a public domain name. Runs pointing at an IP literal, `localhost`, a single-label name such as `api` or plain HTTP are refused. - MCP grants on a reachable URL now record that URL (`AgentRunMcpGrant.url`), which is how the MCP host gets into the allowlist. - The existing per-run grant token was already what the issue asks for: scoped to the grant, two-hour expiry, revoked at phase end. That part needed no change. Not done: Sprites Connectors as a credential source, the optional item. I couldn't check whether git-over-HTTPS works through the GitHub connector from here, so I left it out and added no connector settings, although the issue's Implementation note suggested adding them. The docs say Connectors aren't used yet. Docs and config - `execution-safety.md` has a new "Restricted mode on Fly Sprites" section covering the trust model and the limits above. - `agent-runtime.md` and `.env.example` are updated. - The restricted-network refusal message in `registry.ts` now names both docker and sprites as runtimes that can enforce it. Tests - New: `test/spritesNetworkPolicy.test.ts`. - Updated: `test/helpers/fakeSprites.ts` (it now has the network-policy calls) and one expectation in `test/agentRuntimeNetworkCapability.test.ts` (the grant now includes its URL). The change has no visual output, so there are no previews. ProPR-Agent: claude/claude-opus-5-5
|
/ultrafix goal=8 max=10 |
|
🔄 Ultrafix loop started (goal: 8/10, max cycles: 10) First action:
|
|
✅ AI Code Review Complete requested by @propr-ultrafix Posted 1 review: |
🔍 AI Code Review — codex:gpt-6-astraOverall EvaluationThe PR adds restricted Sprites networking with policy verification, cleanup, and public MCP endpoint selection. It needs a localized correctness fix before merge. ✅ Verification before launch — The runtime applies and reads back the policy before uploading run data or launching the agent. ✅ Cleanup on failure — The slot is marked restricted before policy application; release clears and verifies the policy, discarding the Sprite if cleanup fails. The supplied current-head status has no failures and five pending checks. This review used static analysis only; no commands were run. Merge blockersEvery finding below was introduced by this PR and must be resolved before merging. F1: 🔴 Preserve overlapping wildcard permissions
SuggestionsThese are optional follow-ups and are not sent to S1: 🟢 Verify the live policy contractAn opt-in live Sprite test would strengthen confidence in rule precedence, read-back normalization, denied connectivity, and policy reset. The fake client stores and returns policies without enforcing them, so its tests establish orchestration rather than actual network confinement. This is optional follow-up validation, not a separately demonstrated defect. ScoreThe implementation is focused and includes useful lifecycle coverage, but overlapping wildcard policies can incorrectly block authorized destinations. Fix that translation before merging; the pending checks must also complete successfully. Score: 6/10 🤖 Review Details
Copy and edit to choose records from this review: 🤖 Review by ProPR |
|
✅ Applied the requested follow-up changes in commit f1efdea
Summary of ChangesFixed F1. With both The regression failed before the fix and passed afterward. It also verifies that Review digestRisk-tiered paths
Diff size: 3 files changed, +16/−3 lines 🤖 Implementation Details
💡 ProPR Slash Commands
🤖 Generated by ProPR |
Fixed F1. With both `*.example.com` and `*.service.example.com` on the allowlist, the generated Sprites policy now preserves access to `service.example.com` and still denies `example.com`. Updated the execution-safety documentation to match. The regression failed before the fix and passed afterward. It also verifies that `*.example.com` cannot authorize `otherexample.com`. All 36 relevant tests passed, along with lint and `git diff --check`. Verification used the fake Sprites client. PR: #3793 Comment by: @propr-ultrafix (ID: 0) Model: GPT-6.2 Astra ProPR-Agent: codex/gpt-6.2-astra
|
✅ AI Code Review Complete requested by @propr-ultrafix Posted 1 review: |
🔍 AI Code Review — codex:gpt-6-astraOverall EvaluationThe PR adds Sprites restricted networking through DNS policies and carries the granted MCP endpoint into the allowlist. The change is focused and appears merge-ready within the supplied review scope. Current checks report 24 passed, none failed or pending. ✅ Policy verification before launch — Restricted policies are applied and read back before uploading run data; mismatches reject startup. ✅ Explicit compatibility limits — Named networks and unsuitable MCP endpoints are refused, while documentation explains port enforcement and IP-literal limitations. ✅ Cleanup coverage — Tests cover policy clearing, reuse for open runs, and replacement when clearing fails. Merge blockersNo merge blockers. SuggestionsThese are optional follow-ups and are not sent to S2: 🟢 Test cancellation during policy applicationAdd a deferred-policy-update test that cancels startup while S3: 🟢 Exercise the live policy contractAn opt-in live Sprite test would strengthen confidence in wildcard precedence, policy read-back normalization, denied connections, and clearing before reuse. The fake client verifies local sequencing but simply stores the submitted rules; it cannot validate enforcement by Sprites. This is additional integration evidence, not a verified defect in the diff. ScoreThe implementation is scoped, documents its limitations, and includes useful lifecycle tests with passing current checks. Review was static, using the supplied code; no commands or tests were run. Score: 8/10 🤖 Review Details
Copy and edit to choose records from this review: 🤖 Review by ProPR |
|
/ultrafix goal=8 max=4 Independent maintainer review. I verified these in the code at f1efdea; fix them before merge. BLOCKERS
ALSO FIX (small) |
|
🔄 Ultrafix loop started (goal: 8/10, max cycles: 4) First action:
|
|
✅ AI Code Review Complete requested by @integry Posted 1 review: |
🔍 AI Code Review — codex:gpt-6-astraOverall EvaluationThis PR adds Sprites restricted networking through DNS policies and a runtime-specific MCP endpoint. It needs changes before merge: cleanup opens egress before removing run data, open runs gain incompatible URL restrictions, and transport planning accepts endpoints that execution rejects. ✅ Policy verification before launch — Restricted policies are applied and read back before uploading run data or launching the agent. ✅ Wildcard boundary handling — The translation protects bare wildcard zones while accounting for broader wildcard coverage, with focused tests. ✅ Cleanup verification — Policy clearing is verified and failures discard the Sprite. The supplied live result confirms cleared-policy readback works; preserve that check. The change is proportionate to its objective. Current checks report 24 passed, 24 neutral/skipped, and no failures. The findings below use static traces of the supplied code; no commands or tests were run during this review. Merge blockersEvery finding below was introduced by this PR and must be resolved before merging. F2: 🔴 Keep restrictions until checkpoint restoration
F3: 🔴 Preserve open-run endpoint compatibility
F4: 🔴 Reject incompatible endpoints before minting grants
SuggestionsThese are optional follow-ups and are not sent to S4: 🟢 Detect policy drift on releaseRetain the applied policy and compare it with readback before cleanup changes it; report discrepancies and discard the Sprite. The current boolean S5: 🟢 Reuse shared networking helpersUse S6: 🟢 Improve private-host diagnosticsReject the additional private-name suffixes identified in the review when validating restricted MCP endpoints. This would catch obvious configuration mistakes earlier. Actual DNS reachability cannot be established from suffixes alone, and the supplied implementation already relies on Sprites to block private addresses. S7: 🟢 Document shared-IP limitationsExpand “Weaker than Docker” to explain the shared-IP/CDN and domain-fronting limitation identified in the maintainer review. This would make the DNS enforcement boundary clearer alongside the existing port and denied-connection limitations. ScoreThe implementation has focused coverage and passing current checks, but the cleanup security window and two endpoint-flow regressions prevent merge. The corrections can remain localized. Score: 5/10 🤖 Review Details
Copy and edit to choose records from this review: 🤖 Review by ProPR |
|
✅ Applied the requested follow-up changes in commit 9271e1f
Summary of ChangesAddressed F2–F4 on PR #3793.
All 189 focused tests passed, along with typechecking and lint for the changed implementation files. The fake Sprite tests cover a pending restore and cleanup failures. Live verification remains with the maintainer. Review digestRisk-tiered paths
Diff size: 14 files changed, +158/−52 lines 🤖 Implementation Details
💡 ProPR Slash Commands
🤖 Generated by ProPR |
Addressed F2–F4 on PR #3793. - **F2:** Restricted Sprites keep their policy through restart, `/tmp` cleanup, and completed checkpoint restoration. Release then clears the policy and verifies the existing `{"rules":[]}` readback before reuse. A failed release step discards the Sprite. - **F3:** Open runs again accept HTTP, IP-literal, single-label, and `.internal` MCP endpoints. Private-network grants remain refused. - **F4:** Transport planning and launch now use the same restricted-mode endpoint check. Both report and action jobs reject incompatible endpoints before requesting a grant, and the capability report reflects the configured network mode. All 189 focused tests passed, along with typechecking and lint for the changed implementation files. The fake Sprite tests cover a pending restore and cleanup failures. Live verification remains with the maintainer. PR: #3793 Comment by: @propr-ultrafix (ID: 0) Model: GPT-6.2 Astra ProPR-Agent: codex/gpt-6.2-astra
|
✅ AI Code Review Complete requested by @propr-ultrafix Posted 1 review: |
🔍 AI Code Review — codex:gpt-6-astraOverall EvaluationThe PR implements restricted Sprites networking with policy application and read-back before launch, plus MCP endpoint validation during grant planning. The current diff addresses the three previously identified blockers. It is merge-ready within the reviewed scope, conditional on the pending validation check. ✅ Cleanup ordering corrected — Release retains restrictions through restart, ✅ Open-mode compatibility preserved — Strict MCP URL validation now occurs only while constructing a restricted policy. ✅ Earlier admission refusal — Restricted Sprites grant planning validates the endpoint before requesting a grant, and both automation phases now establish their policy scope before grant planning. This assessment uses static tracing of the supplied diff and context; no commands or tests were run. The supplied current-head status reports 23 passed checks, one pending, and no failures. Merge blockersNo merge blockers. SuggestionsThese are optional follow-ups and are not sent to S8: 🟢 Detect policy changes during execution
S9: 🟢 Reuse shared network helpers
S10: 🟢 Improve private-endpoint diagnostics
S11: 🟢 Explain shared-IP enforcement limitsThe “Weaker than Docker” paragraph explains port broadening and raw-IP restrictions but leaves the shared-IP consequence implicit. Clarify that DNS-based address authorization does not provide Docker’s CONNECT-host enforcement and can permit traffic to other services sharing an allowed destination’s IP, including applicable domain-fronting scenarios. This would help operators understand the documented enforcement model without implying equivalent host isolation. ScoreThe implementation has focused lifecycle and admission coverage, and the current diff resolves the demonstrated earlier regressions. No additional merge blocker was established from the supplied code; external enforcement behavior remains supported by the provided live-test report rather than independent execution in this review. Score: 8/10 🤖 Review Details
Copy and edit to choose records from this review: 🤖 Review by ProPR |
|
/ultrafix goal=8 max=3 The three blockers from my review are fixed and verified live at 9271e1f. A restricted run allowed example.com (200) and blocked wikipedia.org and 1.1.1.1; after the checkpoint restore the policy read back as {"rules":[]}; the next open run had full egress. The small items from #3793 (comment) were skipped; please do them now: |
|
🔄 Ultrafix loop started (goal: 8/10, max cycles: 3) First action:
|
|
✅ AI Code Review Complete requested by @integry Posted 1 review: |
🔍 AI Code Review — codex:gpt-6-astraOverall EvaluationThe PR adds restricted Sprites networking with policy verification, MCP endpoint planning, and cleanup before reuse. It needs minor changes before merge: the six explicitly requested follow-ups remain absent from the supplied current diff. ✅ Verified startup policy — The runtime applies and reads back the policy before uploading run data or launching the agent. ✅ Confined cleanup — Release clears restrictions only after checkpoint restoration completes; the added tests cover cleanup failures and disposal. ✅ Scoped grant planning — Both processors now request MCP grants inside the launch’s network-policy scope, with corresponding regression coverage. The authoritative checks show 24 passed and 24 neutral/skipped, with no failures or pending checks. This review is a static analysis of the supplied code; no commands or tests were run. Merge blockersEvery finding below was introduced by this PR and must be resolved before merging. F5: 🔴 Implement the requested release tamper check
F6: 🔴 Use the shared restricted environment defaults
F7: 🔴 Reuse shared host normalization
F8: 🔴 Reject all requested private MCP suffixes
F9: 🔴 Document the shared-IP egress limitation
F10: 🔴 Log release failures before replacement
SuggestionsThese are optional follow-ups and are not sent to No suggestions. ScoreThe core implementation has useful regression coverage and passing checks, but all six explicit follow-up requirements remain unimplemented. These appear addressable with localized changes. Score: 6/10 🤖 Review Details
Copy and edit to choose records from this review: 🤖 Review by ProPR |
|
✅ Applied the requested follow-up changes in commit 937fc7d
Summary of ChangesImplemented F5–F10 for PR #3793. Restricted Sprite release now verifies the applied policy before credential export or cleanup. A mismatch records a run diagnostic, logs the run and Sprite identities, and discards the Sprite. Release failures log the failed step and error before replacement. Sprites now uses the shared per-agent environment defaults and host normalization, preserves configured values, and rejects all five private MCP suffixes. The execution safety guide documents the shared-IP and domain-fronting limitation and Docker’s CONNECT hostname check. All 60 focused tests passed. Core typechecking and lint on the changed core files passed. Verification used the fake Sprites client. Review digestRisk-tiered paths
Diff size: 8 files changed, +193/−51 lines Visual previewRestricted mode on Fly SpritesExecution safety guide showing release verification and the shared-IP limitation. 🤖 Implementation Details
💡 ProPR Slash Commands
🤖 Generated by ProPR |
Implemented F5–F10 for PR #3793. Restricted Sprite release now verifies the applied policy before credential export or cleanup. A mismatch records a run diagnostic, logs the run and Sprite identities, and discards the Sprite. Release failures log the failed step and error before replacement. Sprites now uses the shared per-agent environment defaults and host normalization, preserves configured values, and rejects all five private MCP suffixes. The execution safety guide documents the shared-IP and domain-fronting limitation and Docker’s CONNECT hostname check. All 60 focused tests passed. Core typechecking and lint on the changed core files passed. Verification used the fake Sprites client. PR: #3793 Comment by: @propr-ultrafix (ID: 0) Model: GPT-6.2 Astra ProPR-Agent: codex/gpt-6.2-astra
|
✅ AI Code Review Complete requested by @propr-ultrafix Posted 1 review: |
🔍 AI Code Review — codex:gpt-6-astraOverall EvaluationThe PR implements restricted Sprites networking and the requested follow-ups coherently. It is merge-ready within the reviewed scope, conditional on the pending Validate Changes check completing successfully. This review used static analysis of the supplied diff and context; no commands or tests were run. ✅ Fail-closed startup — The runtime applies and verifies the policy before uploading run data, discarding a Sprite when verification fails. ✅ Protected reuse — Release checks for policy changes before credential write-back, preserves restrictions through cleanup and checkpoint restoration, and verifies the cleared policy before reuse. ✅ Focused follow-ups — Shared hostname normalization and environment defaults are reused, private MCP suffixes are refused, and documentation explains domain-fronting limitations. Merge blockersNo merge blockers. SuggestionsThese are optional follow-ups and are not sent to S12: 🟢 Cover release read failuresConsider adding a test where ScoreThe implementation addresses the requested behavior with focused lifecycle tests and clear documentation. Current checks report 24 passed, none failed, and one pending; no merge-blocking defect was established. Score: 9/10 🤖 Review Details
Copy and edit to choose records from this review: 🤖 Review by ProPR |
Maintainer verification at 937fc7d
|

AI Implementation Summary
Closes #3766
Branch:
3766/claude-opus-5-5-sprites-network-policy-fo-20261124-2108-xkvCommits: ✅ Changes committed (0aacd0e)
AI Processing Completed
Execution Details:
Summary:
SpritesRuntime now enforces restricted mode with the Sprite's DNS allowlist policy instead of refusing every restricted run. It also declares the capability, so admission accepts these runs. Typecheck and lint pass on
packages/core/src/agents/runtime. The new and existing Sprites, runtime-registry, MCP-grant and tool-policy tests pass (120, 0 failures). The fake Sprites client is not the real API, though: the policy rule format, the read-back check and the reset after a run have not been run against a live Sprite.Restricted mode (new file
sprites/spritesNetwork.ts)*.zonecovers subdomains only. Sprites' docs don't say whether their*.zonealso covers the bare zone, so the bare zone gets an explicit deny unless it's listed itself./tmpand restores the checkpoint. A Sprite whose policy can't be cleared is destroyed and replaced, never reused. Open runs don't touch the policy.CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1unless their configuration already sets it, as on Docker.This is weaker than Docker in two ways:
MCP reachability
PROPR_SPRITES_MCP_URLsetting, for a public ProPR origin or a Connect gateway. It takes priority for Sprites; otherwise the existing fallback applies (PROPR_AGENT_MCP_URLorAPI_PUBLIC_URL+/api/mcp).localhost, a single-label name such asapior plain HTTP are refused.AgentRunMcpGrant.url), which is how the MCP host gets into the allowlist.Not done: Sprites Connectors as a credential source, the optional item. I couldn't check whether git-over-HTTPS works through the GitHub connector from here, so I left it out and added no connector settings, although the issue's Implementation note suggested adding them. The docs say Connectors aren't used yet.
Docs and config
execution-safety.mdhas a new "Restricted mode on Fly Sprites" section covering the trust model and the limits above.agent-runtime.mdand.env.exampleare updated.registry.tsnow names both docker and sprites as runtimes that can enforce it.Tests
test/spritesNetworkPolicy.test.ts.test/helpers/fakeSprites.ts(it now has the network-policy calls) and one expectation intest/agentRuntimeNetworkCapability.test.ts(the grant now includes its URL).The change has no visual output, so there are no previews.
Review digest
Risk-tiered paths
.env.example(+2/−0)packages/core/src/agents/runtime/agentRunMcpTransport.ts(+13/−0)packages/core/src/agents/runtime/agentRunSpec.ts(+3/−0)packages/core/src/agents/runtime/registry.ts(+1/−1)packages/core/src/agents/runtime/sprites/spritesNetwork.ts(added, +90/−0)packages/core/src/agents/runtime/sprites/spritesProvisioning.ts(+9/−1)packages/core/src/agents/runtime/spritesRuntime.ts(+14/−4)packages/core/src/agents/runtime/types.ts(+5/−0)docs/docs/architecture/agent-runtime.md(+1/−1)docs/docs/features/execution-safety.md(+13/−0)test/agentRuntimeNetworkCapability.test.ts(+1/−1)test/helpers/fakeSprites.ts(+10/−0)test/spritesNetworkPolicy.test.ts(added, +104/−0)Diff size: 13 files changed, +266/−8 lines
View task for the run's logs and conversation.
This PR was created automatically by ProPR after processing issue #3766.
💡 Need changes?
Comment on this PR to request refinements — the AI agent monitors comments and will update the implementation based on your feedback. Keep iterating until you're satisfied!