Skip to content

Commit

Permalink
api.schedule: abort early in _require_video_api_key if key is missing…
Browse files Browse the repository at this point in the history
…/empty in config

If we don't have that, the code will happily compare "" against "", which
is true, leading to an authentication bypass vulnerability.
  • Loading branch information
Kunsi authored and russss committed Sep 1, 2024
1 parent f6116cc commit 4e2ed32
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions apps/api/schedule.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
def _require_video_api_key(func):
@wraps(func)
def wrapper(*args, **kwargs):
if not app.config.get("VIDEO_API_KEY"):
abort(401)

auth_header = request.headers.get("authorization", None)
if not auth_header or not auth_header.startswith("Bearer "):
abort(401)
Expand Down

0 comments on commit 4e2ed32

Please sign in to comment.