-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
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
check if signups are allowed during SignUpPost #5437
Conversation
Previously you could hide the sign up page with the following configs: ``` [service] SHOW_REGISTRATION_BUTTON = false ``` This would remove the sign up button from the navbar, but the user could still access the page with a direct link. During the http post action, the go action checked if the key `SHOW_REGISTRATION_BUTTON` was set to true. If not, the user received a 403. You can use this scenario for a semi-hidden sign up page that is only accessible through a direct link. I've changed the check in this PR to check if the sign up is allowed or not. The user can access the sign up page (if it's enabled) and sign up even if the value of `SHOW_REGISTRATION_BUTTON` is `false`, the user can sign up. Another solution could be: - unify `SHOW_REGISTRATION_BUTTON ` with `DISABLE_REGISTRATION ` to only show the registration page if it's enabled, but that would dis- allow the mentioned scenario fixes: go-gitea#5183 Signed-off-by: Roman <romaaan.git@gmail.com>
Codecov Report
@@ Coverage Diff @@
## master #5437 +/- ##
=======================================
Coverage 37.56% 37.56%
=======================================
Files 317 317
Lines 46821 46821
=======================================
Hits 17590 17590
Misses 26732 26732
Partials 2499 2499
Continue to review full report at Codecov.
|
I see no point in why we have two settings which try to achive the same goal. From a security perspective, only hiding the button and still enabling sign ups is useless if the path is kept the same, an attacker could just try to visit So, I'd prefer to uinon these two settings. |
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. |
I think we can drop |
@lunny this PR doesn't actually drop @romankl in order prevent a broken UI you need to change https://github.com/go-gitea/gitea/blob/master/modules/setting/service.go#L57 : Service.ShowRegistrationButton = sec.Key("SHOW_REGISTRATION_BUTTON").MustBool(!(Service.DisableRegistration || Service.AllowOnlyExternalRegistration)) to Service.ShowRegistrationButton = sec.Key("SHOW_REGISTRATION_BUTTON").MustBool(true) && !(Service.DisableRegistration || Service.AllowOnlyExternalRegistration) So that |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See my comment above.
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. |
Previously you could hide the sign up page with the following
configs:
This would remove the sign up button from the navbar, but the user could still access the page with a direct link. During the http post action, the go action checked if the key
SHOW_REGISTRATION_BUTTON
was set to true. If not, the user received a 403.You can use this scenario for a semi-hidden sign up page that is only accessible through a direct link.
I've changed the check in this PR to check if the sign up is allowed or not. The user can access the sign up page (if it's enabled) and sign up even if the value of
SHOW_REGISTRATION_BUTTON
isfalse
, the user can sign up.Another solution could be:
SHOW_REGISTRATION_BUTTON
withDISABLE_REGISTRATION
toonly show the registration page if it's enabled, but that would dis-
allow the mentioned scenario
fixes: #5183