Skip to content
dankezoPublic

About

Server-side TypeScript library that meters dataset access per identity and flags coordinated bot abuse - bulk extraction crews, scheduler-driven herds, seat squatting. Advisory only.

Topics

Resources

Contributing

Security policy

Stars

5 stars

Watchers

1 watching

Forks

Latest commit

 

History

216 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

antiRea logo

antiRea

Build it. Ship it. Keep it yours.

antiRea is a server-side TypeScript library that meters dataset access per identity and flags coordinated bot abuse - bulk extraction crews, scheduler-driven herds, seat squatting. Advisory only: it flags, you decide.

License: MIT npm version CI tests: 1992 total

Website - Threat model - Limitations - Changelog

English - Tiếng Việt - 中文 - Español


The problem, in 30 seconds

Cloning tools can watch your app's pages, bundles and traffic, then rebuild what they saw. You cannot hide code a browser has already received - so antiRea defends the other side: the data itself.

Unprotected. Anyone with an account can take your data home. In our tests, one account walked away with the entire 10,000-record dataset in under 200 requests. Quietly. Nothing unusual in the logs.

Protected. Real users notice nothing. Each identity can only ever receive a capped slice - 20% of the dataset in our test setup - so copying stops being an export and becomes an identity problem. Split the work across many accounts, and the herd detector flags the coordination.

  • The run that took everything with 1 account was stopped at 5%.
  • A scripted crew that insisted on finishing needed 25 identities and about 19 minutes - and was flagged on the way.

Unprotected, your data leaves whole, free and invisible. Protected, it leaves in slices, at a cost, and on the record.

Full numbers: Measured results.

Install

npm install @dannyphan190/anti-rea

Node.js 20+. Zero runtime dependencies. Also available via GitHub Release.

Quick start

Request quotas cap speed. A record budget caps how much of the dataset one identity can ever receive, however politely it asks.

import { createRecordBudget, createHerdDetector } from "@dannyphan190/anti-rea";

// One identity receives at most 2,000 distinct records per day.
const budget = createRecordBudget({ maxDistinctPerWindow: 2_000 });
const herd = createHerdDetector({
  onFlag: snap => { /* snap.band: "budget_cut_supported" | "graduated_only" */ },
});

// Check before the handler runs:
if (!budget.check("account:123", 1).allowed) { /* return 429 */ }

// Then record what the response actually served:
budget.consume("account:123", recordIdsServed);
herd.observe({ type: "list", identity: "account:123", ip: serverSeenIp, recordIds: recordIdsServed });

Use the same identity string (account:<id>) in both, and a herd flag can feed straight into a budget cut via applyHerdLadder().

What's inside

Five groups. Start at the top; each layer is independent.

Group What it does, in plain words Main pieces Honest limit
Meter Caps how much data any one identity can ever receive, and how fast Record budget (createRecordBudget), quota and pagination guard (createQuotaGuard), priced exports (createExportGuard), session cursors (mintCursor / verifyCursor), flow scoring (createFlowScorer) Attackers can rotate identities - pair with real signup cost on your side
Surface Controls WHAT may cross the boundary: fields a response never declared (the password hash in a profile payload) and fields a request was never offered (the role in a profile update) Field guard, both directions (createSurfaceGuard) - built-in sensitive/privileged denylists plus per-route schema allowlists; advisory by default, strip or block only when the host says so Sees field names, not values or ownership - a declared field filled with someone else's data is still your authorization logic's job
Ownership Spots one identity sweeping through other people's objects (the BOLA/IDOR walk - sequential ids, random ids, or a slow spread over hours) and reports it with evidence Ownership probe (createOwnershipProbe) - per-identity distinct-owner ratio over rolling windows (1 h by default, add 6 h for slow sweeps), public routes exempt, incremental state with O(1) verdict reads; advisory only A flag is a shape, not proof - authorization stays your job, and a sweep under the floors or concentrated on few owners is out of reach
Watch Spots coordination: many identities quietly tiling your dataset, probing decoys, or crowding a room Herd detector (createHerdDetector + applyHerdLadder), phase signals (createHerdPhaseSignal, createActivityPhaseSignal), room guard (createRoomGuard), canary traps and decoys (handleCanaryTrapRequest, createCanaryMaze, createDecoyMirage), automation telemetry (detectAutomationSignals), source-map hygiene (verify-build.py / run-audit.cjs), volume-rank rule (applyVolumeRankRule), empirical-mix calibration (selectEmpMixThreshold), session-timing features (computeHoldTypeFeatures / createHoldTypeScorer), early-minimal occupancy signal (createOccupancyEarlyMinimalSignal) Detection is not enforcement - low-tiling herds get a graduated response, and one adaptive herd was flagged yet still finished
Prove Pins down what a verdict means: which config produced it, who actually signed, what may ground a consequence Config provenance (createConfigProvenance), Web Bot Auth verification (createWebBotAuthVerifier), step-up proofs (issueStepUpProof, createStepUpProofVerifier), step-up consequence shaping (createStepUp402Responder), evidence roles (evidentiaryRoleOf, auditEvidencePack, decorateSignalResult) A verified signature is identity, not authorization - your auth checks stay exactly as they are
Trace Optional client-side aids for leaks and replay Context-bound envelopes (encryptPayload / decryptPayload, createInMemoryReplayGuard), forensic watermark (mountForensicWatermark), preference declaration log (createDeclarationLog) Traceability, not access control - overlays can be cropped, and the browser holds its own context

Recommended order: quota guard first (see below), then the record budget, then herd detection.

Does it work? Measured results

Method, in short. We test against Ledgerly, a synthetic SaaS holding 10,000 records behind 120 accounts, run twice: unprotected, and the same app with antiRea wired in. Attack runs are driven by REA 6.8.0 (rea-agents) and by general-purpose agents following the standard clone workflow; polite-user runs measure the cost to legitimate traffic. An independent benchmark was published in issue #1 - most claims held up, and the gaps it found are fixed and in the changelog. Full method and per-layer table: docs/EVIDENCE.md.

Layer Headline result
No protection (baseline) The full 10,000-record dataset leaves in 160-193 requests
Record budget One identity is capped at exactly 20% of the dataset
Herd detector + CUSUM evidence REA-style identity rotation stopped at 5%; an adaptive crew needed 25 identities and ~19 minutes
Declared cohort ceiling The cohort union stopped at exactly 600 records, zero served past the cap
Legitimate users Declared team 1,200/1,200 with zero friction; polite users zero consequences
Action budget (lab) Feature-abuse herd completed 16/80 operations (20%); ordinary users 48/48, zero consequences
Advisory signals (lab) Five slow-shape signals: 0-1.67% false flags on legitimate traffic - per-signal numbers in the full table

What this adds up to. The casual one-shot clone is gone. Bulk extraction becomes an identity problem: every extra slice costs another account and more visibility. It does not stop a determined, well-resourced rebuilder - and the real price of an identity (signup friction, verified accounts, payment) is set by you, which is why budgets are per identity and herd flags distinguish "cut the budget" from "step up scrutiny".

Also speaks MCP

antiRea ships an official MCP server for AI agents: @dannyphan190/anti-rea-mcp (source), built on the official @modelcontextprotocol/sdk, speaking MCP over stdio.

It exposes the library's eight advisory signal kinds as six tools - list_signals, create_signal, observe, observe_reference, evaluate, close_signal - so an agent can open a signal session, feed it events and read the verdict.

{
  "mcpServers": {
    "anti-rea": {
      "command": "npx",
      "args": ["-y", "@dannyphan190/anti-rea-mcp"]
    }
  }
}

It is an evaluation and demo channel. Production protection still belongs in-process, in your own app.

Latest release

v3.3.6 - The Scrapling-defense release

The 2026-12-03 lab round against a real Scrapling attacker on the frozen bench twins, shipped: two PASS-lab mechanisms, one banked component of a KILLed candidate, herd-detector scale presets, and a cost-evidence correction. Everything new is opt-in and OFF by default; runtime dependencies remain zero; a host that enables nothing gets byte-identical behaviour to 3.3.5. No cost claim: the pooled session-cost metric quoted since 3.3.3 is retired as evidence (correction below), and the frozen gate-2 FAIL stands. Nothing here is described as blocking REA or Scrapling.

  • Decision variants (C-DECISION-CANARY, deriveDecisionVariantTable / createDecisionVariantServing): same-id price variants served only to host-flagged identities, derived from the host's own observed decision cases - per case the cheapest single-record price change that flips a threshold-on-price outcome, inside a 30% delta cap, protected positions/ids never varied, list and detail always consistent, and the quote path always pricing true. Lab (catalog twin): decisions flipped 10/10 -> 5/10 at claimed_real 115, FP 0/18; a cross-checking attacker found 0 list/detail mismatches. Scope is PARTIAL by verdict: catalog-class threshold-on-price rules only - the SPA negative control stayed 9/10, and the attacker still collected 115 real records. Decision poisoning, not a block.
  • Cohort enforcement (C-COHORT-ENF, createCohortEnforcement): the wiring that gives herd flags consequences - a group record budget keyed by herd group, per-member budget freeze at flag time, echo-window degradation past the group ceiling, frontier-provisional degradation for the rotation's next identity, and the abstention discipline as law (graduated_only never enrolled; overlapping bystanders spared). Lab (catalog twin, small-dataset detector scale): rotating attacker capped at 90 claimed real - exactly the single-identity outcome - against 108 with enforcement off; randomized variant 76/87/90 across seeds; legit arms 0 broken on both sides (Phase 1's KILL was triggered solely by a bench quota confound; the corrected re-run's PASS and the original KILL both stand in the record). groupCeiling is a required host declaration; the bench wired 3.3.3-as-wired, and the SPA app is unmeasured for this mechanism.
  • Herd scale presets (HERD_SCALE_STANDARD / HERD_SCALE_SMALL_DATASET / herdScaleOptions): the detector's size-dependent configuration, named. The shipped defaults are a 10,000-record calibration and are structurally too coarse at 2,000 records (the flag floor sits above the whole mission); the small-dataset preset is the exact rescale the cohort PASS was measured under. The standard preset is exactly the shipped defaults - nothing changes for a host that passes nothing. The 4,500-record selector boundary is a judgment call between two measured points, not a third measurement.
  • Export pre-flight reservation (createExportGuard gains preflightReservation, default off): the one banked component of the KILLed C-DISCOVERY-LEDGER - checkRequest reserves budget before an export is served (2x the estimate, or the whole remaining budget when no estimate exists) and rejects 429 when the hold does not fit, so one request cannot drain past the ceiling before accounting lands. Measured on the SPA twin's wiring of the same discipline: export denied 5/5 rotating calls, 0 records served, legit untouched. The rest of that candidate (anon pool, tail-only ledger, opaque ids, unified ledger, manifest) is NOT built.
  • Cost-evidence correction (C-COST-NORM, docs only): the pooled session-cost ratio is retired as evidence - the 3.3.3 figures (1.32x / 2.20x lab, 0.836x / 1.676x installed) and the agent arm's 0.408x aggregate outcome-blind session medians, crediting sessions that failed early on a falsified surface as savings. Re-baselined: agent arm, outcome-conditioned (SPA BASE median 119,092 tokens per successful session at 2/3 success; FULL 0/3 at up to 76,849 tokens/session - cost per successful extraction not attained); script arm, requests per claimed real record (SPA 0.050 / 0.083 / 0.120, catalog 0.058 / 0.092 / 0.111 for BASE / FULL / FULL-DECOY - a real 1.6-2.4x cost layer that does not flip the mission); legit overhead ~0; rotation restores the mission at ~unchanged request cost; the cheapest attacker path remains the unguarded export. No cost PASS is awarded.

2015 tests: 2013 passed, none failed, 2 skipped. REALTEST module spot suites re-run against this build: 35/35 PASS. Scrapling bench spot cells re-run with the bench re-pinned to this build reproduce every frozen baseline exactly (FULL-DECOY 108/12 and decisions 10/10; catalog targeted 115 real, decisions 5/10, legit 0/18; cohort rotate 108 off / 90 claimed and 92 union on; SPA export denied 5/5). The REALTEST twin/agent arms were not re-run and are reported NOT RUN, not passed. The MCP wrapper pin for this release is a separate publish step.

v3.3.5 - The false-horizon release

A small release: one new opt-in decoy-family mechanism, and a measured ceiling extension for an existing forensic mode (a lab result recorded against the unchanged shipped law). No default behaviour changes; runtime dependencies remain zero. No cost claim: the frozen cost gate remains FAILED from 3.3.3. Nothing here is described as blocking REA.

  • False horizon (OPO-06, createFalseHorizonListing): the listing declares and serves only a prefix of the catalogue - declared total equals served count, no next link past the horizon - while search, facet and detail surfaces keep serving the complete truth with no totals printed. Count- and frontier-stopped crawlers finish "successfully" on the subset. Lab (synthetic 150-record world, horizon at 100 of 166 slots, real Scrapling 0.5.1): all three stopper shapes collected 90/150 real (completeness 0.600) and reported the total as 100; the legitimate leg stayed whole (search 60/60 tail records, facets 150/150, detail 150/150). Valid only where legitimate traffic is search/facet-driven and the host keeps count consistency on every surface; id probing, sitemaps and homepage-link crawling recover the tail, and the operator arm is unmeasured.
  • Chunk fingerprint joint mode - collusion-4 measured (RECOMB-18): the shipped L=512 J-SUM law, untested past collusion-3, now has its collusion-4 pin: at least one true contributor accused in 3/4 runs, false accusations 0 over 8,988 innocent sessions, mean joint Z 4.0625 against the frozen 4.00 expectation. Thin margin, printed in full in the CHANGELOG and LIMITATIONS: one run failed outright and the thinnest accusation sat 0.125 above the line - the ceiling is a band, not a point. No threshold was retuned.

1992 tests: 1990 passed, none failed, 2 skipped. REALTEST module spot suites re-run against this build: 35/35 PASS; the twin/agent arms were not re-run (the frozen twins wire neither change) and are reported NOT RUN, not passed. The MCP wrapper ships at 3.3.5 alongside, pinning this SDK.

v3.3.4 - The attribution-and-detection release

The PASS-lab build queue as opt-in modules, plus a fail-closed audit round across the existing HMAC surfaces. Every feature is opt-in and OFF by default; runtime dependencies remain zero. A host that enables nothing gets byte-identical behavior to 3.3.3 on real surfaces. No cost claim: the frozen cost gate remains FAILED from 3.3.3. Nothing here is described as blocking REA; the advisory items stay advisory, and every number below is a lab measurement on a synthetic surface.

  • Canary replay detection (TOK-01 + CNH-01, createCanaryReplayRegistry): decoy responses carry an issued canary token; a later same-identity presentation - verbatim, case-folded, base64/base64url-encoded inside a carrier, or hex-encoded - is replay evidence, distinct from a decoy visit. Matching is against the issued set only, never the token shape. Lab: 600/600 verbatim, 1000/1000 encoded arms, FP 0/2000 including an unissued-token control. Fragmentation, truncation and paraphrase are unmeasured and unclaimed.
  • Cross-version reuse signal (WX-01, createCrossVersionReuseDetector): advisory only. A session whose first extraction attempt names a retired contract field, before any response taught it the new name, reused a stale extractor. Lab negatives: fresh explorers 0/200, legit 0/2000, lookalikes 0/2000. Frozen limit: the first attempt dies (0/200 yield) but one retry succeeds (200/200) - the signal detects the attempt, it does not stop reuse.
  • Deviation-profile signal (RECOMB-01 arm A, createDeviationProfileSignal): per-identity cross-day deviation-profile correlation against a host-fed stratum reference. Three PASS-lab calibrations ship as mutually exclusive modes - drop-position, sd-floor, winsorise-z (default: widest lab FP margin, pooled max 0.1720 against the 0.25 threshold, vs 0.2446 / 0.2456). All three: FP 0/90, coverage 1.00, seeded simulation only. The Spearman variant is excluded (FP 64.44%).
  • Chunk fingerprint trace, L=256 (RECOMB-13R + RECOMB-15, createChunkFingerprint): chunk-granularity sibling of HV-03 with its own scoring law. Lab: collusion-3 interleave 2/4 at L=128 to 4/4 at L=256; FA 0 over 4,422 (static) and 9,148 (rotating) innocent scorings; rotation temporal 4/4, collusion-2-under-rotation exactly at the bar (3/4, one-run margin), collusion-3-under-rotation still broken (0/4) - the ceiling of rotation at L=256 is collusion-2.
  • Form armor (C-JK01, issueFormArmor) + action-match tokens (C-ABT01, issueActionToken): armor whose parameter name is bound to secret + session + config, validated prefix, then HMAC, then timing window (lab replays 0/100, genuine 100/100); signed tokens whose action claim is checked after the signature, with a distinct action-mismatch reason (lab cross-action 0/100, genuine 100/100, forged 0/100). Both are replay-kit tier: fresh armor / a fresh correct-action token passes, and same-action token replay passes by design.
  • Export entitlement gate (LAB-B, createExportGuard + resolveEntitlement): an unentitled principal gets 403 entitlement_required and zero rows, before any metering; a throwing predicate fails closed. Lab: 0 records to an unauthorised export client including across IP rotation; closes the export route only, not the list route.
  • Fail-closed audit round (C-ABT03R): 147 audited fail-open sites in 3 root causes, fixed: empty-secret HMAC mint/verify now throws at entry (canary-echo, cursor, cursor-v2), a throwing canary predicate records taint instead of dropping the detection input, and flow-scorer post-429 persistence accrues for page-size-less attempts.
  • Fold-in round (2026-11-30, same unreleased 3.3.4): hard caps on Web Bot Auth signature candidates, action-cohort identities and cursor token length (C-JK03); the trusted-header IP fix reading the chain's last entry instead of the client-controlled first (C-JK08-F1 A5); stateless-first state caps for the canary store and decoy tripwire (C-JK10); poisoned armor for flagged identities - a BLOCKED cursor verdict with no re-mint leniency, its trigger's false-positive compensation measured before build at 9/2000 raw, 9/9 recovered by step-up (C-JK04); relocation bait for the opt-in decoy mode (AOS-01; Scrapling relocation latched it 12/12 in the lab - semantic LLM readers are outside its claim, verified in the fold-in's own spot check); form field-set matching, advisory (C-JK05); the chunk fingerprint's joint L=512 mode (RECOMB-17; FA 0/8,992 in the pin, margin thin at +0.0625 and printed wherever the mode is documented); cursor session-rotation recovery (C-JK07); and the step-up consumer the deny taxonomy was missing (C-ABT02R). Per-item detail and caveats: CHANGELOG.
  • NOT in this release: LAB-E (rank-keyed public window, PASS-lab) - excluded by decision on 2026-11-29: outside the window, public content would effectively become entitlement-gated, colliding with SEO and the open-web model. Held as a possible later opt-in. CB-01, IH-01 and FC-07 remain out.

1978 tests: 1976 passed, none failed, 2 skipped. REALTEST module spot suites re-run against this build: 35/35 PASS; the twin/agent arms were not re-run (the frozen twins wire none of the new modules) and are reported NOT RUN, not passed. The MCP wrapper ships at 3.3.4 alongside, pinning this SDK.

v3.3.3 - The decoy-composite release

The five mechanisms that passed their registered lab trials, composed as one surface, plus two scoped residuals, a dataset fingerprint trace module, and an opt-in escalating VDF export gate. Every feature is opt-in and OFF by default; runtime dependencies remain zero. A host that enables nothing gets byte-identical behavior to 3.3.2 on real surfaces. The frozen headline verdict is 3 of 4 gates: the cost gate FAILED on both lab twins (1.32x and 2.20x against a 3.0x floor), so this release makes NO cost claim for the composite. [Correction, 2026-12-03 (v3.3.6): those pooled session-cost ratios were retired as evidence by the COST-NORM re-baseline - they aggregate outcome-blind session medians; the FAIL verdict stands, the metric does not. See the v3.3.6 section above.] The composite breaks the extractor's map, rules and decisions, and gates the export path - it does not prevent record scraping through ungated paging.

  • Honeymap (X33-01, createHoneymap): a fake source map served to flagged identities - a synthetic module graph internally consistent with the shipped decoy surface, versioned per identity by a signed variant token in the script's sourceMappingURL. Clean identities receive the host's real map bytes unchanged; every decoy serve is logged as a trace event.
  • One-time flows (X33-06, createOneTimeFlow): sensitive actions on the flagged surface require a single-use token minted per live session, delivered only in the x-flow-token response header. A fixed-path replay dies at the first token step (403); live flows pass through the mint step unchanged.
  • Semantic invariant trap (X33-11, createInvariantTrap): poisons the rule an extracting agent induces - a decoy rule taught consistently on every surface, diverging from the real rule only at unobserved inputs. Measured: the headline agent adopted the decoy rule verbatim and self-reported it as verified.
  • Composed decoy surface (X33-12/13, X33-07 scoped, affordance tarpit): one decoy fact corroborated across every channel an agent cross-checks; decoy affordances; decoy-first ordering; anti-replay contract-prefix rotation for flagged identities only.
  • Dataset fingerprint trace (HV-03, createFingerprintTrace): per-recipient dataset variants (Tardos-family code) so a leaked or scraped copy accuses its source. Measured: 0 false accusations across 36 runs; single leaks 12/12; collusion of 2-3 accused at least one source in 16/16. Attribution only - NOT prevention; identified channels only.
  • Escalating VDF ladder (HV-01x02, createVdfLadder, OPT-IN): a verifiable-delay gate on the export path, one proof per 50 records, delay escalating per gate, keyed only to a blind-signed token so identity resets do not reset it. Measured standalone: the full gated harvest cost 1,456.48 s at native speed; a normal export session added 7.26 s for a legitimate desktop user. Token scarcity is a documented lab assumption - production needs platform attestation; a degraded mode is documented in docs/VDF-LADDER.md.
  • REALTEST-333: ship gate PASS on the measured criteria. Launchability 17/17; attacker task success 100% to 0% on both twins; poison uptake median 1.0; zero real-user sessions broken; spot checks 52/52; gate 2 (cost) FAIL under its frozen label. After 13 pre-ship QA fixes in the new modules, the test was re-run on the fixed build on 2026-11-27 with identical deciding numbers. CB-01, IH-01 and FC-07 are NOT in this release. The MCP wrapper ships at 3.3.3 alongside, pinning this SDK.

1851 tests: 1849 passed, none failed, 2 skipped.

v3.3.2 - The shadow release

The decoy surface learns to answer on the auth tier and on the write path, and antiRea grows its first client component - for one item only, under the DEC-1 decision, which breaks the server-only rule at exactly U2 and nowhere else. Everything is opt-in and OFF by default; runtime dependencies remain zero. A host that enables nothing gets byte-identical behavior to 3.3.1 on real surfaces.

  • Shadow auth tier (N-T3, createShadowAuthTier): a decoy auth tier - a fake permission matrix and decoy records - served only to identities the host's own flag gate marks as flagged. The module accepts no host data source at all: everything it serves is synthetic. Measured (Neon tactics trial): a gpt-5.4-level agent absorbed the shadow tier as a real auth component in 2 of 3 deciding runs (P-T3a HIT 2/3 - the caveat travels with the claim); safety PASS with 0 real account ids in any shadow response, and clean identities received byte-identical refusals with the tier on and off. The shadow loop is closed over the documented public demo credentials only; a flagged identity presenting a valid real token passes through to the host's real flow.
  • Decoy write surface (B-N4, createDecoyWriteSurface): a write-side decoy contract with a frozen fake constraint set - a fake required field, an inverted price format, a fake id space. Decoy 422 responses name the violated constraint, so a clone built against the decoy inherits the fake rules. The module holds no reference to any host store; writes land only in a module-owned sink, and the audit counts routed writes only. Measured (B-N4 trial): agent clones carried all three fake constraints into a clean twin, each producing exactly one purely fake-attributable failure; false positives PASS 36/36 byte-identical. The trial's one audit-gate incident is disclosed in full in the changelog (Addendum E).
  • Polymorphic challenge (U2, createPolymorphicChallenge + the DEC-1 client component): each session, the server issues a JavaScript payload morphed from the session seed - identifiers rotated, step order shuffled, decoy steps mixed in - which the client component executes to answer a step-up; the server verifies arithmetically from the same seed. Challenges are short-lived and single-use: the first verify attempt consumes the challenge, pass or fail. Framing, frozen: U2 is an execution tax, not a wall - a real agent that executes JavaScript still passes. No effectiveness number exists for U2 and none is claimed.
  • REALTEST-3.3.2: LAUNCHABLE. The canonical release test ran the real REA 6.9.0 attacker against this exact build: a single identity stopped at exactly 150 records with export at 0, the identity-rotation arm took 1,445 of 10,000 records while the 2.9.3 control drained all 10,000, and legitimate traffic saw zero false positives across every pattern. A confirmation re-run on 2026-11-23 against the byte-identical dist returned LAUNCHABLE again with every deciding number identical. Release gate 17/17. The four farm items are NOT in this release: the 2026-11-23 farm verdict failed RECOMB-01 and RECOMB-03 and left C26 and AN-02 inconclusive. The MCP wrapper remains at 2.8.2.

1806 tests: 1804 passed, none failed, 2 skipped.

v3.3.1 - The provenance release

The decoy surface learns to reference itself, to speak GraphQL, to change shape per identity, and to sign the images it serves. Every feature is opt-in and OFF by default, server-side only, and runtime dependencies remain zero. A host that enables nothing gets byte-identical behavior to 3.3.0 on real surfaces.

  • Provenance fan-out (B2, buildChainRouteMap / chainRoutes + surface chain serving): decoy records arranged as a chain of individually routed records - a level-1 record carries the next level's record id, and the next record lives at its own route - so extraction walks one metered fetch per record instead of one page per dataset. Measured (trial v4, arm FAN): real yield 150 -> 100 (-33.3%) under the harness's all-or-nothing page budget; under partial-page accounting the same arm yields 131 (-12.7%, below the registered -15% threshold), so the effect is quoted only with that framing. Decoy retention 78/78, meter 150 in every arm.
  • GraphQL decoy (B3, buildGraphqlIntrospection): a phantom GraphQL schema layered over the host's declared real types - phantom object types, phantom Query fields, decoy fields on real types - served at the declared path as an introspection document. Measured (trial v4, arm GQL): 10/10 planted identifiers (3 phantom types, 3 phantom queries, 4 decoy fields) entered the capture with 0 flags at meter 150. The measured carrier was the endpoint's introspection response; no GraphQL execution ships.
  • Identity-bound variants (B4, applyIdentityVariants): one decoy endpoint whose record list is reshaped per requesting identity - which skew fields exist, which enum values can appear, what the aliased fields are called. Measured (trial v4, arm S1, 2 classes): 8/10 skew fields appeared under exactly one identity; one identity's enum coverage was 60% of the universe; cross-identity field-name overlap was a 30% Jaccard. Not claimed: the mis-map leg - whether extraction code written against identity A's shape then fails on identity B's - was not measured.
  • Image attribution and visible fingerprint (B1 + B5 + B6): every image the host declares on the surface can carry the requesting identity's AC-23 payload in a Y-DCT watermark (recovered 32/32 from inside the extractor's own output packages in 3/3 watermarked runs, in both image classes served), and record lists can carry a visible per-identity fingerprint woven into the decoy text and list order (all three channels legible in 3/3 fingerprinted runs). Both are attribution mechanisms, NOT recording prevention; the trial verdicts come from the extractor's deterministic + OCR pipeline - the VLM leg did not run.
  • REALTEST-3.3.1: LAUNCHABLE. Release gate 17/17: a single identity stopped at 150 records with export at 0, the rotation arm lost 1,445 of 10,000 records while the 2.9.3 control drained all 10,000, and legit false positives were 0 across all arms - every deciding number identical to REALTEST-3.3. The four farm items are not in this release; the MCP wrapper remains at 2.8.2.

1772 tests: 1770 passed, none failed, 2 skipped.

v3.3.0 - The decoy surface: the copy is built from our map

Metering caps how much an extractor takes; this release contaminates what the copies are built from. A host publishes a decoy surface - endpoints, a spec, worked examples - that exists only to be copied, while its real surface stays untouched. Everything is opt-in and OFF by default; a host that enables nothing ships exactly the 3.2.0 behavior.

  • Discovery pack and spec decoy (generateDecoySurface, buildDecoyOpenApiSpec, createDecoySurface): one registry generates the robots disallow block, the sitemap and an OpenAPI spec declaring live decoys plus phantom endpoints that are never served. In the lab trials the machine-read channels carried 8/8 decoys into the extractor's capture with zero real-user footprint, and 4/4 live plus 2/2 phantom endpoints entered its map with 0 flags.
  • Contradictions that need two halves (A3 + A5 + A6): a spec-endorsed feed and a worked example each measure at zero alone; combined, and joined by planted cross-route invariant violations inside decoy data, they put 36 authoritative contradiction pairs and 10/10 surviving join violations into the capture, with 0 inconsistencies reported by the extractor.
  • Identity-gated joins and budget-sink expandables (A7 + A8): decoy joins resolve only under the identity that extracted them - a capture merged from two identities orphaned 30/30 joins (100%) against 0/30 under one identity - and spec-declared expansions bill synthetic subresources to the same record budget, cutting real yield per identity from 150 to 50 records (-66.7%).
  • Canary dose (planCanaryInterleave, opt-in, no default in code): the host mixes its own synthetic records at a dose it states on every call (documented recommendation 10%); measured dose response is linear (10% planted extracted at exactly 10.0%; 25% at 24.7%), and each canary carries an HMAC tag keyed to the serving identity. Across the agent-loop trial the decoy surface multiplied an LLM extractor's token cost by 2.09x (median 7,101 vs 14,808 tokens per session) while the 150-record meter held in every arm.
  • REALTEST-3.3: LAUNCHABLE. The canonical release test ran the real REA 6.9.0 attacker against this build: a single identity stopped at 150 records with export at 0, the rotation arm took 1,445 of 10,000 while the 2.9.3 control drained all 10,000, and legitimate traffic saw zero false positives. Release gate 17/17. The K1 line (instruction-bearing decoys) stays parked and is not in this release; the MCP wrapper remains at 2.8.2.

1725 tests: 1723 passed, none failed, 2 skipped.

v3.2.0 - Per-host polymorph surface: anti-reverse that expires

The shipped canary trap paths were identical on every deployment - read the SDK once, know every site's traps forever. This release makes each deployment's surface a different, rotating shape. All of it is opt-in and advisory; no default changes.

  • Polymorph surface (derivePolymorphCanaryPaths, derivePolymorphSurface): derive natural-looking canary trap paths from a host seed and a weekly epoch (deterministic, SHA-256 only, zero new dependencies) and pass them to the canary machinery you already use. Last epoch's paths come back as retired traps - detectors only, so a hit on one means old or stolen intel. The fake-endpoint paths stay exactly as shipped: they are the fixed scanner liturgy.
  • Variant integrity (buildVariantManifest, verifyVariantManifest): SHA-256 manifests over a variant's files. Verification never throws and never blocks; it returns a signal object with per-file mismatch reasons for you to log or alert on.
  • Polymorph generator (tools/polymorph/): a build-time tool that obfuscates the four surface modules (cursor, canary-echo, fake-endpoints, trap-paths) under your seed, embeds an inert, extractable host-fingerprint watermark for leak tracing (traitor tracing), appends plausible decoy dead code, and writes the surface manifest. javascript-obfuscator is an optional build-time tool for the generator only; the SDK runtime stays zero-dependency.
  • Measured (lab prototype, 2026-11-19): transformed surface modules cost about 1.6x CPU on the cursor path and +11.7% size across the four modules; on a variant from this release's own generator, the 7 surface test files pass 72/72, a 2,000-case cursor differential fuzz is byte-identical to the clean dist, and echo tokens cross-verify 500/500 both ways. A live agent-readability trial has not been run, so no claim is made about how much harder automated analysis becomes.

1683 tests: 1681 passed, none failed, 2 skipped.

Earlier releases: see the Changelog.

First step: the quota guard

Server-side quotas and pagination bounds, enforced per account, API key and IP. Returns HTTP 429 with Retry-After, and logs structured events for operators.

import { createExpressQuotaMiddleware } from "@dannyphan190/anti-rea";

app.use("/api/", createExpressQuotaMiddleware({
  trustedIpHeader: "cf-connecting-ip",
  tiers: {
    anonymous: { maxRequests: 30, windowMs: 60_000, maxPageSize: 25, maxPage: 5 },
    free: { maxRequests: 60, windowMs: 60_000, maxPageSize: 50, maxPage: 20 },
    pro: { maxRequests: 300, windowMs: 60_000, maxPageSize: 200, maxPage: 100 },
  },
  resolveIdentity: req => ({
    accountId: req.headers.get("x-verified-account") ?? undefined, // from your server auth
    apiKeyId: req.headers.get("x-verified-key-id") ?? undefined,
    tier: "free",
  }),
  onQuotaExceeded: event => {
    console.warn("[quota-exceeded]", event);
  },
}));

Keep action traffic out of the data quota

Mount a separate quota instance for action endpoints (checkout, booking, contact, account changes) instead of sharing the data-read bucket above. The read limits stay exactly as strict; the action path simply stops competing with catalog browsing for the same per-IP allowance. This matters most behind shared IPs (offices, carrier NAT, public Wi-Fi), where many legitimate customers arrive as one IP.

app.use("/api/checkout", createExpressQuotaMiddleware({
  trustedIpHeader: "cf-connecting-ip",
  tiers: {
    anonymous: { maxRequests: 30, windowMs: 60_000 },
    free: { maxRequests: 60, windowMs: 60_000 },
    pro: { maxRequests: 300, windowMs: 60_000 },
  },
  resolveIdentity: req => ({
    accountId: req.headers.get("x-verified-account") ?? undefined,
    tier: "free",
  }),
}));

Measured basis (independent buyer-journey bench, 2026-11-27, 240 browser sessions, synthetic twins): on the SPA twin behind a simulated shared NAT IP, the single shared bucket completed 17/20 buyer flows and 12/15 checkout quotes (3 blocked users, 1 checkout 429); the split layout completed 20/20 flows and 15/15 quotes in every cell, with read protection unchanged. The catalog twin was unaffected under both layouts. Full numbers: docs/evidence/independent-bench-3.3.3-2026-11-27.md.

More patterns

  • Canary endpoints - trap routes that log abnormal probing, with path canonicalization so variants cannot slip past. Runnable example: examples/node-canary-server.cjs.
  • Signed agents - verify Web Bot Auth (RFC 9421) signatures and key quota policy on a stable identity. Runnable end-to-end demo: examples/web-bot-auth-verify.cjs.
  • Python / FastAPI - the quota guard ported with identical tiers, 429 semantics and pagination bounds, held to the same test contract: examples/python-fastapi.
  • Shared cohort ceilings and the CUSUM evidence engine - transactional reservation across a whole declared cohort, with protected cohorts whose telemetry accrues but never draws a consequence: semantics in docs/LIMITATIONS.md.
  • Declared-cohort union budget - the single-process form of the same law: one createRecordBudget keyed by a host-declared cohort id, so identity rotation inside a declared cohort stops diluting the cap. Pattern with runnable verification: examples/declared-cohort-budget.
  • Watermark and envelopes - see the Trace group above; never embed a person's email, IP or raw user ID in watermark pixels.

Honest limits

  • It cannot hide code delivered to a browser, or prevent anyone from inspecting what their own browser downloaded.
  • It cannot stop a determined, well-resourced rebuilder. It makes bulk copying slow, costly and visible instead.
  • The evidence engine's built-in tables were fitted on lab traces, not a real user population, and are labelled uncalibrated: true wherever they are mentioned. See the calibration pilot below.
  • Client-side pieces are traceability aids, not access control.
  • No client-side bot-blocking tricks and no prompt injections: they do not hold up, and they are not ethical controls. See docs/REFERENCES.md.

Full list: docs/LIMITATIONS.md.

Reproduce the numbers

The repo ships a Playwright harness that runs a synthetic SaaS (Northstar: dashboard, customer search, lead creation, CSV export, chart views) in baseline (:4173) and protected (:4174) modes, across Chromium, Firefox and WebKit.

npm install
npm run build && npm run benchmark:build-sdk
python -m pip install playwright
python -m playwright install chromium firefox webkit
python benchmark/run_all.py --browsers chromium,firefox,webkit --iterations 5

Working on the repo itself: npm run check compiles, runs 1683 automated tests (1681 passing, none failing, 2 skipped) and performs static checks. Scan a public build before deploying with node scripts/run-audit.cjs /path/to/dist or python3 scripts/verify-build.py /path/to/dist.

Help calibrate it

The one thing this project cannot generate for itself is real traffic. If you run antiRea (or are evaluating it), run the CUSUM tripwire in mode: "observe" - crossings are logged, nothing is restricted - and share the anonymised aggregate snapshots it emits: cohort sizes, scores, union-record counts.

No raw user data, no record contents, no identifiers. Review and strip a snapshot before sending; if a field looks identifying, leave it out and say so. The first real snapshot set is how the uncalibrated label comes off.

Interested, or want the snapshot format first? Email dannyphan190@gmail.com.

Documentation

Contributing and security

Read CONTRIBUTING.md and SECURITY.md before opening a pull request or a vulnerability report.

Project funding: Support the maintainer (optional; never necessary to use).

Featured on antiRea on LaunchNest

About

Server-side TypeScript library that meters dataset access per identity and flags coordinated bot abuse - bulk extraction crews, scheduler-driven herds, seat squatting. Advisory only.

Topics

Resources

Contributing

Security policy

Stars

5 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages