Skip to Content
ConceptsNetwork policy

Network policy

Decide exactly which internet addresses your agents can reach. Every outbound call from a space passes through Marshal and is checked against an ordered list of rules. Anything the rules do not allow is blocked and recorded, so an agent cannot quietly send your code somewhere new or download from a source you never approved.

What you can do with it

  • Unblock a new dependency in seconds. The agent runs pip install and the request to files.pythonhosted.org is blocked. The space page shows a banner. Click Approve, the install succeeds on the next try, and the approval is recorded in the audit log.
  • Make it stick for next time. Choose Approve & remember for next run instead. The address goes into your manifest’s allow list, so every new space from that manifest can reach it.
  • Lock a stack down. An admin attaches a strict policy to the production stack, with deny rules for paste sites and self-service additions turned off. Every manifest on that stack inherits it.

See it end to end: Let agents use secrets they never see.

How it fits

  • A network policy is a named set of rules plus a Default action, allow or deny. Admins and owners manage policies on the Network policies page. Members can see them.
  • Each organization has a built-in default policy that denies by default. Every new stack gets it automatically. Admins can edit its rules, but cannot delete it. They can also create other policies and attach one to any stack.
  • Each package declares the hosts its tools need, and Marshal allows them for every space that includes the package. Some packages exist only to allow addresses, such as egress-vscode for VS Code Remote-SSH.
  • Each manifest has its own allow list, for addresses you chose to allow in your spaces.

How a request is checked

Marshal builds one ordered rule list for each space when it starts. The first rule that matches the request decides. If no rule matches, the policy’s default action decides.

An allow can come from the stack’s policy, a package or your allow list. A blocked request shows in a banner on the space page, with Approve and Approve & remember for next run.

The order is:

  1. Deny rules from the stack’s policy. An admin’s deny always comes first. No package and no allow list can reopen a host the policy denies.
  2. Allow rules from the stack’s policy.
  3. Hosts that packages declare, including the database hosts of database packages.
  4. Your manifest’s allow list.
  5. The default action of the stack’s policy, for everything else. A stack without a policy denies everything else.

Changes reach running spaces in seconds

Save a policy and every running space on a stack that uses it picks up the change within seconds. No restart, no reconnect.

  • The save tells you how far it is going. The toast reads Saved. Sending to N spaces. for the N running spaces the change is on its way to.
  • The policy page tracks it. Under the policy, a status line shows Sending latest changes to running spaces, then Confirming the latest changes while spaces report back, then Latest changes sent to running spaces, with the counts: targeted (how many spaces it is being sent to), applied (how many reported applying it) and failed (how many could not be reached). A space that received the change without reporting back is counted as not confirmed. When any space could not be reached, the line reads Latest changes reached some running spaces. A newer save replaces an older one, and the line says Replaced by a newer save.
  • Each space records it. The space’s Blocked panel shows a line, Network policy “name” updated by the admin who saved it, with the time, so the people working in the space know the rules changed and who changed them.
  • A stopped space starts with the current policy. When it resumes, it enforces the policy as it is now, including a deny you saved while it was stopped. This holds whatever your organization’s refresh-on-resume setting is. If the current policy can’t be applied at that moment, Marshal declines the resume and the space stays stopped. Try again shortly.
  • End open connections when a rule tightens. Tick Also end open connections when you save or delete a policy, and connections that are already open to hosts the rules now deny end within seconds: tunnels, raw TCP, SSH, and server-sent-event and WebSocket streams. Connections to hosts that are still allowed keep running, and a long download on a decrypted connection finishes on its own terms. Every new request and every new connection follows the new rules either way. The switch starts off each time, and it needs the same permission as the save. The policy page reports the result, for example Open connections ended: 7 in 2 spaces (4 of 5 spaces reported), and each space’s audit log records what ended. A space that is offline or runs an older supervisor counts as not reported.

Inbound access to a space

Outbound rules are one half of the isolation. The other half is who can reach a space.

  • A space’s SSH port accepts only connections that Marshal opens for it. Each connection carries a single-use credential tied to that space, so the CLI, VS Code, sshfs, the web terminal and previews work as always, and nothing else gets a shell.
  • On Helm installs, on clusters that enforce Kubernetes NetworkPolicy, a space’s SSH port is also reachable only from the gateway and the api, and the bundled Redis only from the api, the gateway and space pods.

Refused connections appear in the space’s audit log as ssh.refused, with the peer address and the reason. Repeats from the same peer are counted together in one entry.

Lookups follow the same rules

A name lookup is a way to send data out, so Marshal applies your policy to it too. Every DNS query from a space, including queries from tools that name their own resolver and from containers in the Docker sidecar, goes through the same check as a connection.

  • Names your policy allows resolve as usual.
  • Names your policy blocks do not resolve to a usable address. The tool still tries to connect, and that attempt shows up as a blocked request with the usual Approve. Approve it and the next lookup works, with no restart.
  • Record types that can carry data, such as TXT, are refused in restricted spaces. Lookups for addresses are unaffected.
  • Blocked and refused lookups are recorded in the audit log as DNS blocked and DNS refused, with the name, record type and count. In a space whose policy allows everything, lookups that look like data smuggling are recorded as DNS flagged and are never blocked.

Lookups to the cluster’s own services always work, so spaces reach what runs next to them.

Clusters with a custom DNS setup

If your cluster resolves names through NodeLocal DNSCache or Cloud DNS, an org admin lists those resolver addresses under Extra DNS resolvers in the organization configuration (Security group). New spaces can then use them, and the policy check applies to every lookup that goes through them.

Writing a host pattern

A rule matches the hostname only, with no path or port. * matches any characters, dots included, so *.example.com covers every subdomain of example.com, however deep. Write example.com as its own entry to allow the bare domain too. A git@ or ssh:// prefix asks for SSH to that host.

Patterns match the same way for web traffic and for other TCP connections such as SSH and database ports: full glob matching, ignoring case. A rule like *.dkr.ecr.*.amazonaws.com covers every region for both. A rule set with no default action blocks whatever no rule matches, for web and TCP traffic alike.

Wherever Marshal shows a pattern, in a policy, a manifest’s allow list or a package’s hosts, it marks one that does not do what it reads like and suggests the right form:

  • Matches more than it looks like (amber): *example.com also matches evilexample.com, which anyone can register. Write *.example.com and example.com instead. A bare * allows every host.
  • Matches nothing (grey): a leading dot such as .example.com, a path, a port or a user name in the pattern. The entry is listed but allows no traffic.

The marks are advice. Saving always goes through, so a policy you rely on keeps working while you tidy it.

Be careful with a wildcard over a domain that anyone can host name servers for, such as a free dynamic-DNS suffix. A rule like *.dyn.example.net lets an agent look up, and so send data to, names that someone else controls. Allow the specific hosts you need instead.

When something is blocked

The Blocked panel on the space page lists each blocked address, and each item says why it was blocked:

  • Blocked by rule names the rule that matched and the policy it lives in, with the source in brackets, such as (stack policy). Sources are: stack policy, package allow-list, database connection, manifest allow list, user approval or space rule.
  • No rule matched: the policy’s default is deny means nothing allowed the address, so the default action blocked it.

The panel checks each item against the policy as it is right now. If the address has been allowed since, the item shows Now allowed.

Approve appears only when the default action blocked the address and the stack allows self-service additions. That is the case where adding an allow rule is the fix. Otherwise the item says what to do instead:

  • Only an admin can change this. A deny rule blocked the address by name. Nobody can approve past a deny rule from the panel. An admin removes or narrows the rule on the Network policies page, and admins see an Open policy link on the item that takes them there.
  • Self-service additions are off for this stack. The stack’s policy keeps additions with admins.

When Approve is there, you have two choices:

  • Approve allows the address for this space only. It is stored as an extra rule on that space, so other spaces and the manifest stay untouched, and a deny rule from the stack still wins. It applies right away and lasts for the life of the space, through stop and resume.
  • Approve & remember for next run also saves the address to your manifest’s allow list. Future spaces from that manifest can reach it, behind the stack’s deny rules.

A policy can permit or forbid self-service additions. When it forbids them, the Blocked panel shows Self-service additions are off for this stack. in place of Approve, and any other change that adds access is refused too: the same additions made through the API or CLI, edits to a running space’s network policy, and new entries in a manifest’s allow list. A refusal names the address and tells you to ask a stack admin, who adds it to the policy instead. This holds for admins too. Removing a deny rule, or narrowing one so it blocks less, counts as adding access and is refused too. A network policy must set its Default action to allow, deny or passthrough; an empty value is refused, and wherever a default action is empty, it means deny. Removing an allow rule, reordering rules that do not change what is reachable, or saving the policy unchanged still works.

Think before you approve. A remembered address applies to every new space from that manifest. Blocked tools and database commands have their own approval prompts in the same banner.