fix(sandbox): allow egress to the app's data stores (Postgres/Redis/MySQL) #143
No reviewers
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
gmackie/ForgeGraph!143
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/sandbox-db-egress"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Found while cutting agent 0.1.38: npm-registry publishes returned 500 because the in-netns egress policy (PR #138, restricted default DNS/80/443) dropped the registry's token-auth Postgres queries to hetzner-master over Tailscale (7030 dropped packets on the counter). Reads kept working (anonymous, no DB), so the outage was invisible until the first publish attempt after the registry moved onto the in-netns egress path.
Fix: deploy parses data-store connection URLs (
postgres/postgresql/mysql/redis/rediss) out of the merged deployment env, maps loopback hosts to the veth host IP (mirroringrewriteLoopbackEnvForSandbox), resolves hostnames, and renders per-addressip[6] daddr <ip> tcp dport <port> accept # data storerules that apply even under the restricted default — platform-provisioned bindings are always reachable. Resolution failures skip the rule (deploy proceeds; the app surfaces its own connectivity error).TDD red-first:
datastores_test.go(URL parsing, loopback mapping, resolution w/ fake lookup, dedupe, IPv6) +TestGenerateNftRulesDataStores. Full agentgo test ./...green.Operator action already applied (flagged per convention): hand-inserted
ip daddr 100.101.32.120 tcp dport 5432 acceptinto thefg-npm-registrynetns on hetzner-fg to unblock publishing now. That rule is ephemeral (wiped by next redeploy/reconcile) — after this merges and ships in 0.1.38, npm-registry needs one redeploy to persist the rule into its reboot-reconcile state.🤖 Generated with Claude Code