fix(security): Close review follow-up gaps
Rate-limit the optional agent bearer path after user auth resolution so mixed user/agent routes no longer leave an unthrottled PBKDF2 path. Stop logging token prefixes on agent auth failures and require a locally supplied token for backend/.env.test instead of committing one. Update tests and docs to cover agent bearer fallback, configurable webhook signature headers, and the operator-facing security settings added by the hardening work. Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -45,7 +45,7 @@ Some endpoints are designed for autonomous agents and use an agent token header:
|
||||
X-Agent-Token: <agent-token>
|
||||
```
|
||||
|
||||
In the backend, these are enforced via the “agent auth” context. When in doubt, consult the route’s dependencies (e.g., `require_user_or_agent`).
|
||||
On shared user/agent routes, the backend also accepts `Authorization: Bearer <agent-token>` after user auth does not resolve. When in doubt, consult the route’s dependencies (e.g., `require_user_or_agent`).
|
||||
|
||||
Agent authentication is rate-limited to **20 requests per 60 seconds per IP**. Exceeding this limit returns `429 Too Many Requests`.
|
||||
|
||||
@@ -83,7 +83,7 @@ The following per-IP rate limits are enforced on sensitive endpoints:
|
||||
|
||||
| Endpoint | Limit | Window |
|
||||
| --- | --- | --- |
|
||||
| Agent authentication (`X-Agent-Token`) | 20 requests | 60 seconds |
|
||||
| Agent authentication (`X-Agent-Token` or agent bearer fallback on shared routes) | 20 requests | 60 seconds |
|
||||
| Webhook ingest (`POST .../webhooks/{id}`) | 60 requests | 60 seconds |
|
||||
|
||||
When a rate limit is exceeded, the API returns `429 Too Many Requests`.
|
||||
|
||||
Reference in New Issue
Block a user