-
Notifications
You must be signed in to change notification settings - Fork 11
features auth security
Active contributors: groktopus
GroktoCrawl provides optional API key authentication and built-in SSRF protection to secure production deployments.
Authentication is controlled by the API_KEY environment variable:
-
When
API_KEYis set: all API calls (except/healthand/metrics) requireAuthorization: Bearer <key>orX-API-Key: <key>header -
When
API_KEYis not set: the API is fully open (backward compatible mode). A security warning header is added to every response
The verify_api_key() FastAPI dependency in agent-svc/agent/auth.py checks both the Authorization: Bearer and X-API-Key headers. Unauthenticated requests to protected endpoints receive a 403 response.
When auth is disabled, every response includes an X-Security-Warning header and the /health endpoint adds a security field in the response body warning that the API is publicly accessible.
All internal services (scraper-svc, browser-svc, parse-svc) are reachable only via Docker internal DNS -- they do not publish host ports. The only host-exposed ports are:
| Service | Port |
|---|---|
| agent-svc | 8080 |
| portal-svc | 8082 |
| searxng | 8081 |
| semantic-svc | 8003 |
The scraper and browser services block navigation to:
- Private IP ranges (RFC 1918: 10.x.x.x, 172.16-31.x.x, 192.168.x.x)
- Loopback addresses (127.x.x.x, ::1)
- Cloud metadata endpoints (e.g., 169.254.169.254)
- Docker host machine
This applies to both direct URLs and resolved hostnames (DNS rebinding protection).
See SECURITY.md for the disclosure policy.
| File | Purpose |
|---|---|
agent-svc/agent/auth.py |
API key verification, security warning labels |
agent-svc/agent/app.py |
Security warning middleware |
scraper-svc/scraper/fetch.py |
IP blocklist enforcement |