Detect kit for Cloudflare: rules, hunts and the admission matrix

Status: in development. Nothing here is released or deployed.

The Detect kit looks at records and raises a signal when something matters. It also holds the admission matrix, which decides in which zones it is allowed to look at all.

Purpose

Detect keeps three things separate: what is stored, what is looked at, and what may be acted on. It evaluates a record only if the record's zone, or source, is admitted at detect or above. Until you admit a zone, Detect does nothing with its records. The admission matrix guide explains the controls.

What it deploys on Cloudflare

The Worker is declared in Alchemy's plain-module form. How kits join says why.

It ships one rule pack for Cloudflare data with three rules: a burst of blocked or challenged firewall events from one address on one zone, a leaked-credential pair, and the creation of an API token. It also ships three hourly hunts, described under Hunts.

Hunts

A hunt is a stored SQL query over the records table that Ingest fills through Basin, run once an hour. It finds what a rule on a single record cannot: a person's first sign-in from a new country, an API token or Access configuration changed, or the same name blocked by DNS security ten times in a day. Every query passes a guard (one read statement, one table, a time window, a row limit) before it is sent. A hunt raises a signal only for a zone or source admitted at detect or above. Hunts stay off until you set a Basin SQL query URL and a read-only token. The hunts are tested against a fake query endpoint only, never a real one.

Capability entrypoints

A capability entrypoint is a named door that another Worker can be bound to. The binding a deployer writes is the grant, and the name is what gets recorded in audit rows.

The default entrypoint has no such methods.

HTTP routes

All behind Cloudflare Access, apart from health. Requests must be JSON of at most 1 KB with strict fields, and a browser request from another site is refused.

How a person approves things

Detect does not act on your account. A person changes the matrix: anyone admitted as an operator can lower a level or pull the stop switch at once. Raising a level or resuming after a stop is two steps by one administrator, 60 to 600 seconds apart. The admission matrix guide has the detail.

Stop switches

One switch stops all automation in Detect: POST /v1/admission/stop, or stop through AdmissionOperator. A missing or unreadable switch counts as stopped, so a new deployment starts stopped until an administrator resumes it in two steps.

Peers

All optional. Detect receives records from Ingest and, if you switch it on (EDGE_RESPONSE_SIGNALS_QUEUE=1, off by default), sends signals to Enrichment, whose stack must be deployed first. Without Enrichment it records signals in its own database and lists them. It offers the effective level of a zone to Respond through AdmissionRead.