Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

attempt to focus on explicitly allowing no_authorization_required!

ulferts088329d5086c
diff --git a/app/controllers/account_controller.rb b/app/controllers/account_controller.rb
index 12e7243cb5d..7c977c1fd01 100644
--- a/app/controllers/account_controller.rb
+++ b/app/controllers/account_controller.rb
@@ -36,7 +36,19 @@ class AccountController < ApplicationController
# prevents login action to be filtered by check_if_login_required application scope filter
skip_before_action :check_if_login_required
- no_authorization_required!
+ no_authorization_required! only: %i[login
+ internal_login
+ logout
+ lost_password
+ register
+ activate
+ consent
+ confirm_consent
+ decline_consent
+ stage_success
+ stage_failure
+ change_password
+ auth_source_sso_failed]
before_action :apply_csp_appends, only: %i[login]
before_action :disable_api
diff --git a/app/controllers/angular_controller.rb b/app/controllers/angular_controller.rb
index 8697a2fb39a..dc70f86e0c8 100644
--- a/app/controllers/angular_controller.rb
+++ b/app/controllers/angular_controller.rb
@@ -29,7 +29,7 @@
class AngularController < ApplicationController
before_action :require_login
- no_authorization_required!
+ no_authorization_required! only: %i[empty_layout notifications_layout]
def empty_layout
# Frontend will handle rendering
diff --git a/app/controllers/oauth/auth_base_controller.rb b/app/controllers/oauth/auth_base_controller.rb
index 89a6b5f88fe..d2b703007a6 100644
--- a/app/controllers/oauth/auth_base_controller.rb
+++ b/app/controllers/oauth/auth_base_controller.rb
@@ -37,7 +37,9 @@ module OAuth
prepend_before_action :extend_content_security_policy
skip_before_action :check_if_login_required
- no_authorization_required!
+ no_authorization_required! only: %i[new
+ create
+ show]
layout "only_logo"
diff --git a/modules/avatars/app/controllers/avatars/avatar_controller.rb b/modules/avatars/app/controllers/avatars/avatar_controller.rb
index a5a68b0f74e..3450061cddc 100644
--- a/modules/avatars/app/controllers/avatars/avatar_controller.rb
+++ b/modules/avatars/app/controllers/avatars/avatar_controller.rb
@@ -3,7 +3,7 @@ module ::Avatars
before_action :ensure_enabled
before_action :find_avatar
- no_authorization_required!
+ no_authorization_required! only: %i[show]
def show
send_file @avatar.diskfile,
diff --git a/modules/two_factor_authentication/app/controllers/two_factor_authentication/authentication_controller.rb b/modules/two_factor_authentication/app/controllers/two_factor_authentication/authentication_controller.rb
index fdd4dc400c7..d94aa599058 100644
--- a/modules/two_factor_authentication/app/controllers/two_factor_authentication/authentication_controller.rb
+++ b/modules/two_factor_authentication/app/controllers/two_factor_authentication/authentication_controller.rb
@@ -11,7 +11,12 @@ module ::TwoFactorAuthentication
# User is not yet logged in, so skip login required check
skip_before_action :check_if_login_required
- no_authorization_required!
+ no_authorization_required! only: %i[request_otp
+ confirm_otp
+ enter_backup_code
+ verify_backup_code
+ retry
+ webauthn_challenge]
# Avoid catch-all from core resulting in methods
before_action :only_post, only: :confirm_otp
diff --git a/modules/two_factor_authentication/app/controllers/two_factor_authentication/my/remember_cookie_controller.rb b/modules/two_factor_authentication/app/controllers/two_factor_authentication/my/remember_cookie_controller.rb
index 5be5a66ee3a..eb23b6f50ba 100644
--- a/modules/two_factor_authentication/app/controllers/two_factor_authentication/my/remember_cookie_controller.rb
+++ b/modules/two_factor_authentication/app/controllers/two_factor_authentication/my/remember_cookie_controller.rb
@@ -6,7 +6,7 @@ module ::TwoFactorAuthentication
# Ensure user is logged in
before_action :require_login
- no_authorization_required!
+ no_authorization_required! only: :destroy
layout "my"
menu_item :two_factor_authentication
diff --git a/modules/two_factor_authentication/app/controllers/two_factor_authentication/my/two_factor_devices_controller.rb b/modules/two_factor_authentication/app/controllers/two_factor_authentication/my/two_factor_devices_controller.rb
index 59f69f24c15..4295a95a5eb 100644
--- a/modules/two_factor_authentication/app/controllers/two_factor_authentication/my/two_factor_devices_controller.rb
+++ b/modules/two_factor_authentication/app/controllers/two_factor_authentication/my/two_factor_devices_controller.rb
@@ -4,9 +4,16 @@ module ::TwoFactorAuthentication
# Ensure user is logged in
before_action :require_login
before_action :set_user_variables
- # Authorization is not handled explictly but as the user on which changes can be done is only the current user
+ # Authorization is not handled explicitly but as the user on which changes can be done is only the current user
# (and that user needs to be logged in), no action harmful to other users can be done.
- no_authorization_required!
+ no_authorization_required! only: %i[new
+ index
+ create
+ register
+ confirm
+ destroy
+ make_default
+ webauthn_challenge]
before_action :find_device, except: %i[new index register webauthn_challenge]
diff --git a/spec/features/auth/login_spec.rb b/spec/features/auth/login_spec.rb
index fa3d27a7e51..882c3335fea 100644
--- a/spec/features/auth/login_spec.rb
+++ b/spec/features/auth/login_spec.rb
@@ -109,7 +109,7 @@ RSpec.describe "Login" do
end
it "prevents login for a blocked user" do
- user.lock!
+ user.locked!
login_with(user.login, user.password)