Raxx · internal docs

internal · gated

DET-BETA-001 — preview token enumeration

Rule ID: DET-BETA-001 Title: Beta preview HMAC-token brute-force / enumeration on /api/beta/preview/* Category: beta Last validated: 2026-06-12 (beta-launch campaign) State: liveFLAG_BETA_MARKETING_FEEDBACK is ON in prod; endpoints are internet-reachable (CF-Access-bypassed for NDA-gated invite flow). Token-validation calls log to Raptor stdout. Monitoring starts today.

Why this detection exists

/api/beta/preview/<token>/ is the entry seam for every beta invite sent today. The token is an HMAC-SHA256 value minted per tester. The surface is intentionally internet-reachable — CF Access was removed so invitees can visit without a CF account. That means any actor who can craft or enumerate valid tokens can access preview screens and submit feedback that contaminates the rubric dataset, extract the motive copy, or probe for internal state leaks. The 2026-06-05 account-merge D1 threat-model memo established HMAC verification failure rate as a leading indicator for all token-gated surfaces; this rule operationalizes that principle here.

Telemetry source

Telemetry gap — CRITICAL: Heroku Logplex drain to a queryable store is not yet wired (prerequisite P1 from the June 4 catalog). Until the drain exists, this detection runs as a manual heroku logs grep, not an automated query. Rule is marked live but manual until the drain is wired.

Statistical method + baseline window

Token space analysis

The HMAC-SHA256 token is 256 bits of keyspace. Random brute-forcing is computationally infeasible. The realistic attack surface is:

  1. Token prediction from minting parameters — if HMAC key (INTERNAL_API_SECRET or equivalent signing key) is weak or leaked, tokens for known tester emails are predictable. This is a key-rotation concern for security-agent, not a detection problem. The detection's job is to observe the probing behavior.
  2. Token harvesting from email forwarding / link sharing — a tester forwards the invite link. Not an attack; not detectable at this seam. Policy concern for operator.
  3. URL scanner / click-tracker bot — Postmark delivery of invite emails may trigger link-preview requests from email clients or security proxies. These are single-request 200s from known provider ASNs (Google, Microsoft, Barracuda), not 401 bursts. Distinguish by: provider ASN lookup + single-request pattern.

Threshold + expected FP rate

Alert route

Escalation owner

VPN operator cross-check

Per user_uses_vpn: Datacamp/CDN77 ASN ranges are operator VPN exits. Before filing any alert, verify source IP is not in those ranges. Script:

# synthetic check — not for production use; run manually
OPERATOR_VPN_ASNS = {"AS60068", "AS60614"}  # CDN77, Datacamp
# resolve source IP ASN via maxmind or ipinfo before alerting

Test fixture / synthetic positive

See _fixtures/preview_token_enumeration_positive.json — 8 distinct token values from one synthetic IP (192.0.2.1) within 7 minutes, all returning 401, with tester emails synth-enum-01@example.test through synth-enum-08@example.test as context.

Manual query (until Heroku drain exists)

heroku logs --app raxx-api-prod --num 1500 \
  | grep 'beta_preview\|beta/preview' \
  | grep -E 'invalid_token|status=401'

Cluster output by the preceding X-Forwarded-For header to identify the source IP. This is a manual procedure until the drain is wired.

Baseline reset trigger

Re-baseline after 7 days of real beta-tester traffic. Once the empirical token-validation failure rate establishes a mean (expected: very close to zero from legitimate testers), switch from the absolute-floor threshold to a Poisson tail at the 99.9th percentile.