OutboundPolicy
OutboundPolicy is a Sandbox's route-based outbound network policy.
Routes are evaluated in order, and the first route that matches decides what happens to the traffic: it goes to its original destination. The last route must be the policy's only OutboundRouteAny, which matches all traffic no other route matched and either lets it through or blocks it.
policy := modal.OutboundPolicy{
AllowTLSDecryption: true,
Routes: []modal.OutboundRoute{
modal.OutboundRouteHTTPS{
Domains: []string{"api.example.com"},
HeaderReplacements: []modal.OutboundHeaderReplacement{
{Secret: secret, Headers: map[string]string{"Authorization": "Bearer $API_TOKEN"}},
},
},
modal.OutboundRouteTLS{Domains: []string{"github.com", "*.github.com"}},
modal.OutboundRouteIP{CIDRs: []string{"203.0.113.0/24"}},
modal.OutboundRouteAny{Redirect: modal.OutboundBlock{}},
},
}type OutboundPolicy struct {
AllowTLSDecryption bool // AllowTLSDecryption allows Modal to decrypt the Sandbox's TLS traffic on routes that need it, by generating a certificate authority for the Sandbox and attempting to make the Sandbox trust it. It decrypts nothing on its own. OutboundRouteHTTPS requires it. It is fixed when the Sandbox is created. Sandboxes that allow TLS decryption don't support memory snapshots.
Routes []OutboundRoute
}