Skip to content

Commit

Permalink
chore: add warning when masking true status code
Browse files Browse the repository at this point in the history
  • Loading branch information
davidlougheed committed Oct 19, 2023
1 parent 457e842 commit 13af2bd
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions bento_authorization_service/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ async def permissions_enforcement(request: Request, call_next) -> Response:

if not request.state.determined_authz:
# Next in response chain didn't properly think about auth; return 403
logger.warning(
f"Masking true response with 403 since determined_authz was not set: {request.url} {response.status_code}"
)
return JSONResponse(status_code=status.HTTP_403_FORBIDDEN, content={"detail": "Forbidden"})

# Otherwise, return the response as normal
Expand Down

0 comments on commit 13af2bd

Please sign in to comment.