Skip to content

Introduce stateful "in TARGET" and "out TARGET" rules - #188

Merged
fkorotkov-oai merged 1 commit into
mainfrom
dev/edi/flows
Aug 3, 2026
Merged

Introduce stateful "in TARGET" and "out TARGET" rules#188
fkorotkov-oai merged 1 commit into
mainfrom
dev/edi/flows

Conversation

@edi-oai

@edi-oai edi-oai commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

This allows us to have more granular network filtering policies, improving the security offered by --allow and --block.

For example, under a default-deny policy, @host previously allowed a VM to initiate connections to the host; now in @host can prevent that, and the same applies to CIDR targets.

This PR opts not to implement a full-fledged connection tracker, favoring security and simplicity over availability.

@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: c2df74a993

ℹ️ 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 lib/proxy/host.rs
Comment on lines +103 to +104
None => {
self.admit_with_tracking_if_stateful(pending, ipv4_pkt.src_addr(), Direction::Out)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Track default-allowed inbound flows from private peers

When any directional rule enables flow inspection, an inbound TCP or UDP packet from an unmatched private peer reaches this None branch but is committed only if an explicit outbound rule also matches. The initial packet is therefore allowed, but the VM's reply has no flow entry and is rejected by the normal egress fallback because the peer is neither global, the gateway, nor an approved DNS server; for example, adding an unrelated in @host rule makes otherwise default-allowed connections from LAN addresses unable to complete. Track the pending flow when the reverse packet would otherwise be denied by the built-in egress policy as well.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This is intended to preserve legacy behavior, where inbound packets are accepted by default, but replies to unmatched private peers (for example, 192.168.0.0/16) remain subject to the built-in egress policy and are denied unless explicitly allowed.

@fkorotkov-oai
fkorotkov-oai merged commit cdc2a50 into main Aug 3, 2026
2 checks passed
@fkorotkov-oai
fkorotkov-oai deleted the dev/edi/flows branch August 3, 2026 15:33
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