Skip to content

Commit

Permalink
fix: avoid creation of superusers
Browse files Browse the repository at this point in the history
  • Loading branch information
vncsna committed Jan 16, 2024
1 parent fcd9aff commit a4bbdd6
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions bd_api/custom/graphql_jwt.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,15 @@ def ownership_required(f, exc=exceptions.PermissionDenied):

def get_uid(context, exp=r"id:\s[\"]?(\d+)[\"]?"):
try:
query = str(context.body).replace('\\"', "")
query = str(context.body).replace('\\"', "").lower()
except Exception:
query = str(context._post).replace('\\"', "")
query = str(context._post).replace('\\"', "").lower()

if "isadmin" in query:
return None
if "issuperuser" in query:
return None

return [int(uid) for uid in findall(exp, query)]

@wraps(f)
Expand Down

0 comments on commit a4bbdd6

Please sign in to comment.