Skip to content

Package firewall

Coding agents install dependencies by name—often from docs or search results—making typosquats and freshly hijacked releases a real risk. Anastro’s package firewall runs on every Linux worker between machines and the internet, blocking known malware and holding back brand-new releases for a cooldown period.

It’s enabled by default, requires zero proxy configuration inside machines, and can only be turned off at the cluster config level.

Every machine’s web traffic (TCP 80 and 443) routes through anastro-egress on its host:

Hostname Action
registry.npmjs.org, registry.npmjs.com, registry.yarnpkg.com Inspected (npm)
pypi.org, files.pythonhosted.org Inspected (PyPI)
index.crates.io, static.crates.io Inspected (crates.io)
proxy.golang.org Inspected (Go)
rubygems.org, index.rubygems.org Inspected (RubyGems)
repo.maven.apache.org, repo1.maven.org Inspected (Maven Central)
cloudflare-ech.com (Encrypted Client Hello) Refused (hides the real hostname)
Everything else Passed through untouched and logged by hostname

For those registry hosts, anastro-egress terminates TLS using a per-machine CA constrained exclusively to those names, then applies three rules:

  • Malware: versions listed as malicious in OSV (MAL- advisories or CWE-506) are stripped from package listings, and direct downloads return 403 naming the advisory.
  • Cooldown: versions published less than 24 hours ago (configurable) are hidden from package listings so freshly compromised releases have time to be caught. Exact archive URLs still work if you explicitly pin them.
  • CVEs (non-malware): served normally and logged with their CVE IDs.

Registry-specific touches keep normal workflows smooth:

  • npm & Maven: latest / <latest> / <release> pointers slide back to the newest eligible version so unpinned installs still succeed.
  • crates.io: versions inside the cooldown are marked yanked rather than deleted so existing Cargo.lock files still build.
  • Go: refusals return 403 (never 404, which would cause go to bypass the proxy and fetch directly from VCS), and untagged @latest queries inside the cooldown are refused.
  • QUIC (HTTP/3, UDP 443): inspected for SNI and dropped for registry hosts so package managers fall back to TCP; all other QUIC traffic flows directly.

Sources outside the list above—git dependencies, GitHub release wheels, third-party Maven repos (Google, Gradle Plugin Portal, JitPack), and custom Go proxies—pass through unchecked. If a new registry is added in an Anastro upgrade, machines already running need a restart to pick up the updated CA constraint.

Normal installs look completely unchanged. When something is blocked:

  • Hidden versions (cooldown or malware) look like missing versions (npm error notarget No matching version found, or pip/uv reporting no matching distribution).
  • Direct malware downloads return 403:
    evil-pkg@1.0.0 is malware (MAL-2025-1234); the package firewall refused it
  • If OSV (api.osv.dev) is unreachable, checked requests fail closed with 503 unless you set fail_open = true.

Edit anastro.toml and run anastroctl cluster apply:

[machines.package_firewall]
enabled = true
cooldown = "1d" # "0s" disables the cooldown
cooldown_exempt = ["@acme/*", "acme-utils"] # skip cooldown for your own packages
fail_open = false # if OSV is down: false -> 503, true -> allow + warn
[machines.package_firewall.upstream] # optional mirrors or scanning proxies
npm = "https://registry.npmjs.org/"
pypi = "https://pypi.org/simple/"
pypi_files = "https://files.pythonhosted.org/"
crates_index = "https://index.crates.io/"
crates = "https://static.crates.io/"
go = "https://proxy.golang.org/"
rubygems = "https://rubygems.org/"
maven = "https://repo.maven.apache.org/maven2/"
Setting Default Effect
enabled true Toggle the firewall cluster-wide (Turn it off)
cooldown "1d" Minimum age (12h, 2d, or "0s" to disable) before a version appears in listings
cooldown_exempt [] Exact package names or * prefixes (@acme/*) exempt from the cooldown (still checked for malware)
fail_open false false fails with 503 when OSV is unreachable; true allows unchecked with a warning
upstream.* Public registries Override upstream URLs (http(s) ending in /) for mirrors or scanning proxies (upstream auth not supported yet)

Machines keep talking to the normal public registry hostnames—only anastro-egress contacts your configured upstreams.

[machines.package_firewall]
enabled = false

Apply the config. Each Linux worker’s host agent switches to plain NAT immediately without stopping running machines. There is no per-machine or per-project opt-out, and env vars inside a machine can’t bypass it. Turning it back on later takes effect for each machine on its next boot (once it gets its CA).

In the web UI, open a machine’s Machine tab → Package firewall to see malware blocks, hidden malware versions, and OSV-unavailable 503s (GET /v1/machines/{id}/package-refusals returns the same list). Cooldown-filtered versions aren’t shown there, only in worker logs.

Stream the full log from any worker (machines are identified by ID—match with anastroctl machine list):

Terminal window
anastroctl node logs -n w1 egress -f
Log message Meaning
connection Passed-through TCP connection (host, destination, bytes, duration)
checked Inspected registry connection
unchecked: the machine's CA predates this registry… Machine booted before this registry was added; restart it to enable checks
quic Allowed QUIC handshake with hostname
refused: QUIC to a registry or hidden… Dropped QUIC handshake to force TCP fallback
left out Version hidden from a listing (cooldown or malware: <ids>)
refused Blocked malware download (403) or OSV outage (503)
served with known vulnerabilities Served package with non-malware CVEs
OSV unavailable: allowed unchecked OSV unreachable while fail_open = true
refused: encrypted client hello Blocked ECH connection hiding its SNI
refused: a registry connection from no known machine Unrecognized source IP
the QUIC queue: machines' QUIC is dropped until it's back Proxy couldn’t read the QUIC queue; clients fall back to TCP
TLS with the machine failed… Client inside the machine ignored system CA certificates

Inside machines, SSL_CERT_FILE, NODE_EXTRA_CA_CERTS, and REQUESTS_CA_BUNDLE all point to /etc/ssl/certs/ca-certificates.crt (which trusts the machine’s CA), so curl, OpenSSL, uv, pip, Node, Bun, Go, and Cargo work out of the box. Common edge cases:

Symptom Cause Fix
TLS errors on registry hosts inside Docker builds or Nix downloads The container or tool uses its own CA bundle Mount or copy /etc/ssl/certs/ca-certificates.crt into the container
Just-published internal package isn’t found Cooldown period Add it to cooldown_exempt, or pin its exact URL
Active web connections drop across a worker anastro-egress restarted (upgrade or manual restart) Clients retry automatically (QUIC and hostagent restarts aren’t affected)
QUIC-only client fails against a registry Registry QUIC is dropped to force TCP inspection Use TCP for package registries
Machine isn’t being checked after enabling the firewall Machine booted while the firewall was off Restart the machine
Installs fail with 503 (“couldn’t reach OSV”) Worker can’t reach api.osv.dev Allow outbound HTTPS to api.osv.dev (Ports) or set fail_open = true
bundle install re-fetches /info files Filtered responses no longer match RubyGems checksums Expected—only filtered gems re-fetch
Poetry installs a version inside the cooldown Poetry reads PyPI’s JSON API, which isn’t filtered yet Known limitation; downloads are still malware-checked

For the full design—redirect rules, per-machine CA migration across live moves, and OSV rules—see the package firewall spec.

Recovery.