Skip to content
Evan Newman edited this page Nov 30, 2026 · 2 revisions

MirageGate

MirageGate is a zero-LLM, zero-external-dependency Go Layer 7 reverse proxy built to counter hybrid human+agentic offensive operations. Legitimate API traffic passes straight through to the real upstream with zero collateral interference (0.0% legitimate FPR in the built-in 4-cohort benchmark), while provably adversarial requests are shunted into a deterministic, OpenAPI 3.x-shaped "near-miss" procedural labyrinth seeded with HMAC-SHA256 and ChaCha8. Every synthetic response is generated in microseconds of defender CPU (~60 µs/req, $0.00 defender LLM cost) to force quadratic context-window token burn on autonomous recon agents, while embedding unforgeable 24-byte HMAC-SHA256 cryptographic breadcrumbs across five HTTP surfaces so human-handoff replays from any IP or client toolchain trigger critical Handoff Attribution Alerts.

Current release: v0.1.0 (November 28, 2026) — see Releases and CHANGELOG.md. Live showcase and pre-rendered incident report: miragegate.evanjames010101.workers.dev (3-actor demo report).

MirageGate is Layer 2 (Active Deception & Attribution) of a 3-layer defensive AI-security suite alongside OodaTap (passive encrypted detection) and NetDIFT (internal agent DIFT containment).


Highlights

  • Zero external Go dependencies — compiles strictly from the Go 1.22+ standard library (go.mod has zero require directives), including an in-repo YAML 1.2 / JSON strict parser (internal/yamlmini).
  • Pre-gate cryptographic breadcrumb engine — derives 4 domain-separated HMAC-SHA256 subkeys (breadcrumb, labyrinth, honey-jwt, session-id) and embeds 24-byte authenticated envelopes (32-char Base64URL) across 5 format-preserving surfaces (shadow_route, api_key, honey_jwt, tenant_scope, cursor), verifiable both statefully (exact IP/UA divergence & Δt) and statelessly across restarts or edge nodes.
  • Zero-collateral safe activation gate — enforces hard bypasses (bypass_paths with traversal rejection, bypass_cidrs, constant-time bypass_header) ahead of 5 deterministic adversarial triggers: opt-in WAF shunt header, canary routes, structurally tampered/alg:none JWTs, path-scoped GraphQL introspection (unicode-aware, __typename-safe), and sliding-window IDOR 401/403/404 velocity.
  • Anti-spoofing & header hygiene — ignores X-Forwarded-For and X-Real-IP unless r.RemoteAddr matches server.trusted_proxies; strips bypass_header and waf_shunt_header before forwarding upstream; preserves http.Flusher/http.Hijacker via Unwrap().
  • Deterministic OpenAPI 3.x procedural labyrinth — learns titles, paths, resources, query params, and components.schemas.*.properties from OpenAPI 3.x YAML/JSON; synthesizes byte-for-byte idempotent responses across Depth 0 → 4+ (with realistic 429 burst pacing) using HMAC-SHA256 + ChaCha8 with zero MirageGate banners and zero prompt injections.
  • Live cost-asymmetry economics & SIEM reporting — tracks nanosecond defender CPU vs. modeled quadratic attacker context-window spend, streams Elastic Common Schema (ECS v8.11.0) JSONL alerts (0600 file perms), renders zero-CDN auto-escaped dark-mode HTML incident reports with inline SVG charts, and serves a hardened loopback Admin Web Console (127.0.0.1:8081) with DNS-rebinding checks and an interactive POST /api/verify inspector.
  • Self-contained live demo & 4-cohort benchmark — miragegate demo spins up a real mock upstream, proxy, legitimate user, 36-turn recon agent, and cross-IP human curl handoff; miragegate bench validates 0.0% legitimate FPR and 100.0% handoff recall.

Download & install

Grab a prebuilt static binary from the latest GitHub Release and verify SHA256SUMS.txt:

Platform Asset (v0.1.0) Size
Linux x86_64 miragegate-0.1.0-linux-amd64.tar.gz 4.0 MiB
Linux ARM64 miragegate-0.1.0-linux-arm64.tar.gz 3.6 MiB
macOS Intel miragegate-0.1.0-darwin-amd64.tar.gz 4.1 MiB
macOS Apple Silicon miragegate-0.1.0-darwin-arm64.tar.gz 3.8 MiB
Windows x86_64 miragegate-0.1.0-windows-amd64.zip 4.1 MiB
Checksums SHA256SUMS.txt 511 B

Or build offline from source (requires Go 1.22+, zero module downloads):

git clone https://github.com/ejames-dev/MirageGate.git
cd MirageGate
go build -o ./bin/miragegate ./cmd/miragegate

# Run the live 3-actor demo + open the loopback Admin Web Console (127.0.0.1:8081)
./bin/miragegate demo --turns 36 --keep-alive

How it works

Every inbound HTTP request flows through a deterministic 5-stage pipeline inside internal/proxy/proxy.go:

Incoming HTTP Request (:8080)
  │
  ├─▶ [Stage 0] Hard Bypass Path Guard (bypass_paths, traversal-safe) ──────▶ Real Upstream
  │
  ├─▶ [Stage 1] Pre-Gate Breadcrumb Inspector (~2 µs, HMAC-SHA256)
  │     Scans Authorization, X-API-Key, X-Tenant-Scope, URL path, query params
  │     Valid breadcrumb? ──▶ CheckAndRecordHandoff() ──▶ Critical Handoff Alert ──┐
  │                                                                                │
  ├─▶ [Stage 2] Safe Activation Gate (bypass_cidrs / bypass_header checked first)  │
  │     1. WAF shunt header   2. Canary routes   3. Tampered / alg:none JWT        │
  │     4. Scoped GraphQL introspection          5. Active session / IDOR velocity │
  │     Clean? ─────────────────────────────────────────────────────────────▶ Real Upstream
  │     Adversarial? ──────────────────────────────────────────────────────────────┤
  │                                                                                ▼
  └─▶ [Stage 3] Deterministic OpenAPI Labyrinth (HMAC-SHA256 + ChaCha8, ~60 µs, $0 LLM)
        Depth 0 (migration hook) ─▶ Depth 1 (tenant scope) ─▶ Depth 2 (paginated catalog)
        ─▶ Depth 3 (Honey-JWT + API key) ─▶ Depth 4+ (vault shards + 429 burst pacing)
                                      │
                                      ▼
      [Stage 4] Session Economics Store · ECS v8.11.0 JSONL · HTML Report · Admin Console (:8081)

See Architecture and tarpit mechanics and Watermarking and attribution for full protocol, state-machine, and cryptographic details.

Tech stack

Layer Technology
Core proxy & CLI Go 1.22+ (CI tested on 1.22, 1.23, 1.24), zero external dependencies
Networking & HTTP Go stdlib net/http, net/http/httputil, net/netip, log/slog
Cryptography & PRNG Go stdlib crypto/hmac, crypto/sha256, crypto/rand, crypto/subtle, math/rand/v2 (ChaCha8)
Config & OpenAPI In-repo strict YAML 1.2 / JSON parser (internal/yamlmini) + OpenAPI 3.x extractor (internal/schema)
Console & reports Go html/template + embed (zero-CDN HTML, pure DOM JS, inline SVG), ECS v8.11.0 JSONL
Showcase site Cloudflare Workers static assets (site/, cf, strict CSP _headers)

Data model

Core Go structs across internal/:

  • Config (internal/config): Config composing ServerConfig, CryptoConfig, SchemaConfig, GateConfig, LabyrinthConfig, and TelemetryConfig (loaded with strict unknown-key rejection).
  • Watermarking (internal/watermark): Breadcrumb (version, kind, session_id, issued_at, depth, flags, token, source), Kind (shadow_route, api_key, honey_jwt, tenant_scope, cursor), and TriggerFlags bitmask.
  • Gate & Schema (internal/gate, internal/schema): Decision (bypass | pass | mirage, trigger, flags, reason) and APIModel (title, version, internal_domain, paths, resources, query_params, schema_fields).
  • Telemetry & Attribution (internal/session): Session, TurnEvent, HandoffAlert, EconomicsSummary, and Snapshot.

API surface

CLI subcommands (cmd/miragegate/main.go):

Command Purpose Key flags
miragegate serve Run L7 reverse proxy + loopback Admin Console --config, --proxy-listen, --admin-listen, --upstream, --ecs-out
miragegate demo Run self-contained 3-actor live simulation --turns (36), --openapi, --ecs-out, --html, --keep-alive, --admin-listen, --secret
miragegate inspect <artifact> Verify & decode any breadcrumb offline --config, --secret-file, --secret, --api-key-prefix, --json
miragegate bench Run 4-cohort FPR/recall/CPU benchmark --sessions (10), --turns (30)
miragegate version Print version metadata -v, --version

Loopback Admin Web Console API (server.admin_listen, default 127.0.0.1:8081, loopback Host allowlist enforced):

Endpoint Description
GET / Zero-CDN live dark-mode operations console (polls /api/snapshot every 2s)
GET /api/snapshot Live JSON session.Snapshot (economics, sessions, handoff alerts, recent events)
POST /api/verify Stateless HMAC-SHA256 verifier ({"artifact": "..."}, max 16 KiB)
GET /api/report.html Standalone zero-CDN dark-mode HTML incident report (?download=1 for attachment)
GET /api/alerts.jsonl ECS v8.11.0 NDJSON handoff alerts (?download=1 for attachment)

See Configuration and CLI reference for every flag, config key, and OpenAPI/YAML subset rule.

Developing

git clone https://github.com/ejames-dev/MirageGate.git
cd MirageGate

# Format, static checks, race-enabled test suite (36 tests across 10 internal packages), and build
gofmt -l .
go vet ./...
go test -race -v ./...
go build -o ./bin/miragegate ./cmd/miragegate

# Smoke-test demo, benchmark, and offline breadcrumb verification
./bin/miragegate demo --turns 36 --ecs-out out/handoff_alerts.ecs.jsonl --html out/handoff_report.html
./bin/miragegate bench --sessions 10 --turns 30

CI (.github/workflows/ci.yml) runs gofmt, go vet, go test -race, build, and demo/bench smoke tests across Go 1.22, 1.23, and 1.24.

Release history

Version Date Theme
0.1.0 2026-11-28 Initial release: zero-dependency Go L7 reverse proxy, 5-surface domain-separated HMAC-SHA256 breadcrumb engine, Safe Activation Gate, OpenAPI 3.x deterministic labyrinth, cost-asymmetry economics, ECS v8.11.0 JSONL, zero-CDN HTML report, loopback Admin Console, and 5 cross-compiled release binaries

Post-v0.1.0 on main: added Cloudflare Workers static showcase site (site/) with pre-rendered 3-actor HTML incident report (demo-report.html) and strict security _headers.

Roadmap

Planned enhancements (from README.md):

  • Caddy / Envoy HTTP filter module — optional wrapper around internal/proxy.
  • Custom shadow-route prefix pools — configurable route prefixes beyond /v2-internal/* for deeper domain blending.
  • Native alert sinks — built-in Webhook, Slack, and PagerDuty sinks alongside ECS JSONL.
  • GraphQL & gRPC-Gateway synthesis — OpenAPI response-schema example synthesis for GraphQL and gRPC-Gateway surfaces.

Further reading