Delivered remotely for a business based in San Francisco, United States. Names withheld by agreement.
Project Overview
Production API footprints outpace documentation almost as fast as teams deploy containers. Engineers ship hotfix endpoints without updating OpenAPI specs, legacy v1 routes linger unpatched behind load balancers, and attackers probe authenticated APIs using valid session tokens to scrape records one sequential ID at a time. Signature-based web application firewalls excel at spotting SQL injection strings, yet miss stateful logic abuse entirely.
Built for high-velocity SaaS and fintech engineering teams in San Francisco, we architected a runtime API security monitoring platform using Go, Redis, and React. Operating out-of-band via mirrored gateway telemetry, the system builds a live inventory of every active route, detects schema drift and sensitive payload exposure, and catches behavioral anomalies such as BOLA enumeration and credential stuffing—exposing findings through a React console and automation APIs.
Runtime API Defense Challenges
Platform security teams monitoring high-RPS microservices confronted four structural blind spots:
- Inline proxy resistance: Product teams rejected inline security appliances that added extra network hops or risked dropping checkout and partner API traffic.
- Shadow and zombie routes: Deprecated endpoints and undocumented internal admin APIs remained reachable in production without security review or rate controls.
- Authenticated logic abuse: Attackers operating inside valid OAuth sessions bypassed stateless regex WAF rules while enumerating tenant records across
/orders/{id}style endpoints. - Payload privacy constraints: Shipping raw HTTP bodies into centralized security lakes violated compliance boundaries around payment tokens and healthcare fields.
Architectural Strategy
We decoupled observation from enforcement using edge-redacted telemetry mirroring and in-memory behavioral state. Lightweight Go collectors deployed alongside ingress proxies inspect mirrored request/response pairs, strip sensitive values locally, and emit compact structural schemas and actor fingerprints over gRPC.
Central Go analyzers evaluate incoming streams against two planes simultaneously: a structural plane that infers JSON schemas and compares routes against registered OpenAPI specs in PostgreSQL, and a behavioral plane in Redis that tracks per-actor cardinality, error-code ratios, and velocity anomalies across sliding time windows. Confirmed incidents surface in the React workbench and optionally push targeted IP or token revocation rules back to edge gateways.
Core Capabilities
- Continuous API Discovery: Automatically reconstructs active endpoint trees, parameter types, and authentication schemes directly from live traffic, flagging shadow and deprecated routes.
- Behavioral BOLA & Enumeration Detection: Tracks unique resource-ID access cardinality per user and IP in Redis to expose horizontal privilege probing and scraping bots.
- OpenAPI Schema Drift & Sensitive Data Classification: Identifies unannounced response fields, unexpected PII patterns (emails, SSNs, JWTs in URLs), and broken type constraints.
- Gateway-Native Mitigation Exports: Generates ready-to-apply rate limits and block policies for Envoy, Kong, and cloud WAF APIs without requiring inline traffic interception.
- Forensic Attack Timelines: Lets AppSec engineers pivot across actor sessions, status-code spikes, and affected endpoints inside a unified React interface.
Technical Architecture
Telemetry pipelines isolate edge capture from heavy analytical aggregation. Envoy tap filters and Kubernetes DaemonSet collectors forward sanitized gRPC metadata streams to stateless Go ingestion workers, which update real-time behavioral counters in Redis while batch-writing structured logs into ClickHouse.
Flow: Mirrored Gateway / Ingress Traffic → Go Edge Redactor & Path Normalizer → gRPC Stream → Go Behavioral & Schema Analyzers → Redis Sliding-Window State + ClickHouse Analytics → PostgreSQL OpenAPI Catalog → React Security Console & Gateway Mitigation Hooks
Separating live state from historical forensics prevents analytical dashboard queries from impacting stream processing. Redis keeps sliding windows compact via TTL-bounded HyperLogLog and sorted-set keys, while ClickHouse handles long-range forensic filtering across months of API calls.
Technology Stack
| Category | Technology detail |
|---|---|
| Telemetry Collectors | Go agents ingesting mirrored ingress, Envoy tap, and VPC traffic streams via gRPC |
| Behavioral State | Redis tracking sliding-window actor rates, object-ID cardinality, and session baselines |
| Security Console | React interface visualizing live API topology, schema drift, and attack timelines |
| Inventory & Rules | PostgreSQL persisting discovered OpenAPI specs, sensitivity tags, and suppression policies |
| Event Analytics | ClickHouse storing compressed historical request telemetry for forensic pivoting |
| Schema Differ | Go structural parser comparing observed JSON payloads against registered OpenAPI contracts |
| Collector Transport | gRPC protobuf streams batching redacted metadata from edge clusters to core analyzers |
| Mitigation Hooks | Automated policy exporters generating dynamic Envoy/Kong blocklists and Slack alerts |
Engineering Trade-offs & Solutions
| Engineering Challenge | Solution & Trade-off |
|---|---|
| Tracking exact sets of accessed object IDs per user explodes Redis memory under heavy traffic | Used HyperLogLog structures for high-cardinality BOLA detection alongside small bounded LRU rings for sample forensic IDs; accepts tiny probabilistic error in exchange for predictable RAM. |
| Raw URL paths with embedded IDs create millions of unique endpoints in the catalog | Built a deterministic Go path-clustering engine collapsing UUIDs, hex tokens, and integers into parameterized templates; occasionally requires manual merge rules for custom slug formats. |
| Out-of-band monitoring cannot drop the very first malicious packet mid-flight | Accepted asynchronous detection latency in exchange for zero inline blast radius, closing the loop via sub-minute webhook/gateway blocklist pushes for sustained abuse. |
| Full HTTP body logging leaks secrets into observability storage | Performed schema extraction and token masking inside Go edge collectors prior to gRPC transmission, trading raw payload replay for strict compliance safety. |
Security & Data Minimization
Observing production APIs requires rigorous trust boundaries. Edge collectors execute with read-only traffic mirror permissions and drop sensitive header values, passwords, and payment card fields in memory before serialization. Actor identities map through keyed HMAC digests so analysts trace abusive session behavior without storing raw JWTs or user emails inside analytical clusters.
Communication between cluster collectors and the control plane enforces mutual TLS (mTLS) with short-lived workload certificates. Inside the React dashboard, role-based permissions govern who may view payload field samples versus high-level topology maps or trigger automated gateway blocks.
Performance & Stream Scalability
High-volume SaaS gateways generate intense traffic bursts during marketing launches and bot attacks. Writing collectors and stream processors in Go keeps per-core memory overhead lean and avoids garbage-collection pauses when parsing thousands of JSON shapes concurrently.
Go edge agents apply adaptive sampling on repetitive healthy static responses while preserving full fidelity for error bursts (401, 403, 404, 429, 5xx), unknown routes, and schema violations. Redis clusters shard behavioral keys by tenant and normalized route template, while ClickHouse batch inserts absorb sustained analytical throughput cleanly.
Operational Outcomes
Deploying out-of-band Go telemetry and behavioral tracking transformed how engineering and security teams govern fast-moving API estates:
- Immediate shadow-API visibility: Platform teams discover forgotten legacy routes and unauthenticated internal endpoints directly from production traffic rather than stale spreadsheets.
- Zero-latency production safety: Out-of-band mirroring let product squads adopt deep API monitoring without worrying about proxy outages or request slowdown.
- Actionable business-logic alerts: Behavioral cardinality tracking catches slow-and-low scraping and BOLA probing that stateless WAF signatures overlook.
- Tighter API contract discipline: Automated OpenAPI drift alerts flag unreviewed response fields early, preventing accidental PII leakage during rapid release cycles.