API Key Exposed in URL
Overview
API keys in URL query parameters appear in:
- Server access logs (nginx, Apache, CloudFront)
- Browser history
- Referer headers sent to third-party analytics
- Shared URLs (when users copy the URL from their browser)
- Proxy logs and CDN access logs
Remediation
- Pass API keys in HTTP headers:
Authorization: Bearer <token>orX-API-Key: <key> - Never log or store full URLs with API keys
- Rotate any keys that appeared in URLs