Skip to content

Forbid target container from communicating with control plane#54

Merged
jaytaylor merged 2 commits into
mainfrom
jay/block-target-to-ctl-plane
Jan 16, 2026
Merged

Forbid target container from communicating with control plane#54
jaytaylor merged 2 commits into
mainfrom
jay/block-target-to-ctl-plane

Conversation

@jaytaylor
Copy link
Copy Markdown
Collaborator

fix(security): block target container from reaching leashd control plane API

This change blocks the target container from reaching the leashd control
plane API. Previously, a process running inside the target container could
potentially connect to leashd's HTTP API (default port 18080) and interact
with the control plane. This is a security boundary violation - a
compromised AI agent should not be able to access the policy management API.

How it works:
The iptables/nftables rule matches packets originating from the target
container's cgroup and destined for the leashd control port, then rejects
them with TCP reset. This blocks all interfaces (localhost, LAN, etc.)
since the rule targets the port regardless of destination IP.

Files changed:

  • internal/assets/apply-iptables.sh: Added iptables rule using cgroup
    matching to block target container from leashd port
  • internal/assets/apply-nftables.sh: Added equivalent nftables rule for
    systems using nftables
  • internal/assets/apply-ip6tables.sh: Added IPv6 equivalent rule
  • internal/leashd/runtime.go: Updated to pass leashd port and cgroup path
    to the firewall scripts
  • e2e/integration/integration_test.go: Added integration test
    'baseline/control-plane-isolation' to prevent regressions

Addresses and resolves GHSA-9x85-c42x-79cx.

…ane API

This change blocks the target container from reaching the leashd control
plane API. Previously, a process running inside the target container could
potentially connect to leashd's HTTP API (default port 18080) and interact
with the control plane. This is a security boundary violation - a
compromised AI agent should not be able to access the policy management API.

How it works:
The iptables/nftables rule matches packets originating from the target
container's cgroup and destined for the leashd control port, then rejects
them with TCP reset. This blocks all interfaces (localhost, LAN, etc.)
since the rule targets the port regardless of destination IP.

Files changed:
- internal/assets/apply-iptables.sh: Added iptables rule using cgroup
  matching to block target container from leashd port
- internal/assets/apply-nftables.sh: Added equivalent nftables rule for
  systems using nftables
- internal/assets/apply-ip6tables.sh: Added IPv6 equivalent rule
- internal/leashd/runtime.go: Updated to pass leashd port and cgroup path
  to the firewall scripts
- e2e/integration/integration_test.go: Added integration test
  'baseline/control-plane-isolation' to prevent regressions

Security: https://github.com/strongdm/leash/security/advisories/GHSA-9x85-c42x-79cx
@jaytaylor jaytaylor merged commit 61c46b2 into main Jan 16, 2026
1 check passed
@jaytaylor jaytaylor deleted the jay/block-target-to-ctl-plane branch January 16, 2026 01:19
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.

1 participant