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

Confirming password impossible with custom authentication backend #10380

Open
1 of 3 tasks
aklajnert opened this issue Nov 1, 2018 · 4 comments
Open
1 of 3 tasks

Confirming password impossible with custom authentication backend #10380

aklajnert opened this issue Nov 1, 2018 · 4 comments
Assignees

Comments

@aklajnert
Copy link

aklajnert commented Nov 1, 2018

Important Details

How are you running Sentry?

  • On-Premise docker [Version 9.0]
  • Saas (sentry.io)
  • Other [briefly describe your environment]

Description

I have a custom authentication backend which use my corporate authentication provider. The backend will create a new user on first login. The company policy doesn't allow to store user passwords in application databases, so the password will be empty in Sentry DB. In future if the user would like to log in, the password will be validated with corporate authentication again. This functionality works fine by registering custom authentication backend functionality in Django via sentry.conf.py file.
The problem is when the user wants to perform an admin action. Sentry wants the user to confirm password. To do that, it uses check_password() method from the User model. The problem is that check_password() is testing the password against the one stored in a database. If user has logged in via custom backend which doesn't store the password, it is impossible to confirm the password.

Steps to Reproduce

  1. Log in with custom backend which doesn't store password in database
  2. Try to perform any administrative action e.g. removing a project
  3. Your password will be rejected every time.

What you expected to happen

Sentry should use the custom backend to validate the user password.

Possible Solution

This can be fixed by overriding or monkey-patching the check_password() method in the User model, but it doesn't seem to be the clean solution. Especially when you're using multiple custom backends (we do that in our company).

I think, the check_password() usage shall be replaced with authenticate() function which is defined by backend. This would be the easiest and cleanest solution.

@github-actions
Copy link
Contributor

github-actions bot commented Jan 8, 2021

This issue has gone three weeks without activity. In another week, I will close it.

But! If you comment or otherwise update it, I will reset the clock, and if you label it Status: Accepted, I will leave it alone ... forever!


"A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀

@BYK BYK reopened this Jan 15, 2021
BYK pushed a commit that referenced this issue Jan 25, 2021
The current behavior won't change, except that it will be possible to confirm your password in admin panel if custom authentication backend doesn't store password in DB.

Fixes GH-10380
@chadwhitacre
Copy link
Member

Is this still a valid issue, @realkosty?

@realkosty
Copy link
Member

Hey @chadwhitacre. We had a SaaS customer using SSO report being unable to delete project because they are prompted for password which they don't have. @leedongwei said existing issue cover that.
Here are 2 other issues that are potentially related or duplicate:
#19601
#46373

@getsantry
Copy link
Contributor

getsantry bot commented Sep 14, 2023

Routing to @getsentry/product-owners-sign-in for triage ⏲️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: No status
7 participants