Spend and protection

A monthly spending limit with alerts, under-attack mode for sites, bandwidth throttling, abuse detection and an emergency stop.

Available protection version 1.0.0 Part of Spend and abuse protection

Actions

11 actions, callable from the panel, the command palette and the API as POST /api/v1/a/<id>. Internal actions used between modules are not listed.

ActionWhat it doesRiskPreview
protection.settings.get Spend and protection settings (read) low No dry run
protection.settings.set Change spend and protection settings medium
protection.spend.get What is committed this month against the limit (read) low No dry run
protection.attack.list Sites and their under-attack state (read) low No dry run
protection.attack.set Switch under-attack mode on or off medium
protection.crawlers.status How old is the search engine crawler list? (read) low No dry run
protection.abuse.list Resource abuse findings (read) low No dry run
protection.bandwidth.get Bandwidth used this month (read) low No dry run
protection.emergency.get Is the emergency stop on? (read) low No dry run
protection.emergency.stop Emergency stop high
protection.emergency.resume Undo the emergency stop high

Permissions and limits

Permissions

  • protection.view See spending, protection and abuse findings
  • protection.manage Set the spending limit, policies and the emergency stop
  • protection.attack.site Switch under-attack mode on your own sites and see their bandwidth

Plan limits

  • protection.bandwidth_gb Outgoing traffic per month (throttled, never billed)

Engineering notes

Generated from modules/protection/docs.md at build 6e3a591e. These are the notes the engineers keep next to the code: precise, technical, and honest about what is not done yet.

Set a monthly spending limit, see sites in under-attack mode, watch bandwidth and unusual CPU use, and stop spending with one button. Spec: docs/specs/protection.md. CLI: rcctl protection spend get, protection settings set --json '{"spend_cap":200}', protection attack set --json '{"scope":"site","site_id":"...","on":true}', protection emergency stop / resume.

For other modules: ask sdk/spend before spending.

err := spend.Remote{Host: c.Host, Call: c}.Allow(ctx, spend.Cost{Kind: spend.KindServer, Monthly: price, Ref: name, Source: "autoscale"})
ok, reason, err := spend.Remote{...}.Check(ctx, cost)   // autoscaling's shape: refusal is ok=false with a plain reason

The module must list protection.spend.allow in system_calls.

Under-attack mode only challenges what a browser would show as a page: GET and HEAD requests that accept text/html. Calls with an Authorization or Signature header, JSON or other non-HTML requests, POST/PUT/DELETE, and API or webhook paths (/api/, /ai/, /credits/, /store/, /v1/, /webhooks/, /callback, /ipn) never get the puzzle, so licence and update checks, AI calls, apps and payment webhooks keep working. Those machine requests are still limited, by a looser API limit (20 requests a second per address, burst 60, 60 connections), while pages keep the strict one (2 a second, burst 5, 8 connections). Nothing to set: it follows the mode.

Cloudflare: when a site's domain sits on a Cloudflare connection, "I'm under attack" follows the mode through providers.zone.security.set (a system call bound to the account, audit 2026-10-20 002). The rest of Cloudflare's protection (firewall and rate limiting rules, managed rules, HTTPS, tunnels) is the providers module's providers.cf.* actions: see "Cloudflare security" in modules/providers/docs.md.

Other servers of the cluster: their addresses are exempt like this server's own. The scheduled task protection.peers.sync (hourly) asks each web node for its own addresses and hands every node the addresses of the others (peers.json beside the web generations, merged into the same geo $rc_self block); a node that gets a different list re-renders and applies 00-global.conf.

Search engines: verified Google and Bing crawlers are never rate limited and never get the puzzle, in every request-limit preset and in under-attack mode, and their requests count toward neither the spike detector nor the usual-traffic baseline (a real crawl of thousands of pages is not an attack, and slowing it down leaves pages "Discovered, currently not indexed"). They are recognised by address only, never by User-Agent: most "Googlebot" hits in the logs are scanners with a fake header. The addresses come from Google's googlebot.json, special-crawlers.json and user-triggered-fetchers.json and Bing's bingbot.json. The scheduled task protection.crawlers.refresh (daily) fetches them through the panel's guarded egress, checks them (JSON, size, CIDR syntax, public and not too wide, enough prefixes), keeps the last good copy of any list that fails or looks wrong, and hands the result to every web server, which renders nginx/http.d/00-crawlers.conf (geo $rc_search_bot) and applies it. A copy of each list ships inside the program, so a fresh or offline install works. protection.crawlers.status and rcctl doctor show the list's age and warn when it is older than 7 days. The one limit key $rc_rl_key is empty for this machine itself and for crawlers, so every zone (page and API) skips them.

Abuse guard and operator accounts

The server owner's own account (and the panel's admin) is only alerted about, never throttled or suspended. Browser and build tools (chrome, chromium, chrome-headless-shell, headless_shell, esbuild, go, pnpm, vite, ffmpeg) count as known only when the real executable sits in a system directory. Every throttle notice carries a one-line reason with the process, the threshold and how to lift it.