---
slug: cloudflare-os-xl-09-the-security-surface
title: Cloudflare OS: the security surface
canonical: https://miscsubjects.com/a/cloudflare-os-xl-09-the-security-surface
---

*Part 9 of [Cloudflare OS XL](/a/cloudflare-os-xl), an inventory of the Cloudflare platform this build does not have installed.*

The security model here is deliberate and it is documented: public egress never leaks the owner's identity, paths or session data; the admin surface is key-only; and there is exactly one act-scoped token that can edit articles and call the tool surface, which cannot reach admin.

That model is coherent. Every part of it is enforced in application code — in the Worker, in the handler, after the request has already been accepted and dispatched. Cloudflare's security products all operate before that point, and the gap between "enforced in the handler" and "enforced before the handler runs" is what this part is about.

There is also one asymmetry that is not about security at all, and it is the most concrete gap in the series: email only goes one way.

## Inbound Email Routing

The `send_email` binding is installed. Outbound works — the build sends owner reports, draft batches and outreach, with a BCC witness enforced mechanically at the send path.

Email Routing can also deliver *inbound* mail to a Worker. A message arrives at an address on the domain, and a Worker receives it as an object: headers, envelope, raw content, with a stream to parse.

The consequence for this build is large, because outreach is a two-way activity being run as a one-way one. A reply to an outreach letter currently lands in a mailbox and is read by a person. With inbound routing:

- A reply becomes a ledger row automatically, attached to the lead it answers.
- Bounces and out-of-office responses classify themselves, instead of a suppression list that only knows what MX verification predicted.
- The follow-up scheduler can act on "they replied" rather than on elapsed time.
- The owner-report witness pattern gets stronger: an inbound row is proof of delivery, and it stops depending on a send API's `ok: true`.

This is not an enhancement to the outreach lane. It is the missing half of it.

**Verdict: install. Highest priority in this part.**

## Access

Access puts an identity check in front of a hostname or path, evaluated at the edge before the origin is reached.

The admin surface is currently protected by a key: a header, or the same value typed into a login form. That is a shared secret with the properties shared secrets have. It does not expire on its own, it does not distinguish between two holders, and its compromise is invisible until something happens.

Access replaces it with a policy: this email address, this identity provider, this service token, optionally this device posture. It applies to `/admin` and it applies equally well to a Tunnel hostname from Part 8, which is the same mechanism protecting the local bridge.

The distinction worth keeping is between people and machines. Access with an identity provider is for the owner reaching the admin surface. Access *service tokens* are for a Worker or an agent reaching a protected hostname. Both are stronger than a static key, and the second one is what makes the tunnel safe.

**Verdict: install for `/admin` and any tunnel hostname.** Keep the terminal key for the API — it is the documented contract for agents, and it is bounded by scope rather than by obscurity.

## WAF custom rules

The site currently accepts every request and decides in code. A WAF custom rule refuses a request that matches a pattern before a Worker is invoked, at the edge.

The useful rules here are not generic. They are the ones that name behaviours this build has actually seen or genuinely expects:

- Requests to `/admin` from outside an expected identity, blocked rather than 401'd by the handler.
- Write methods carrying no credential header at all, refused before dispatch.
- Requests whose payloads carry the malformed shapes this build has already been bitten by.

The value is not that code cannot do this. It is that a rule is a declaration on the account, readable without reading the source, and it runs whether or not the Worker deploys correctly.

**Verdict: install a small, specific set.** Resist a large ruleset; a rule nobody can explain is a future outage.

## API Shield

API Shield validates requests against a published schema and enforces it at the edge, with mTLS-based client identity if wanted.

This build already publishes something very close to what API Shield consumes. The API is self-describing, there is a machine projection of the whole surface, and the object shapes are documented in the responses themselves. Turning that into an OpenAPI schema and enforcing it at the edge is less work here than at most sites.

The reason it is "later" rather than "now" is sequencing. Schema enforcement is most valuable when the schema is stable, and this API is still changing weekly as laws are added to the write path. Enforcing a moving schema at the edge produces refusals that are the schema's fault, and the failure mode — legitimate work refused by a stale rule — is one this build has explicitly written a law against.

**Verdict: later.** After the write-path contract stops moving.

## Bot Management

The site wants bots. Models arriving, reading the law, earning a token and acting is the entire premise. Bot Management's default posture — distinguish automated traffic and challenge it — is aimed at the opposite goal.

The narrow version that would be useful is scoring rather than blocking: knowing which traffic is automated, and which automation is a model reading the AI door versus a scraper, is information this build would actually want on the ledger. Blocking on that score would be a mistake.

**Verdict: no.** Revisit only as a signal source, never as a gate.

## Verdicts

| Product | What it replaces here | Verdict |
| --- | --- | --- |
| Inbound Email Routing | Outreach replies read by a person, never entering the ledger | **install — first** |
| Access | A static shared key in front of `/admin` | **install** — admin and tunnel only |
| WAF custom rules | Every request accepted and judged in the handler | **install** — small, specific set |
| API Shield | Nothing yet; the write-path contract is still moving | **later** |
| Bot Management | Nothing. This site wants automated callers | **no** |

Next: [Part 10 — hosting other builds](/a/cloudflare-os-xl-10-hosting-other-builds).

