Prompt
How do I find every API we expose and stop attacks at runtime?
Latest observation
Oct 29, 2026
OpenAI APIWeb search: off
To find every API you expose and stop attacks at runtime, you need two things in parallel:
- Discover all exposed surfaces
- Continuously enforce protections at the edge and in the app
Here’s a practical approach.
1) Inventory every API you expose
You can’t protect what you don’t know exists.
Build a complete API inventory from:
- API gateways / reverse proxies: routes, methods, auth policies
- Ingress / load balancers: hostnames, paths, upstreams
- OpenAPI/Swagger specs: declared endpoints
- Source code / CI configs: controllers, handlers, function routes
- Service mesh telemetry: internal service-to-service APIs
- Cloud resources: public IPs, DNS, WAF logs, API Gateway configs
- Package dependencies / frameworks: auto-exposed admin or debug endpoints
- Traffic logs: endpoints actually hit in production
Reconcile “declared” vs “observed”
Create an inventory with:
- Method
- Path
- Host
- Auth requirements
- Data sensitivity
- Owner/service
- Public/internal exposure
- Deprecated/unknown status
Then flag:
- Shadow APIs: exposed but undocumented
- Zombie APIs: documented but unused
- Broken auth endpoints
- Sensitive endpoints exposed publicly
2) Put runtime protection in front of every request
Use a layered defense:
At the edge
- API gateway
- WAF
- DDoS protection
- Rate limiting / throttling
- Bot detection
- Geo/IP reputation controls
In the app
- Strong authn/authz on every request
- Schema validation for all inputs
- Allowlist-based request validation
- Object-level authorization checks
- Strict output filtering
- Safe error handling
Behavior-based detection
- Detect:
- auth bypass attempts
- enumeration
- injection payloads
- abnormal request bursts
- high-entropy payloads
- parameter tampering
- unusual access patterns
- Alert on:
- unusual user agents
- new IPs/ASN
- repeated 4xx/5xx spikes
- endpoint-specific anomalies
3) Stop attacks in real time
Use controls that can automatically act:
- Block known malicious IPs / ASN / countries if appropriate
- Challenge suspicious clients with CAPTCHA or proof-of-work for public APIs
- Throttle by IP, token, user, and tenant
- Temporarily disable hot endpoints under attack
- Circuit-breaker expensive handlers
- Shadow-ban abusive automation if your use case allows it
- Deploy rule updates quickly via config, not code
4) Add API-specific protections
General web controls often aren’t enough.
- JWT/API key validation
- mTLS for service-to-service APIs
- Per-client quotas
- Idempotency keys for write operations
- Pagination limits
- Field-level authorization
- Mass assignment protection
- Strict CORS
- Versioning and deprecation policy
5) Continuously scan and test
- DAST against live endpoints
- SAST in CI
- IAST/RASP if available
- Endpoint discovery scans
- Fuzzing for parsers and serializers
- Schema drift detection in production
6) Operationalize it
Create a pipeline:
- Discover endpoints
- Classify sensitivity
- Apply policy
- Monitor runtime traffic
- Detect anomalies
- Auto-mitigate
- Review and tune alerts
7) A simple starter stack
If you want a practical minimum:
- API gateway with auth + rate limiting
- WAF with managed rules
- OpenAPI-driven request validation
- Centralized logging + SIEM
- Bot/rate anomaly detection
- Alerting + auto-block playbooks
If you want, I can help you with one of these:
- an endpoint discovery checklist
- a runtime API protection architecture
- a sample detection rule set
- a tooling map for AWS / Azure / GCP / Kubernetes
- a step-by-step incident response playbook for API attacks