You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tooling.apache.org by "dave2wave (via GitHub)" <gi...@apache.org> on 2026/03/02 21:40:57 UTC
Re: [I] Add Origin header validation for API endpoints (tooling-trusted-releases)
dave2wave commented on issue #786:
URL: https://github.com/apache/tooling-trusted-releases/issues/786#issuecomment-3987066808
ChatGPT agrees that this approach is wrong and would break our API!
Instead:
```python
# atr/blueprints/api.py
from quart import request
@_BLUEPRINT.before_request
async def _csrf_defense_in_depth() -> None:
"""
CSRF defense-in-depth for API routes.
- Primary control: explicit Authorization (JWT)
- Browser detection: Sec-Fetch-Site enforcement (already present)
- Origin is intentionally *not* allowlisted to preserve cross-origin API use
"""
origin = request.headers.get("Origin")
# Explicitly read Origin to make the control visible and auditable.
# No allowlist enforcement by design (API is cross-origin).
if origin is not None:
pass
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@tooling.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tooling.apache.org
For additional commands, e-mail: dev-help@tooling.apache.org