Skip to content
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

Fix server error if username is none #2039

Merged
merged 1 commit into from
Jul 5, 2023
Merged

Fix server error if username is none #2039

merged 1 commit into from
Jul 5, 2023

Conversation

alistairewj
Copy link
Member

@alistairewj alistairewj commented Jul 5, 2023

We're receiving a lot of TypeError due to, presumably, crawlers trying to login using token based auth (e.g. user agent Microsoft Excel 2014). This is a quick fix to prevent the server errors so we can investigate further.

Ref: #2034

We're receiving a lot of `TypeError` due to, presumably, crawlers trying to login using token based auth (e.g. user agent Microsoft Excel 2014). This is a quick fix to prevent the server errors so we can investigate further.
@tompollard
Copy link
Member

@bemoody pointed out that we can reproduce the error with:

curl -H user-agent:'Microsoft Office Word 2014' -H accept-auth:'badger,Wlid1.1,Bearer,Basic,NTLM,Digest,Kerberos,Negotiate,Nego2' -H authorization:'Bearer' localhost:8000

He suggested that:

  1. Possibly our custom authorization (DualAuthModelBackend) is not behaving in the way that Django expects it to behave. We should look at the current authorization module and compare to our implementation.
  2. It's possible that the fix in this PR will break OAuth.
  3. We need to better understand the OAuth module and work out what it is doing. We could consider temporarily removing the OAuth middleware in the meantime.

@tompollard tompollard merged commit 303edbb into dev Jul 5, 2023
5 checks passed
@tompollard tompollard deleted the username-type-error branch July 5, 2023 16:10
@alistairewj
Copy link
Member Author

2. It's possible that the fix in this PR will break OAuth.

I think it absolutely will, but no one is using OAuth right now AFAIK?

@tompollard
Copy link
Member

I think it absolutely will, but no one is using OAuth right now AFAIK?

Right now no, but we will still need to fix this. I raised an issue at: #2040

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants