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

Freeze string literals in the 2FA module

Jan Sandbrinka53f4a25d501
diff --git a/modules/two_factor_authentication/Gemfile b/modules/two_factor_authentication/Gemfile
index 3be9c3cd812..bb94df82938 100644
--- a/modules/two_factor_authentication/Gemfile
+++ b/modules/two_factor_authentication/Gemfile
@@ -1,2 +1,4 @@
+# frozen_string_literal: true
+
source "https://rubygems.org"
gemspec
diff --git a/modules/two_factor_authentication/app/components/two_factor_authentication/devices/row_component.rb b/modules/two_factor_authentication/app/components/two_factor_authentication/devices/row_component.rb
index df46c05bfd9..cd842f6b0f6 100644
--- a/modules/two_factor_authentication/app/components/two_factor_authentication/devices/row_component.rb
+++ b/modules/two_factor_authentication/app/components/two_factor_authentication/devices/row_component.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
module ::TwoFactorAuthentication
module Devices
class RowComponent < ::RowComponent
diff --git a/modules/two_factor_authentication/app/components/two_factor_authentication/devices/table_component.rb b/modules/two_factor_authentication/app/components/two_factor_authentication/devices/table_component.rb
index a9d2165f14d..d5e9d9eaf68 100644
--- a/modules/two_factor_authentication/app/components/two_factor_authentication/devices/table_component.rb
+++ b/modules/two_factor_authentication/app/components/two_factor_authentication/devices/table_component.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
module ::TwoFactorAuthentication
module Devices
class TableComponent < ::TableComponent
diff --git a/modules/two_factor_authentication/app/controllers/concerns/two_factor_authentication/backup_codes.rb b/modules/two_factor_authentication/app/controllers/concerns/two_factor_authentication/backup_codes.rb
index c5d1eace098..cfa5caf401d 100644
--- a/modules/two_factor_authentication/app/controllers/concerns/two_factor_authentication/backup_codes.rb
+++ b/modules/two_factor_authentication/app/controllers/concerns/two_factor_authentication/backup_codes.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
module ::TwoFactorAuthentication
module BackupCodes
extend ActiveSupport::Concern
diff --git a/modules/two_factor_authentication/app/controllers/concerns/two_factor_authentication/remember_token.rb b/modules/two_factor_authentication/app/controllers/concerns/two_factor_authentication/remember_token.rb
index 212c48218b0..6cbdcec4915 100644
--- a/modules/two_factor_authentication/app/controllers/concerns/two_factor_authentication/remember_token.rb
+++ b/modules/two_factor_authentication/app/controllers/concerns/two_factor_authentication/remember_token.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
module ::TwoFactorAuthentication
module RememberToken
extend ActiveSupport::Concern
diff --git a/modules/two_factor_authentication/app/controllers/concerns/two_factor_authentication/webauthn_relying_party.rb b/modules/two_factor_authentication/app/controllers/concerns/two_factor_authentication/webauthn_relying_party.rb
index 8fcde41b375..7339236ffd5 100644
--- a/modules/two_factor_authentication/app/controllers/concerns/two_factor_authentication/webauthn_relying_party.rb
+++ b/modules/two_factor_authentication/app/controllers/concerns/two_factor_authentication/webauthn_relying_party.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
module ::TwoFactorAuthentication
module WebauthnRelyingParty
extend ActiveSupport::Concern
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 d224bbbde88..d5d923b45d3 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
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
module ::TwoFactorAuthentication
class AuthenticationController < ApplicationController
# Remember token functionality
diff --git a/modules/two_factor_authentication/app/controllers/two_factor_authentication/base_controller.rb b/modules/two_factor_authentication/app/controllers/two_factor_authentication/base_controller.rb
index 70ca7017fe2..d0e9141dfa4 100644
--- a/modules/two_factor_authentication/app/controllers/two_factor_authentication/base_controller.rb
+++ b/modules/two_factor_authentication/app/controllers/two_factor_authentication/base_controller.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
module ::TwoFactorAuthentication
class BaseController < ApplicationController
include ::TwoFactorAuthentication::WebauthnRelyingParty
diff --git a/modules/two_factor_authentication/app/controllers/two_factor_authentication/forced_registration/two_factor_devices_controller.rb b/modules/two_factor_authentication/app/controllers/two_factor_authentication/forced_registration/two_factor_devices_controller.rb
index 5f1667d4a28..35cad0df34d 100644
--- a/modules/two_factor_authentication/app/controllers/two_factor_authentication/forced_registration/two_factor_devices_controller.rb
+++ b/modules/two_factor_authentication/app/controllers/two_factor_authentication/forced_registration/two_factor_devices_controller.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
module ::TwoFactorAuthentication
module ForcedRegistration
class TwoFactorDevicesController < ::TwoFactorAuthentication::BaseController
diff --git a/modules/two_factor_authentication/app/controllers/two_factor_authentication/my/backup_codes_controller.rb b/modules/two_factor_authentication/app/controllers/two_factor_authentication/my/backup_codes_controller.rb
index 0f46af2e804..56595e5e5b2 100644
--- a/modules/two_factor_authentication/app/controllers/two_factor_authentication/my/backup_codes_controller.rb
+++ b/modules/two_factor_authentication/app/controllers/two_factor_authentication/my/backup_codes_controller.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
module ::TwoFactorAuthentication
module My
class BackupCodesController < ::ApplicationController
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 e3d5ac206ee..be25b85f90a 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
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
module ::TwoFactorAuthentication
module My
class RememberCookieController < ::ApplicationController
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 5276fe1bb8e..e418ba6ce60 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
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
module ::TwoFactorAuthentication
module My
class TwoFactorDevicesController < ::TwoFactorAuthentication::BaseController
diff --git a/modules/two_factor_authentication/app/controllers/two_factor_authentication/two_factor_settings_controller.rb b/modules/two_factor_authentication/app/controllers/two_factor_authentication/two_factor_settings_controller.rb
index 15f90b972ef..5faeec1d584 100644
--- a/modules/two_factor_authentication/app/controllers/two_factor_authentication/two_factor_settings_controller.rb
+++ b/modules/two_factor_authentication/app/controllers/two_factor_authentication/two_factor_settings_controller.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
module ::TwoFactorAuthentication
class TwoFactorSettingsController < ApplicationController
include EnterpriseTrialHelper
diff --git a/modules/two_factor_authentication/app/controllers/two_factor_authentication/users/two_factor_devices_controller.rb b/modules/two_factor_authentication/app/controllers/two_factor_authentication/users/two_factor_devices_controller.rb
index f839e48c522..4966f0e0435 100644
--- a/modules/two_factor_authentication/app/controllers/two_factor_authentication/users/two_factor_devices_controller.rb
+++ b/modules/two_factor_authentication/app/controllers/two_factor_authentication/users/two_factor_devices_controller.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
module ::TwoFactorAuthentication
module Users
class TwoFactorDevicesController < ::TwoFactorAuthentication::BaseController
diff --git a/modules/two_factor_authentication/app/models/two_factor_authentication.rb b/modules/two_factor_authentication/app/models/two_factor_authentication.rb
index b56bf137a29..ef66d8af681 100644
--- a/modules/two_factor_authentication/app/models/two_factor_authentication.rb
+++ b/modules/two_factor_authentication/app/models/two_factor_authentication.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
module TwoFactorAuthentication
def self.table_name_prefix
"two_factor_authentication_"
diff --git a/modules/two_factor_authentication/app/models/two_factor_authentication/backup_code.rb b/modules/two_factor_authentication/app/models/two_factor_authentication/backup_code.rb
index eac1fb01e63..0a80afb6065 100644
--- a/modules/two_factor_authentication/app/models/two_factor_authentication/backup_code.rb
+++ b/modules/two_factor_authentication/app/models/two_factor_authentication/backup_code.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
module TwoFactorAuthentication
class BackupCode < ::Token::HashedToken
class << self
diff --git a/modules/two_factor_authentication/app/models/two_factor_authentication/device.rb b/modules/two_factor_authentication/app/models/two_factor_authentication/device.rb
index 9c47b969f39..4f4563ae2e5 100644
--- a/modules/two_factor_authentication/app/models/two_factor_authentication/device.rb
+++ b/modules/two_factor_authentication/app/models/two_factor_authentication/device.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
module TwoFactorAuthentication
class Device < ApplicationRecord
default_scope { order("id ASC") }
diff --git a/modules/two_factor_authentication/app/models/two_factor_authentication/device/sms.rb b/modules/two_factor_authentication/app/models/two_factor_authentication/device/sms.rb
index b8640ef04dc..8ec3676810d 100644
--- a/modules/two_factor_authentication/app/models/two_factor_authentication/device/sms.rb
+++ b/modules/two_factor_authentication/app/models/two_factor_authentication/device/sms.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
module TwoFactorAuthentication
class Device::Sms < Device
validates_presence_of :phone_number
diff --git a/modules/two_factor_authentication/app/models/two_factor_authentication/device/totp.rb b/modules/two_factor_authentication/app/models/two_factor_authentication/device/totp.rb
index cfee774b991..00525ef427c 100644
--- a/modules/two_factor_authentication/app/models/two_factor_authentication/device/totp.rb
+++ b/modules/two_factor_authentication/app/models/two_factor_authentication/device/totp.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
require "rotp"
module TwoFactorAuthentication
diff --git a/modules/two_factor_authentication/app/models/two_factor_authentication/device/webauthn.rb b/modules/two_factor_authentication/app/models/two_factor_authentication/device/webauthn.rb
index d36848dbac0..897ed822884 100644
--- a/modules/two_factor_authentication/app/models/two_factor_authentication/device/webauthn.rb
+++ b/modules/two_factor_authentication/app/models/two_factor_authentication/device/webauthn.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
module TwoFactorAuthentication
class Device::Webauthn < Device
validates :webauthn_external_id, presence: true, uniqueness: { scope: :user_id }
diff --git a/modules/two_factor_authentication/app/models/two_factor_authentication/remembered_auth_token.rb b/modules/two_factor_authentication/app/models/two_factor_authentication/remembered_auth_token.rb
index 730d7a69b71..730a02715a7 100644
--- a/modules/two_factor_authentication/app/models/two_factor_authentication/remembered_auth_token.rb
+++ b/modules/two_factor_authentication/app/models/two_factor_authentication/remembered_auth_token.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
module TwoFactorAuthentication
class RememberedAuthToken < ::Token::HashedToken
include ::Token::ExpirableToken
diff --git a/modules/two_factor_authentication/app/services/two_factor_authentication/token_service.rb b/modules/two_factor_authentication/app/services/two_factor_authentication/token_service.rb
index 94fc4563cc4..0fb714a9b96 100644
--- a/modules/two_factor_authentication/app/services/two_factor_authentication/token_service.rb
+++ b/modules/two_factor_authentication/app/services/two_factor_authentication/token_service.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
module TwoFactorAuthentication
class TokenService
attr_reader :user, :device, :strategy, :channel
diff --git a/modules/two_factor_authentication/app/services/two_factor_authentication/use_backup_code_service.rb b/modules/two_factor_authentication/app/services/two_factor_authentication/use_backup_code_service.rb
index 19d9d160adb..150a6614340 100644
--- a/modules/two_factor_authentication/app/services/two_factor_authentication/use_backup_code_service.rb
+++ b/modules/two_factor_authentication/app/services/two_factor_authentication/use_backup_code_service.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
module TwoFactorAuthentication
class UseBackupCodeService
attr_reader :user
diff --git a/modules/two_factor_authentication/config/routes.rb b/modules/two_factor_authentication/config/routes.rb
index 27fbab7b143..40e8e03759a 100644
--- a/modules/two_factor_authentication/config/routes.rb
+++ b/modules/two_factor_authentication/config/routes.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
Rails.application.routes.draw do
namespace "two_factor_authentication" do
get :request, to: "authentication#request_otp"
diff --git a/modules/two_factor_authentication/db/migrate/20120214103300_aggregated_mobile_otp_migrations.rb b/modules/two_factor_authentication/db/migrate/20120214103300_aggregated_mobile_otp_migrations.rb
index ab2733c2c35..2736d783971 100644
--- a/modules/two_factor_authentication/db/migrate/20120214103300_aggregated_mobile_otp_migrations.rb
+++ b/modules/two_factor_authentication/db/migrate/20120214103300_aggregated_mobile_otp_migrations.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
#-- copyright
# OpenProject is an open source project management software.
# Copyright (C) the OpenProject GmbH
@@ -32,14 +34,14 @@ require "open_project/plugins/migration_mapping"
# This migration aggregates the migrations detailed in MIGRATION_FILES
class AggregatedMobileOtpMigrations < ActiveRecord::Migration[5.0]
- MIGRATION_FILES = <<-MIGRATIONS.freeze
+ MIGRATION_FILES = <<-MIGRATIONS
001_add_user_phone.rb
002_create_extended_tokens.rb
003_remove_user_phone.rb
004_add_user_verified_phone_unverified_phone.rb
MIGRATIONS
- OLD_PLUGIN_NAME = "redmine_two_factor_authentication_authentication".freeze
+ OLD_PLUGIN_NAME = "redmine_two_factor_authentication_authentication"
def up
migration_names = OpenProject::Plugins::MigrationMapping.migration_files_to_migration_names(MIGRATION_FILES, OLD_PLUGIN_NAME)
diff --git a/modules/two_factor_authentication/db/migrate/20130214130336_add_default_otp_channel_to_user.rb b/modules/two_factor_authentication/db/migrate/20130214130336_add_default_otp_channel_to_user.rb
index 13aa04cb1b8..27c85e7325a 100644
--- a/modules/two_factor_authentication/db/migrate/20130214130336_add_default_otp_channel_to_user.rb
+++ b/modules/two_factor_authentication/db/migrate/20130214130336_add_default_otp_channel_to_user.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
#-- copyright
# OpenProject is an open source project management software.
# Copyright (C) the OpenProject GmbH
diff --git a/modules/two_factor_authentication/db/migrate/20160331190036_change_default_channel.rb b/modules/two_factor_authentication/db/migrate/20160331190036_change_default_channel.rb
index a2eab34dbbb..8108e213903 100644
--- a/modules/two_factor_authentication/db/migrate/20160331190036_change_default_channel.rb
+++ b/modules/two_factor_authentication/db/migrate/20160331190036_change_default_channel.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
#-- copyright
# OpenProject is an open source project management software.
# Copyright (C) the OpenProject GmbH
diff --git a/modules/two_factor_authentication/db/migrate/20171023190036_model_reorganization.rb b/modules/two_factor_authentication/db/migrate/20171023190036_model_reorganization.rb
index dee341deab5..e440d7c7ec1 100644
--- a/modules/two_factor_authentication/db/migrate/20171023190036_model_reorganization.rb
+++ b/modules/two_factor_authentication/db/migrate/20171023190036_model_reorganization.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
#-- copyright
# OpenProject is an open source project management software.
# Copyright (C) the OpenProject GmbH
diff --git a/modules/two_factor_authentication/db/migrate/20230627133534_add_webauthn_fields_to_two_factor_table.rb b/modules/two_factor_authentication/db/migrate/20230627133534_add_webauthn_fields_to_two_factor_table.rb
index 219b266ed19..a9226166542 100644
--- a/modules/two_factor_authentication/db/migrate/20230627133534_add_webauthn_fields_to_two_factor_table.rb
+++ b/modules/two_factor_authentication/db/migrate/20230627133534_add_webauthn_fields_to_two_factor_table.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
class AddWebauthnFieldsToTwoFactorTable < ActiveRecord::Migration[7.0]
def change
add_column :two_factor_authentication_devices, :webauthn_external_id, :string, null: true
diff --git a/modules/two_factor_authentication/lib/open_project/two_factor_authentication.rb b/modules/two_factor_authentication/lib/open_project/two_factor_authentication.rb
index 2891863acfa..441e029cadc 100644
--- a/modules/two_factor_authentication/lib/open_project/two_factor_authentication.rb
+++ b/modules/two_factor_authentication/lib/open_project/two_factor_authentication.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
module OpenProject
module TwoFactorAuthentication
require "open_project/two_factor_authentication/engine"
diff --git a/modules/two_factor_authentication/lib/open_project/two_factor_authentication/engine.rb b/modules/two_factor_authentication/lib/open_project/two_factor_authentication/engine.rb
index ec64abd58a9..aad5c2e382c 100644
--- a/modules/two_factor_authentication/lib/open_project/two_factor_authentication/engine.rb
+++ b/modules/two_factor_authentication/lib/open_project/two_factor_authentication/engine.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
require "open_project/plugins"
require "webauthn"
diff --git a/modules/two_factor_authentication/lib/open_project/two_factor_authentication/patches.rb b/modules/two_factor_authentication/lib/open_project/two_factor_authentication/patches.rb
index 0354c6c5e4f..a4985b20d11 100644
--- a/modules/two_factor_authentication/lib/open_project/two_factor_authentication/patches.rb
+++ b/modules/two_factor_authentication/lib/open_project/two_factor_authentication/patches.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
module OpenProject::TwoFactorAuthentication
module Patches
end
diff --git a/modules/two_factor_authentication/lib/open_project/two_factor_authentication/patches/user_patch.rb b/modules/two_factor_authentication/lib/open_project/two_factor_authentication/patches/user_patch.rb
index 6c4f8d00195..f0c43263d8e 100644
--- a/modules/two_factor_authentication/lib/open_project/two_factor_authentication/patches/user_patch.rb
+++ b/modules/two_factor_authentication/lib/open_project/two_factor_authentication/patches/user_patch.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
module OpenProject::TwoFactorAuthentication::Patches
module UserPatch
def self.included(base)
diff --git a/modules/two_factor_authentication/lib/open_project/two_factor_authentication/token_strategy/base.rb b/modules/two_factor_authentication/lib/open_project/two_factor_authentication/token_strategy/base.rb
index d2db4909003..2e9d5fb86fb 100644
--- a/modules/two_factor_authentication/lib/open_project/two_factor_authentication/token_strategy/base.rb
+++ b/modules/two_factor_authentication/lib/open_project/two_factor_authentication/token_strategy/base.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
module OpenProject::TwoFactorAuthentication
module TokenStrategy
class Base
diff --git a/modules/two_factor_authentication/lib/open_project/two_factor_authentication/token_strategy/developer.rb b/modules/two_factor_authentication/lib/open_project/two_factor_authentication/token_strategy/developer.rb
index 0c8915314f7..c292084bc39 100644
--- a/modules/two_factor_authentication/lib/open_project/two_factor_authentication/token_strategy/developer.rb
+++ b/modules/two_factor_authentication/lib/open_project/two_factor_authentication/token_strategy/developer.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
module OpenProject::TwoFactorAuthentication
module TokenStrategy
class Developer < Base
diff --git a/modules/two_factor_authentication/lib/open_project/two_factor_authentication/token_strategy/message_bird.rb b/modules/two_factor_authentication/lib/open_project/two_factor_authentication/token_strategy/message_bird.rb
index 33636064419..b3591592014 100644
--- a/modules/two_factor_authentication/lib/open_project/two_factor_authentication/token_strategy/message_bird.rb
+++ b/modules/two_factor_authentication/lib/open_project/two_factor_authentication/token_strategy/message_bird.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
require "messagebird"
module OpenProject::TwoFactorAuthentication
diff --git a/modules/two_factor_authentication/lib/open_project/two_factor_authentication/token_strategy/sns.rb b/modules/two_factor_authentication/lib/open_project/two_factor_authentication/token_strategy/sns.rb
index bf75a9ce96d..f383f164ef7 100644
--- a/modules/two_factor_authentication/lib/open_project/two_factor_authentication/token_strategy/sns.rb
+++ b/modules/two_factor_authentication/lib/open_project/two_factor_authentication/token_strategy/sns.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
require "net/http"
require "aws-sdk-sns"
diff --git a/modules/two_factor_authentication/lib/open_project/two_factor_authentication/token_strategy/totp.rb b/modules/two_factor_authentication/lib/open_project/two_factor_authentication/token_strategy/totp.rb
index d1431aad5fb..2bd7b7a2d51 100644
--- a/modules/two_factor_authentication/lib/open_project/two_factor_authentication/token_strategy/totp.rb
+++ b/modules/two_factor_authentication/lib/open_project/two_factor_authentication/token_strategy/totp.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
require "rotp"
module OpenProject::TwoFactorAuthentication
diff --git a/modules/two_factor_authentication/lib/open_project/two_factor_authentication/token_strategy/webauthn.rb b/modules/two_factor_authentication/lib/open_project/two_factor_authentication/token_strategy/webauthn.rb
index 6a511ee7813..e39a887aa3f 100644
--- a/modules/two_factor_authentication/lib/open_project/two_factor_authentication/token_strategy/webauthn.rb
+++ b/modules/two_factor_authentication/lib/open_project/two_factor_authentication/token_strategy/webauthn.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
require "webauthn"
module OpenProject::TwoFactorAuthentication
diff --git a/modules/two_factor_authentication/lib/open_project/two_factor_authentication/token_strategy_manager.rb b/modules/two_factor_authentication/lib/open_project/two_factor_authentication/token_strategy_manager.rb
index a212beced7e..c4ea44909dc 100644
--- a/modules/two_factor_authentication/lib/open_project/two_factor_authentication/token_strategy_manager.rb
+++ b/modules/two_factor_authentication/lib/open_project/two_factor_authentication/token_strategy_manager.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
module OpenProject::TwoFactorAuthentication
module TokenStrategyManager
class << self
diff --git a/modules/two_factor_authentication/lib/openproject-two_factor_authentication.rb b/modules/two_factor_authentication/lib/openproject-two_factor_authentication.rb
index e5913b2cef8..bfb79a8f354 100644
--- a/modules/two_factor_authentication/lib/openproject-two_factor_authentication.rb
+++ b/modules/two_factor_authentication/lib/openproject-two_factor_authentication.rb
@@ -1 +1,3 @@
+# frozen_string_literal: true
+
require "open_project/two_factor_authentication"
diff --git a/modules/two_factor_authentication/openproject-two_factor_authentication.gemspec b/modules/two_factor_authentication/openproject-two_factor_authentication.gemspec
index a458dfdea44..5672ec012a5 100644
--- a/modules/two_factor_authentication/openproject-two_factor_authentication.gemspec
+++ b/modules/two_factor_authentication/openproject-two_factor_authentication.gemspec
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
Gem::Specification.new do |s|
s.name = "openproject-two_factor_authentication"
s.version = "1.0.0"
diff --git a/modules/two_factor_authentication/spec/controllers/two_factor_authentication/authentication_controller_shared_examples.rb b/modules/two_factor_authentication/spec/controllers/two_factor_authentication/authentication_controller_shared_examples.rb
index 4224071927c..f8cc51f3190 100644
--- a/modules/two_factor_authentication/spec/controllers/two_factor_authentication/authentication_controller_shared_examples.rb
+++ b/modules/two_factor_authentication/spec/controllers/two_factor_authentication/authentication_controller_shared_examples.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
require_relative "../../spec_helper"
RSpec.shared_examples "immediate success login" do
diff --git a/modules/two_factor_authentication/spec/controllers/two_factor_authentication/authentication_controller_spec.rb b/modules/two_factor_authentication/spec/controllers/two_factor_authentication/authentication_controller_spec.rb
index 403abd3d869..ec8026c9629 100644
--- a/modules/two_factor_authentication/spec/controllers/two_factor_authentication/authentication_controller_spec.rb
+++ b/modules/two_factor_authentication/spec/controllers/two_factor_authentication/authentication_controller_spec.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
require_relative "../../spec_helper"
require_relative "authentication_controller_shared_examples"
diff --git a/modules/two_factor_authentication/spec/controllers/two_factor_authentication/forced_registration/two_factor_devices_controller_spec.rb b/modules/two_factor_authentication/spec/controllers/two_factor_authentication/forced_registration/two_factor_devices_controller_spec.rb
index 0cf89ac791e..ee13d095160 100644
--- a/modules/two_factor_authentication/spec/controllers/two_factor_authentication/forced_registration/two_factor_devices_controller_spec.rb
+++ b/modules/two_factor_authentication/spec/controllers/two_factor_authentication/forced_registration/two_factor_devices_controller_spec.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
require_relative "../../../spec_helper"
require_relative "../authentication_controller_shared_examples"
diff --git a/modules/two_factor_authentication/spec/controllers/two_factor_authentication/my/remember_cookie_controller_spec.rb b/modules/two_factor_authentication/spec/controllers/two_factor_authentication/my/remember_cookie_controller_spec.rb
index 8a8ff06ef27..43d4274d5cc 100644
--- a/modules/two_factor_authentication/spec/controllers/two_factor_authentication/my/remember_cookie_controller_spec.rb
+++ b/modules/two_factor_authentication/spec/controllers/two_factor_authentication/my/remember_cookie_controller_spec.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
require_relative "../../../spec_helper"
require_relative "../authentication_controller_shared_examples"
diff --git a/modules/two_factor_authentication/spec/controllers/two_factor_authentication/my/two_factor_devices_controller_spec.rb b/modules/two_factor_authentication/spec/controllers/two_factor_authentication/my/two_factor_devices_controller_spec.rb
index 24b4d4200fc..11b01bdc693 100644
--- a/modules/two_factor_authentication/spec/controllers/two_factor_authentication/my/two_factor_devices_controller_spec.rb
+++ b/modules/two_factor_authentication/spec/controllers/two_factor_authentication/my/two_factor_devices_controller_spec.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
require_relative "../../../spec_helper"
require_relative "../authentication_controller_shared_examples"
diff --git a/modules/two_factor_authentication/spec/controllers/two_factor_authentication/users/two_factor_devices_controller_spec.rb b/modules/two_factor_authentication/spec/controllers/two_factor_authentication/users/two_factor_devices_controller_spec.rb
index ee7f4cdee9e..831b1d3ba95 100644
--- a/modules/two_factor_authentication/spec/controllers/two_factor_authentication/users/two_factor_devices_controller_spec.rb
+++ b/modules/two_factor_authentication/spec/controllers/two_factor_authentication/users/two_factor_devices_controller_spec.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
require_relative "../../../spec_helper"
require_relative "../authentication_controller_shared_examples"
diff --git a/modules/two_factor_authentication/spec/factories/two_factor_authentication_device_factory.rb b/modules/two_factor_authentication/spec/factories/two_factor_authentication_device_factory.rb
index f4ab1f841e4..ae3d4763bfa 100644
--- a/modules/two_factor_authentication/spec/factories/two_factor_authentication_device_factory.rb
+++ b/modules/two_factor_authentication/spec/factories/two_factor_authentication_device_factory.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
FactoryBot.define do
factory :two_factor_authentication_device_sms, class: "::TwoFactorAuthentication::Device::Sms" do
user
diff --git a/modules/two_factor_authentication/spec/features/account_activation_spec.rb b/modules/two_factor_authentication/spec/features/account_activation_spec.rb
index 5f48bd39710..8721b9abc2b 100644
--- a/modules/two_factor_authentication/spec/features/account_activation_spec.rb
+++ b/modules/two_factor_authentication/spec/features/account_activation_spec.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
require_relative "../spec_helper"
require_relative "shared_two_factor_examples"
diff --git a/modules/two_factor_authentication/spec/features/admin_edit_two_factor_devices_spec.rb b/modules/two_factor_authentication/spec/features/admin_edit_two_factor_devices_spec.rb
index 5fe4bad5d5f..069013ef20b 100644
--- a/modules/two_factor_authentication/spec/features/admin_edit_two_factor_devices_spec.rb
+++ b/modules/two_factor_authentication/spec/features/admin_edit_two_factor_devices_spec.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
require_relative "../spec_helper"
RSpec.describe "Admin 2FA management", :js, :selenium, with_settings: {
diff --git a/modules/two_factor_authentication/spec/features/backup_codes/generate_backup_codes_spec.rb b/modules/two_factor_authentication/spec/features/backup_codes/generate_backup_codes_spec.rb
index 674aebd2ee2..7d9b4fe5dd0 100644
--- a/modules/two_factor_authentication/spec/features/backup_codes/generate_backup_codes_spec.rb
+++ b/modules/two_factor_authentication/spec/features/backup_codes/generate_backup_codes_spec.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
require_relative "../../spec_helper"
require_relative "../shared_two_factor_examples"
diff --git a/modules/two_factor_authentication/spec/features/backup_codes/login_with_backup_code_spec.rb b/modules/two_factor_authentication/spec/features/backup_codes/login_with_backup_code_spec.rb
index 49f20c26e90..b47c2ea38ce 100644
--- a/modules/two_factor_authentication/spec/features/backup_codes/login_with_backup_code_spec.rb
+++ b/modules/two_factor_authentication/spec/features/backup_codes/login_with_backup_code_spec.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
require_relative "../../spec_helper"
require_relative "../shared_two_factor_examples"
diff --git a/modules/two_factor_authentication/spec/features/login/login_enforced_2fa_spec.rb b/modules/two_factor_authentication/spec/features/login/login_enforced_2fa_spec.rb
index 01cb543d525..c1c20f1f2a5 100644
--- a/modules/two_factor_authentication/spec/features/login/login_enforced_2fa_spec.rb
+++ b/modules/two_factor_authentication/spec/features/login/login_enforced_2fa_spec.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
require_relative "../../spec_helper"
require_relative "../shared_two_factor_examples"
diff --git a/modules/two_factor_authentication/spec/features/login/login_with_2fa_spec.rb b/modules/two_factor_authentication/spec/features/login/login_with_2fa_spec.rb
index 0e0b099067f..379f65ad9de 100644
--- a/modules/two_factor_authentication/spec/features/login/login_with_2fa_spec.rb
+++ b/modules/two_factor_authentication/spec/features/login/login_with_2fa_spec.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
require_relative "../../spec_helper"
require_relative "../shared_two_factor_examples"
diff --git a/modules/two_factor_authentication/spec/features/login/login_with_deleted_2fa_spec.rb b/modules/two_factor_authentication/spec/features/login/login_with_deleted_2fa_spec.rb
index 56a3b748739..7bce301f54d 100644
--- a/modules/two_factor_authentication/spec/features/login/login_with_deleted_2fa_spec.rb
+++ b/modules/two_factor_authentication/spec/features/login/login_with_deleted_2fa_spec.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
require_relative "../../spec_helper"
require_relative "../shared_two_factor_examples"
diff --git a/modules/two_factor_authentication/spec/features/login/login_without_2fa_spec.rb b/modules/two_factor_authentication/spec/features/login/login_without_2fa_spec.rb
index 6ae5091bce3..a9342ff89ea 100644
--- a/modules/two_factor_authentication/spec/features/login/login_without_2fa_spec.rb
+++ b/modules/two_factor_authentication/spec/features/login/login_without_2fa_spec.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
require_relative "../../spec_helper"
require_relative "../shared_two_factor_examples"
diff --git a/modules/two_factor_authentication/spec/features/login/switch_available_devices_spec.rb b/modules/two_factor_authentication/spec/features/login/switch_available_devices_spec.rb
index 070f751864e..630e068ecbb 100644
--- a/modules/two_factor_authentication/spec/features/login/switch_available_devices_spec.rb
+++ b/modules/two_factor_authentication/spec/features/login/switch_available_devices_spec.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
require_relative "../../spec_helper"
require_relative "../shared_two_factor_examples"
diff --git a/modules/two_factor_authentication/spec/features/my_two_factor_devices_spec.rb b/modules/two_factor_authentication/spec/features/my_two_factor_devices_spec.rb
index e14e3c8e7b4..995e095642b 100644
--- a/modules/two_factor_authentication/spec/features/my_two_factor_devices_spec.rb
+++ b/modules/two_factor_authentication/spec/features/my_two_factor_devices_spec.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
require_relative "../spec_helper"
RSpec.describe "My Account 2FA configuration",
diff --git a/modules/two_factor_authentication/spec/features/password_change_spec.rb b/modules/two_factor_authentication/spec/features/password_change_spec.rb
index 877fdec02cd..d5c2215efc0 100644
--- a/modules/two_factor_authentication/spec/features/password_change_spec.rb
+++ b/modules/two_factor_authentication/spec/features/password_change_spec.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
require_relative "../spec_helper"
RSpec.describe "Password change with OTP", :js, with_settings: {
diff --git a/modules/two_factor_authentication/spec/features/remember_cookie/login_with_remember_cookie_spec.rb b/modules/two_factor_authentication/spec/features/remember_cookie/login_with_remember_cookie_spec.rb
index 60a0a7c928e..b0c37dfd7e9 100644
--- a/modules/two_factor_authentication/spec/features/remember_cookie/login_with_remember_cookie_spec.rb
+++ b/modules/two_factor_authentication/spec/features/remember_cookie/login_with_remember_cookie_spec.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
require_relative "../../spec_helper"
require_relative "../shared_two_factor_examples"
diff --git a/modules/two_factor_authentication/spec/features/shared_two_factor_examples.rb b/modules/two_factor_authentication/spec/features/shared_two_factor_examples.rb
index 4e9d97989b2..bcdc510f050 100644
--- a/modules/two_factor_authentication/spec/features/shared_two_factor_examples.rb
+++ b/modules/two_factor_authentication/spec/features/shared_two_factor_examples.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
module SharedTwoFactorExamples
def first_login_step
visit signin_path
diff --git a/modules/two_factor_authentication/spec/lib/token_strategies/message_bird_spec.rb b/modules/two_factor_authentication/spec/lib/token_strategies/message_bird_spec.rb
index 4134dc85c17..7aafd319045 100644
--- a/modules/two_factor_authentication/spec/lib/token_strategies/message_bird_spec.rb
+++ b/modules/two_factor_authentication/spec/lib/token_strategies/message_bird_spec.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
require_relative "../../spec_helper"
require "messagebird"
diff --git a/modules/two_factor_authentication/spec/lib/token_strategy_manager_spec.rb b/modules/two_factor_authentication/spec/lib/token_strategy_manager_spec.rb
index 103e3a36558..84872b658e8 100644
--- a/modules/two_factor_authentication/spec/lib/token_strategy_manager_spec.rb
+++ b/modules/two_factor_authentication/spec/lib/token_strategy_manager_spec.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
require_relative "../spec_helper"
RSpec.describe OpenProject::TwoFactorAuthentication::TokenStrategyManager do
diff --git a/modules/two_factor_authentication/spec/models/device/default_device_spec.rb b/modules/two_factor_authentication/spec/models/device/default_device_spec.rb
index a4735a54070..5ab5aa65934 100644
--- a/modules/two_factor_authentication/spec/models/device/default_device_spec.rb
+++ b/modules/two_factor_authentication/spec/models/device/default_device_spec.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
require "spec_helper"
RSpec.describe "Default device" do
diff --git a/modules/two_factor_authentication/spec/models/device/totp_spec.rb b/modules/two_factor_authentication/spec/models/device/totp_spec.rb
index aad1993cdc4..0a8ebb3462c 100644
--- a/modules/two_factor_authentication/spec/models/device/totp_spec.rb
+++ b/modules/two_factor_authentication/spec/models/device/totp_spec.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
require "spec_helper"
require "timecop"
diff --git a/modules/two_factor_authentication/spec/models/device/webauthn_spec.rb b/modules/two_factor_authentication/spec/models/device/webauthn_spec.rb
index bbe39d92765..eda80eeb533 100644
--- a/modules/two_factor_authentication/spec/models/device/webauthn_spec.rb
+++ b/modules/two_factor_authentication/spec/models/device/webauthn_spec.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
require "spec_helper"
RSpec.describe TwoFactorAuthentication::Device::Webauthn do
diff --git a/modules/two_factor_authentication/spec/models/login_token_spec.rb b/modules/two_factor_authentication/spec/models/login_token_spec.rb
index 0993139166b..ab5ed54c8d8 100644
--- a/modules/two_factor_authentication/spec/models/login_token_spec.rb
+++ b/modules/two_factor_authentication/spec/models/login_token_spec.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
require_relative "../spec_helper"
RSpec.describe TwoFactorAuthentication::LoginToken, :with_2fa_ee do
diff --git a/modules/two_factor_authentication/spec/models/user_spec.rb b/modules/two_factor_authentication/spec/models/user_spec.rb
index 32ef36ec6eb..39da5bbbf6c 100644
--- a/modules/two_factor_authentication/spec/models/user_spec.rb
+++ b/modules/two_factor_authentication/spec/models/user_spec.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
require_relative "../spec_helper"
module OpenProject::TwoFactorAuthentication::Patches
diff --git a/modules/two_factor_authentication/spec/routing/two_factor_authentication/my/two_factor_devices_spec.rb b/modules/two_factor_authentication/spec/routing/two_factor_authentication/my/two_factor_devices_spec.rb
index fba344252df..b5894e3de6c 100644
--- a/modules/two_factor_authentication/spec/routing/two_factor_authentication/my/two_factor_devices_spec.rb
+++ b/modules/two_factor_authentication/spec/routing/two_factor_authentication/my/two_factor_devices_spec.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
#-- copyright
# OpenProject is an open source project management software.
# Copyright (C) the OpenProject GmbH
diff --git a/modules/two_factor_authentication/spec/routing/two_factor_authentication/users/two_factor_devices_spec.rb b/modules/two_factor_authentication/spec/routing/two_factor_authentication/users/two_factor_devices_spec.rb
index 3f37bd3884b..6323feaacb7 100644
--- a/modules/two_factor_authentication/spec/routing/two_factor_authentication/users/two_factor_devices_spec.rb
+++ b/modules/two_factor_authentication/spec/routing/two_factor_authentication/users/two_factor_devices_spec.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
#-- copyright
# OpenProject is an open source project management software.
# Copyright (C) the OpenProject GmbH
diff --git a/modules/two_factor_authentication/spec/services/token_service_spec.rb b/modules/two_factor_authentication/spec/services/token_service_spec.rb
index f9e0f525c8d..fdda1e185e9 100644
--- a/modules/two_factor_authentication/spec/services/token_service_spec.rb
+++ b/modules/two_factor_authentication/spec/services/token_service_spec.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
require_relative "../spec_helper"
RSpec.describe TwoFactorAuthentication::TokenService do
diff --git a/modules/two_factor_authentication/spec/spec_helper.rb b/modules/two_factor_authentication/spec/spec_helper.rb
index f74661bbe40..2630ec8ea75 100644
--- a/modules/two_factor_authentication/spec/spec_helper.rb
+++ b/modules/two_factor_authentication/spec/spec_helper.rb
@@ -1,3 +1,5 @@
+# frozen_string_literal: true
+
# -- load spec_helper from OpenProject core
require "spec_helper"
require "webauthn/fake_client"