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

UX Optional Password & Captcha for External Registration #5029

Closed
wants to merge 2 commits into from

Conversation

coolaj86
Copy link
Contributor

@coolaj86 coolaj86 commented Oct 6, 2018

Re: #4226 and #3837

I see the primary purposes of external accounts as to increase security and convenience (which always go hand-in-hand).

If I have enabled external accounts, I should not require the user to weaken security by forcing them to create a (likely re-used) password.

Likewise, since I've already hand-picked the external account providers that I trust and want to allow, I should not reduce convenience by requiring a secondary captcha.

  • Do not require password for external accounts via REQUIRE_EXTERNAL_REGISTRATION_PASSWORD
  • Do not require password for external accounts via REQUIRE_EXTERNAL_REGISTRATION_CAPTCHA
  • Only reject omitted passwords on forms that use a password
  • Do not provide the option for a password when ALLOW_ONLY_EXTERNAL_REGISTRATION

Some other fixes that I want to get in, but may deserve separate PRs:

If you'd like to test it out

My pull request is against master, but I run it as backport to v1.5.1 (includes #5006, #5029, #5033, #5034):

git clone https://github.com/coolaj86/gitea.git gitea.coolaj86 -b v1.5.1-coolaj86
pushd gitea.coolaj86
TAGS="bindata sqlite" make generate all

I would not recommend replacing your existing gitea, but rather creating a symlink so that you can easily switch back if you don't like it. For example, if you keep gitea in /opt/gitea/bin:

rsync -av ./gitea /opt/gitea/bin/gitea-v1.5.1-coolaj86
pushd /opt/gitea/bin
mv gitea gitea-v1.5.1
ln -s gitea-v1.5.1-coolaj86 gitea

I've run a couple of manual tests so far, so I feel comfortable with someone else trying it out. I won't be pushing any additional changes to that branch (such as the upcoming changes to address the empty checkboxes in the issue) until I've tested them in production for myself.

@codecov-io
Copy link

codecov-io commented Oct 6, 2018

Codecov Report

Merging #5029 into master will increase coverage by <.01%.
The diff coverage is 19.51%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #5029      +/-   ##
==========================================
+ Coverage   41.24%   41.24%   +<.01%     
==========================================
  Files         464      464              
  Lines       62867    62893      +26     
==========================================
+ Hits        25928    25939      +11     
- Misses      33548    33561      +13     
- Partials     3391     3393       +2
Impacted Files Coverage Δ
modules/auth/user_form.go 42.85% <ø> (ø) ⬆️
modules/setting/service.go 79.16% <100%> (+0.9%) ⬆️
routers/user/auth.go 12.53% <15.38%> (+0.27%) ⬆️
models/gpg_key.go 55.83% <0%> (-0.84%) ⬇️
routers/repo/view.go 43.25% <0%> (+1.01%) ⬆️
models/unit.go 67.56% <0%> (+5.4%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 855ebbd...dd63dfc. Read the comment docs.

@bkcsoft bkcsoft added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Oct 6, 2018
@coolaj86 coolaj86 changed the title [draft] Optional Password & Captcha for External Registration Optional Password & Captcha for External Registration Oct 6, 2018
@coolaj86 coolaj86 changed the title Optional Password & Captcha for External Registration UX Optional Password & Captcha for External Registration Oct 7, 2018
@lafriks lafriks added the type/enhancement An improvement of existing functionality label Oct 8, 2018
@lafriks lafriks added this to the 1.7.0 milestone Oct 8, 2018
@lafriks
Copy link
Member

lafriks commented Oct 8, 2018

What is reason REQUIRE_EXTERNAL_REGISTRATION_CAPTCHA why no just reuse captcha setting that is already present?

@coolaj86
Copy link
Contributor Author

coolaj86 commented Oct 8, 2018

My view is that Captcha is the kind of thing you implement for local logins, not the kind of thing you enforce on delegated logins that you already trust, which already do that type of validation.

For my instance (and I think most people would feel this way), I want the greatest protection from bots with the least friction for new users and I think local-only captcha strikes the right balance.

@coolaj86
Copy link
Contributor Author

coolaj86 commented Oct 8, 2018

(that said, some people may want it for some reason, so I didn’t want to nix it entirely)

@strk
Copy link
Member

strk commented Oct 9, 2018 via email

@coolaj86
Copy link
Contributor Author

coolaj86 commented Oct 9, 2018

TL;DR

  • OpenID(1): No change introduced by this PR
  • OpenID(2)/OIDC: Same changes as OAuth2

Explanation

I haven't changed the behavior of OpenID(1) and it follows a different flow from OAuth2 in the code.

As such I don't think that these changes affect the OpenID(1) flow. I don't want to pursue changing the OpenID(1) flow as part of this PR (it was never very well adopted and doesn't provide a lot of value in my opinion), but I'd be open to updating it as well later on.

OpenID(2) aka OIDC aka OpenID Connect is actually not related to OpenID in any way. It's a strict subset of OAuth2 that actually defines important things like data format (JSON vs urlencoded), endpoint URLs, etc. It's not very well designed for personal use, in my opinion, so it doesn't really meet the original goal of OpenID (IndieAuth is probably better for that), but it is far better than OAuth2 for enterprise-style use and maintains perfect OAuth2 compatibility (which isn't hard seeing how OAuth2 doesn't define any of those things so there's nothing much to be "compatible" with other than the generic concept of "there's some handshakes").

@coolaj86 coolaj86 mentioned this pull request Oct 20, 2018
@techknowlogick techknowlogick modified the milestones: 1.7.0, 1.8.0 Dec 19, 2018
@stale
Copy link

stale bot commented Feb 17, 2019

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs during the next 2 months. Thank you for your contributions.

@stale stale bot added the issue/stale label Feb 17, 2019
@techknowlogick techknowlogick modified the milestones: 1.8.0, 1.9.0 Feb 19, 2019
@stale stale bot removed the issue/stale label Feb 19, 2019
@nickho
Copy link

nickho commented Feb 21, 2019

Thanks for working on this @solderjs !
I tested your PR on a setup with :

  • local VM on Ubuntu and gitea on https
  • our corporate AzureAD as an OIDC provider

The workflow is working fine for me. Clicking the link "Connect With OpenId Connect" on the login page redirect to our AzureAD that redirect to the "Add Account Recovery Info". If i enter a username, then everything is working fine inside Gitea.

I do confirm ALLOW_ONLY_EXTERNAL_REGISTRATION is working, but you need to also to put DISABLE_REGISTRATION to false.

gitea-app-ini

I think something is missaligned on the UI but is it an issue with #5006 ?

add-account-recovery

Keep up the good work.

@stale
Copy link

stale bot commented Apr 22, 2019

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs during the next 2 months. Thank you for your contributions.

@stale stale bot added the issue/stale label Apr 22, 2019
@techknowlogick techknowlogick added issue/confirmed Issue has been reviewed and confirmed to be present or accepted to be implemented and removed issue/stale labels May 26, 2019
@strk
Copy link
Member

strk commented May 29, 2019

Is this work still ongoing ? I'd love to see OpenID-Connect with discovery enabled on try.gitea.io ...

@lunny
Copy link
Member

lunny commented Jun 26, 2019

Please resolve the conflict

@zeripath
Copy link
Contributor

@lunny @solderjs conflict resolved.

@@ -61,6 +63,8 @@ func newService() {
Service.EnableReverseProxyAutoRegister = sec.Key("ENABLE_REVERSE_PROXY_AUTO_REGISTRATION").MustBool()
Service.EnableReverseProxyEmail = sec.Key("ENABLE_REVERSE_PROXY_EMAIL").MustBool()
Service.EnableCaptcha = sec.Key("ENABLE_CAPTCHA").MustBool(false)
Service.RequireExternalRegistrationCaptcha = sec.Key("REQUIRE_EXTERNAL_REGISTRATION_CAPTCHA").MustBool()
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
Service.RequireExternalRegistrationCaptcha = sec.Key("REQUIRE_EXTERNAL_REGISTRATION_CAPTCHA").MustBool()
Service.RequireExternalRegistrationCaptcha = sec.Key("REQUIRE_EXTERNAL_REGISTRATION_CAPTCHA").MustBool(Service.EnableCaptcha)

@lunny
Copy link
Member

lunny commented Jul 1, 2019

replaced by #6606

@lunny lunny closed this Jul 1, 2019
@lunny lunny removed this from the 1.9.0 milestone Jul 1, 2019
@go-gitea go-gitea locked and limited conversation to collaborators Nov 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
issue/confirmed Issue has been reviewed and confirmed to be present or accepted to be implemented lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. type/enhancement An improvement of existing functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

9 participants