Skip to content

Commit

Permalink
chore: Fix bandit warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
pennersr committed Nov 8, 2024
1 parent da14924 commit 2a8fa10
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
3 changes: 2 additions & 1 deletion allauth/headless/tokens/sessions.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ def create_session_token(self, request: HttpRequest) -> str:
if not request.session.session_key:
request.session.save()
key = request.session.session_key
assert isinstance(key, str) # nosec: We did save.
# We did save
assert isinstance(key, str) # nosec
return key

def lookup_session(self, session_token: str) -> typing.Optional[SessionBase]:
Expand Down
3 changes: 2 additions & 1 deletion allauth/socialaccount/providers/facebook/locale.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ def _build_locale_table(filename_or_file):
# Require the XML parser module only if we want the default mapping
from xml.dom.minidom import parse # nosec

dom = parse(filename_or_file) # nosec: trusted source
# Trusted source
dom = parse(filename_or_file) # nosec

reps = dom.getElementsByTagName("representation")
locs = map(lambda r: r.childNodes[0].data, reps)
Expand Down
3 changes: 2 additions & 1 deletion allauth/socialaccount/providers/mailru/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,10 @@ def complete_login(self, request, app, token, **kwargs):
"uids": uid,
}
param_list = sorted([item + "=" + data[item] for item in data])
# See: https://api.mail.ru/docs/guides/restapi/
data["sig"] = md5(
("".join(param_list) + app.secret).encode("utf-8")
).hexdigest() # nosec: https://api.mail.ru/docs/guides/restapi/
).hexdigest() # nosec
response = (
get_adapter().get_requests_session().get(self.profile_url, params=data)
)
Expand Down

0 comments on commit 2a8fa10

Please sign in to comment.