preNetwork, ctx.bytesSent).
How it applies
pre_network runs before each connection carries a byte, whoever opens it:
curl, git, a CLI, a mount’s VFS, a runtime or an SDK. The workspace’s
network lists judge it first, and
a connection they refuse reaches no policy.
The URL is not there: under HTTPS only the program and the server see it.
post_network runs once the connection is over, for each policy that let it
through, and only observes.
Example: refuse a large clone
ctx.words holds the URL a git clone names, so a policy can look the
repository up before a byte of the clone moves, and refuse one past 96 MB:
strukto-ai/mirage at 151 MB, so its clone is refused before
it starts:
decision: strukto-ai/mirage is over 96 MB.
A lookup that fails raises, and a policy that raises refuses, so a
rate-limited lookup never lets a clone through.
Example: a byte budget
Together the two hold a workspace to a byte budget:Machines and browsers
- A program on a machine connects from that
machine, and no policy sees its connections. A
hostmachine would connect around the gateway, so it refuses to run while a policy listens. - In a browser,
fetchis judged by host name with an emptyaddress. A request whose size the page cannot know (a form, a stream), a redirect and aWebSocketare refused while a policy listens.