fix(beacon): stop Cloudflare logging senders' IP addresses (#4018)

## Description

**In plain words:** our beacon code promises it never keeps anyone's IP
address, and it doesn't read it. But Cloudflare does. With per-request
logging switched on, Cloudflare saves a copy of every beacon request's
details in our Workers Logs, including:

- the sender's **IP address**
- their **city, postal code, and map coordinates**
- their internet provider

That's about 25,000 requests an hour. I confirmed it on 2026-10-07 by
opening one entry in the Cloudflare dashboard (Workers → headroom-beacon
→ Observability).

So the promise in `worker.js` ("never log, store, or forward the source
IP") isn't true right now. The logs expire after a few days, but they
shouldn't exist at all. Since the receiver is open source specifically
so people can check our privacy claims, the setup has to match the code.

## Changes Made

- `deploy/beacon/wrangler.toml`: adds `[observability.logs]
invocation_logs = false`. Cloudflare stops saving per-request details.
Observability stays on, so errors and anything the worker `console.log`s
still show up.
- `deploy/beacon/worker.js`: comment fixes only, no code change.
- Says the worker runs at `headroom-beacon.headroom-beacon.workers.dev`.
`otlp.headroomlabs.ai` is planned but doesn't resolve yet.
  - Notes why invocation logs must stay off.

## Deployment Follow-up

1. Deploy: `npx wrangler deploy --config deploy/beacon/wrangler.toml`
2. Check: open a new log entry in Workers → headroom-beacon →
Observability. It should no longer show `cf-connecting-ip`, `x-real-ip`,
or location fields.

Validated with `wrangler deploy --dry-run` (wrangler 4.148.0): config
parses, R2 binding unchanged.

SOC 2: closes the gap in risk R-15 (telemetry privacy).

🤖 Generated with [Claude Code](https://claude.com/claude-code)

<!-- devin-review-badge-begin -->

---

<a href="https://app.devin.ai/review/headroomlabs-ai/headroom/pull/4018"
target="_blank"><picture><source media="(prefers-color-scheme: dark)"
srcset="https://static.devin.ai/assets/gh-devin-review-dark.svg?v=4"><img
src="https://static.devin.ai/assets/gh-devin-review-light.svg?v=4"
alt="Devin Review"></picture></a>
<!-- devin-review-badge-end -->
## Type of Change
- [x] Bug fix
- [x] Documentation update

## Testing
Maintainer validation: the TOML parses with `observability.enabled =
true` and `observability.logs.invocation_logs = false`; `node
deploy/beacon/test-rollup.mjs` passes. Cloudflare documents this exact
setting:
https://developers.cloudflare.com/workers/observability/logs/workers-logs/#invocation-logs

## Real Behavior Proof
- Environment: isolated Windows maintainer worktree; contributor
production observation is described above.
- Exact command / steps: TOML parse and existing Worker checks;
production deployment steps are described above.
- Observed result: configuration disables invocation logs while
retaining observability; Worker checks pass.
- Not tested: no production deployment or post-deployment Cloudflare
dashboard verification performed by the maintainer. Merging alone does
not disable logging on the deployed Worker.

## Runtime Rollout Safety
- Rollout-managed feature(s): none; Cloudflare Worker deployment
configuration.
- Minimum rollout channel: not applicable; takes effect on deployment.
- Stable/default behavior changed: automatic invocation logs are
disabled after deployment; application code is unchanged.
- Kill switch / disable path: retain invocation_logs=false to keep
request metadata out of Workers Logs.
- Unsafe override required: none.
- Qualification impact: verify the deployed Worker emits no invocation
entries; existing retained logs are not deleted by this change.
- Rollback path: roll back Worker code while retaining the privacy
setting; re-enabling invocation logs restores collection of request
metadata.

## Review Readiness
- [x] I performed self-review
- [x] This PR is ready for human review

The self-review checkbox records the maintainer's review of the diff and
configuration. Updated-head hosted CI is terminal with no failures;
post-deployment privacy verification remains a deployment follow-up.

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: JD Davis <mxjerrett@gmail.com>
This commit is contained in:
Tejas Chopra
2026-10-07 11:13:41 -07:00
committed by GitHub
co-authored by Claude Opus 5.5 JD Davis
parent 1ad92f0cbc
commit db983bacc6
2 changed files with 13 additions and 2 deletions
+5 -2
View File
@@ -6,7 +6,8 @@
* client sends AND exactly what happens to it on arrival. "Trust us" is not a
* privacy policy.
*
* Deployed at otlp.headroomlabs.ai. Three jobs:
* Deployed at headroom-beacon.headroom-beacon.workers.dev (otlp.headroomlabs.ai
* is planned but not yet routed; see wrangler.toml). Three jobs:
*
* 1. Allowlist. Drop every field not on ALLOWED_KEYS before anything is
* written. This is the only privacy control that works retroactively —
@@ -25,7 +26,9 @@
*
* What this deliberately does NOT do: log, store, or forward the source IP.
* Cloudflare offers it as cf-connecting-ip; it is the one field that would
* deanonymise install_id, so it is never read.
* deanonymise install_id, so it is never read. Cloudflare's own per-request
* invocation logs would record it regardless of this code, which is why
* wrangler.toml turns them off (observability.logs.invocation_logs = false).
*/
// Mostly mirrors the payload built by _Session.payload(); an extension may
+8
View File
@@ -53,6 +53,14 @@ subrequests = 100000
[observability]
enabled = true
# Invocation logs record every request's headers and Cloudflare metadata,
# which includes the sender's IP address (cf-connecting-ip, x-real-ip) and
# their city, postal code and coordinates. worker.js never reads these, but
# with invocation logs on, Cloudflare writes them to Workers Logs for every
# beacon POST anyway. Keep them off; errors and console.log still appear.
[observability.logs]
invocation_logs = false
# Rate limiting is configured in the Cloudflare dashboard, not here — this
# endpoint is unauthenticated by design (anonymity is the product), so it is
# the only thing between the Worker and a bored stranger: