Skip to content

fix TypeError when attack (issue-1) #3

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions aiohttp_csrf/policy.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ async def check(self, request, original_value):
post = post_req.get(self.field_name) if post_req is not None else None
post = post if post is not None else ''
token = get if get is not None else post
if not original_value:
return False

return compare_digest(token, original_value)

Expand All @@ -30,6 +32,8 @@ def __init__(self, header_name):

async def check(self, request, original_value):
token = request.headers.get(self.header_name)
if not original_value:
return False

return compare_digest(token, original_value)

Expand Down