feat: add FirewallConfig and integrate with SandboxNetwork and ProxyC…#170
Conversation
…onfig - Introduced FirewallConfig model to specify network lockdown rulesets. - Updated SandboxNetwork to include firewall configuration and subnet attributes. - Enhanced ProxyConfig to support allowed and forbidden domains. - Added tests for FirewallConfig and its integration with SandboxNetwork and ProxyConfig. This change improves the network configuration capabilities for sandbox environments.
🧪 Testing GuideWhat this PR addressesIntroduces a new Steps to reproduce / exercise the new behavior
What to verify (expected behavior)
Note Posted by PR Testing Guide · Tag @mendral-app with feedback. |
🔍 PR Interaction DiagramHere's a sequence diagram showing how the new sequenceDiagram
participant Client
participant SandboxNetwork
participant FirewallConfig
participant ProxyConfig
Note over SandboxNetwork: Configuration Phase (from_dict)
Client->>SandboxNetwork: from_dict(raw_config)
SandboxNetwork->>FirewallConfig: from_dict(firewall_data)
FirewallConfig-->>SandboxNetwork: FirewallConfig(rulesets=["proxy"])
SandboxNetwork->>ProxyConfig: from_dict(proxy_data)
Note over ProxyConfig: Now includes allowed_domains & forbidden_domains
ProxyConfig-->>SandboxNetwork: ProxyConfig(allowed_domains, forbidden_domains, ...)
SandboxNetwork-->>Client: SandboxNetwork(firewall, proxy, subnet)
Note over SandboxNetwork: Serialization Phase (to_dict)
Client->>SandboxNetwork: to_dict()
SandboxNetwork->>FirewallConfig: to_dict()
FirewallConfig-->>SandboxNetwork: {"rulesets": [...]}
SandboxNetwork->>ProxyConfig: to_dict()
ProxyConfig-->>SandboxNetwork: {"allowedDomains": [...], "forbiddenDomains": [...], ...}
SandboxNetwork-->>Client: Full config dict (camelCase for API)
Note over FirewallConfig,ProxyConfig: Runtime Enforcement
Client->>SandboxNetwork: Apply network config to sandbox
SandboxNetwork->>FirewallConfig: Enforce ruleset ("proxy")
Note over FirewallConfig: Network-level egress lockdown<br/>(cannot be bypassed by unsetting env vars)
SandboxNetwork->>ProxyConfig: Apply domain filtering
Note over ProxyConfig: allowed_domains takes precedence<br/>over forbidden_domains
Summary of Flow
Key design point: The Note Posted by PR Sequence Diagram · Tag @mendral-app with feedback. |
|
📋 Created Linear issue ENG-3079 — status: In Progress
Auto-created because no Linear reference was found in the PR title, description, or branch name. Note Posted by Linear Issue Enforcer · Tag @mendral-app with feedback. |
There was a problem hiding this comment.
LGTM
Code follows existing patterns consistently. The from_dict nested-pop pattern for camelCase/snake_case fallback is correct (eager evaluation ensures both keys are cleaned from additional_properties). No correctness or security issues found.
CI Failures: All 8 failing jobs hit SandboxAPIError: You don't have access to workspace... during sandbox creation — a known transient API permissions issue (insight), not caused by this PR. Safe to re-run.
Tag @mendral-app with feedback or questions. View session
Fixes ENG-3079
This change improves the network configuration capabilities for sandbox environments.
Note
Adds
FirewallConfigmodel for network lockdown rulesets, extendsSandboxNetworkwithfirewallandsubnetfields, and addsallowed_domains/forbidden_domainstoProxyConfig. Includes unit tests for round-trip serialization.Written by Mendral for commit 0e7b2fe.