Skip to content

Align Docker and Prime network policy modes - #2124

Merged
hallerite merged 9 commits into
mainfrom
agent/align-docker-prime-network-policies
Jul 28, 2026
Merged

Align Docker and Prime network policy modes#2124
hallerite merged 9 commits into
mainfrom
agent/align-docker-prime-network-policies

Conversation

@xeophon

@xeophon xeophon commented Jul 24, 2026

Copy link
Copy Markdown
Member

Overview

Align Docker and Prime execution-time network policy modes while preserving framework access for explicit framework-only policies.

Details

Empty allowlists and blocklists containing * normalize to a stable framework-only state. Framework-only access takes precedence during task/runtime composition, so later allow or deny entries cannot widen it.

Docker keeps framework routes as privileged proxy routes. Prime uses its normal allowlist path for framework-only and concrete allowlist modes, automatically adding framework hosts. Ordinary Prime denylists are passed through unchanged because the Prime API accepts either allow or deny rules, not exceptions combining both.

Non-empty concrete allowlists and ordinary blocklists remain mutually exclusive. Runtime and task policy documentation describes the shared composition and runtime-specific framework-route behavior.


Note

Medium Risk
Changes egress policy validation and task/runtime merge semantics in a security-sensitive path; the main behavioral break is rejecting mixed concrete allow+block configs at construction time.

Overview
Aligns Docker and Prime execution-time egress policy so both runtimes share the same mutually exclusive modes, normalization, and task/runtime merge rules.

NetworkPolicyConfig now normalizes empty allow or any block containing * to framework-only (allow=[], block=["*"]) and rejects non-empty concrete allow together with any block at config construction. with_task_network_policy treats framework-only as absorbing: if either side is framework-only, the merged policy stays framework-only instead of widening access.

Prime skips validate_egress_lists in framework-only mode and always deduplicates interception/MCP hostnames before building allowlist policy in prepare_execution. Docs (evaluation, Harbor, reference) describe shared composition, Docker framework-route precedence over denylists, and Prime ordinary denylists passing through unchanged (including possible blocks on framework hosts).

Breaking: configs that previously combined a concrete allowlist with a blocklist now raise ValueError when parsed.

Reviewed by Cursor Bugbot for commit 5b30069. Bugbot is set up for automated code reviews on this repo. Configure here.

Note

Align Docker and Prime network policy modes to reject mixed allowlist/blocklist configurations

  • Adds a @model_validator to NetworkPolicyConfig in base.py that normalizes empty allowlists or any blocklist containing * to framework-only (allow=[], block=["*"]), and raises ValueError when a non-empty concrete allowlist is combined with any blocklist.
  • Updates with_task_network_policy so framework-only is absorbing: if either side is framework-only, the result is framework-only; otherwise concrete allow and block lists are merged with deduplication.
  • Simplifies PrimeConfig._validate_egress in prime.py to skip validation in framework-only mode and normalizes wildcard/empty lists before calling validate_egress_lists.
  • Updates docs and reference files to document mutually exclusive modes, precedence rules (Docker framework routes take precedence over denylists; Prime passes ordinary denylists through unchanged), and task/runtime merge semantics.
  • Behavioral Change: previously valid configs combining a concrete allowlist with a blocklist now raise a ValueError at construction time.

Macroscope summarized 5b30069.

Comment thread verifiers/v1/runtimes/prime.py Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 08c9a63641

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread verifiers/v1/runtimes/base.py Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 860ec75954

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread verifiers/v1/runtimes/docker/__init__.py Outdated
Comment thread verifiers/v1/runtimes/docker/__init__.py Outdated
@macroscopeapp

macroscopeapp Bot commented Jul 24, 2026

Copy link
Copy Markdown

Approvability

Verdict: Needs human review

Unable to check for correctness in 5b30069. This PR modifies network policy validation and composition logic that controls egress filtering for sandboxed execution. Changes to security-relevant functionality like network access controls warrant human review to verify the intended behavior alignment between Docker and Prime runtimes.

You can customize Macroscope's approvability policy. Learn more.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a6716d9626

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread verifiers/v1/runtimes/prime.py Outdated

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit a6716d9. Configure here.

Comment thread verifiers/v1/runtimes/prime.py Outdated
Comment thread verifiers/v1/runtimes/prime.py Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 23e0ab53ae

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread verifiers/v1/runtimes/base.py
@xeophon
xeophon requested a review from mikasenghaas July 24, 2026 13:24
@xeophon
xeophon force-pushed the agent/align-docker-prime-network-policies branch from b7e93ab to a3342a1 Compare July 27, 2026 13:27
@xeophon
xeophon requested a review from hallerite July 27, 2026 16:37
hallerite
hallerite previously approved these changes Jul 28, 2026

@hallerite hallerite left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@hallerite
hallerite force-pushed the agent/align-docker-prime-network-policies branch from ee2e611 to 5b30069 Compare July 28, 2026 12:20
@hallerite
hallerite dismissed their stale review July 28, 2026 12:21

Superseded by verified signed commit 5b30069; approval will be resubmitted on the signed head.

@hallerite hallerite left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed verified signed head 5b30069. Network-policy composition looks sound, and the documentation now matches the Docker and Prime behavior.

@hallerite
hallerite merged commit d0bb0ff into main Jul 28, 2026
13 of 15 checks passed
@hallerite
hallerite deleted the agent/align-docker-prime-network-policies branch July 28, 2026 13:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants