fix: legg til X-Internal-Key bypass i require_iap middleware for m2m
This commit is contained in:
parent
9d6f713df0
commit
619bcfd635
4
main.py
4
main.py
|
|
@ -111,6 +111,10 @@ async def require_iap(request: Request, call_next):
|
|||
return await call_next(request)
|
||||
if request.headers.get("x-goog-authenticated-user-email"):
|
||||
return await call_next(request)
|
||||
# M2M: X-Internal-Key bypass
|
||||
_ikey = request.headers.get("X-Internal-Key", "")
|
||||
if _ikey and _ikey == os.environ.get("INTERNAL_API_KEY", ""):
|
||||
return await call_next(request)
|
||||
# Fallback: aksepter Cloud Run identity token (Bearer)
|
||||
auth_header = request.headers.get("Authorization", "")
|
||||
if auth_header.startswith("Bearer "):
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user