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/1089/email enumeration: Return generic response #1114

Merged
merged 6 commits into from
May 17, 2022

Conversation

gagantrivedi
Copy link
Member

No description provided.

@gagantrivedi gagantrivedi linked an issue May 16, 2022 that may be closed by this pull request
@matthewelwell
Copy link
Contributor

I tend to think that adding some level of back-off delay is a better solution here?

Can we look at throttling perhaps? We're already using it on the login endpoint for a similar purpose. Check out the code here.

I'm happy to include this generic error message if that's what the security testers want but I think it's kind of pointless and that rate limiting is the better solution.

@dabeeeenster
Copy link
Contributor

I tend to think that adding some level of back-off delay is a better solution here?

Can we look at throttling perhaps? We're already using it on the login endpoint for a similar purpose. Check out the code here.

I'm happy to include this generic error message if that's what the security testers want but I think it's kind of pointless and that rate limiting is the better solution.

These are two separate things really:

  1. Don't leak info needlessly
  2. Prevent brute force attempts

agree we should do both. Maybe 2 should be a separate PR

@matthewelwell
Copy link
Contributor

I'd argue that (2) should also be in the branch named 'email-enumeration' and since it's likely only ~10 lines of code, let's just do it?

@dabeeeenster
Copy link
Contributor

Sounds good

api/conftest.py Show resolved Hide resolved


class ThrottledUserViewSet(UserViewSet):
throttle_classes = [ScopedRateThrottle]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will set the throttle for all the endpoints in this viewset whereas I think we only really want it on signup, right? Should we just override the get_throttles method instead?

Copy link
Contributor

@matthewelwell matthewelwell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved with one minor comment for discussion.

@@ -20,6 +23,7 @@
CustomAuthTokenLoginWithMFACode.as_view(),
name="mfa-authtoken-login-code",
),
path("", include(throttled_user_router.urls)),
path("", include("djoser.urls")),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking at what we actually use djoser for, I think we could get away with replacing this with just the overridden viewset instead, right? Maybe that's not a good idea just incase anyone is using the additional endpoints in their open source installation but maybe we could add a comment to remove them in the next major release?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, that's a good point. I will add the comment

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.

Email enumeration possible
3 participants