Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ gem 'net-smtp', '~> 0.5.1'
gem 'omniauth', '~> 2.1.4'
Copy link

Copilot AI Dec 24, 2025

Choose a reason for hiding this comment

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

This Gemfile change (removing the omniauth-rails_csrf_protection gem) is unrelated to the PR's stated purpose of fixing the Redis connection pool. This should be in a separate pull request along with the related OmniAuth CSRF protection configuration changes in config/initializers/devise.rb.

Suggested change
gem 'omniauth', '~> 2.1.4'
gem 'omniauth', '~> 2.1.4'
gem 'omniauth-rails_csrf_protection'

Copilot uses AI. Check for mistakes.
gem 'omniauth-identity', '~> 3.1', '>= 3.1.5'
gem 'omniauth-oauth2', '~> 1.9.0'
gem 'omniauth-rails_csrf_protection', '~> 2.0', '>= 2.0.1'
gem 'paper_trail', '~> 17.0.0'
gem 'paranoia', '~> 3.1.0'
gem 'pg', '~> 1.6.2'
Expand Down
3 changes: 1 addition & 2 deletions config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ class Application < Rails::Application

config.cache_store = :redis_cache_store, {
url: Rails.application.config_for(:cable)['url'],
pool_size: ENV.fetch('RAILS_MAX_THREADS', 5).to_i,
pool_timeout: 5
pool: { size: ENV.fetch('RAILS_MAX_THREADS', 5).to_i, timeout: 5 }
}
config.active_job.queue_adapter = :sidekiq

Expand Down
3 changes: 3 additions & 0 deletions config/initializers/devise.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
# ==> OmniAuth
require_dependency Rails.root.join('config', 'initializers', 'omniauth_strategies', 'amber_oauth2.rb')

# CSRF protection (built-in solution for CVE-2015-9284)
OmniAuth.config.request_validation_phase = OmniAuth::AuthenticityTokenProtection.new(key: :_csrf_token)
Comment on lines +15 to +16
Copy link

Copilot AI Dec 24, 2025

Choose a reason for hiding this comment

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

This OmniAuth CSRF protection change is unrelated to the PR's stated purpose of fixing the Redis connection pool. These changes should be in a separate pull request focused on addressing CVE-2015-9284. Mixing unrelated changes makes it harder to review, test, and potentially revert changes if needed.

Copilot uses AI. Check for mistakes.
Copy link

Copilot AI Dec 24, 2025

Choose a reason for hiding this comment

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

The key parameter should likely be 'authenticity_token' (Rails' default CSRF token parameter name) instead of '_csrf_token'. Using a non-standard key may cause CSRF validation to fail because the OmniAuth middleware will look for a different parameter than what Rails provides. Verify that your views are generating a matching '_csrf_token' field, or update this to use the standard 'authenticity_token'.

Suggested change
OmniAuth.config.request_validation_phase = OmniAuth::AuthenticityTokenProtection.new(key: :_csrf_token)
OmniAuth.config.request_validation_phase = OmniAuth::AuthenticityTokenProtection.new(key: :authenticity_token)

Copilot uses AI. Check for mistakes.

config.omniauth :amber_oauth2, Rails.application.config.x.amber_client_id,
Rails.application.config.x.amber_client_secret
config.omniauth :identity, model: SofiaAccount, fields: %i[username user_id],
Expand Down
4 changes: 2 additions & 2 deletions config/initializers/sidekiq.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@

if redis_url
Sidekiq.configure_server do |config|
config.redis = {
config.redis = {
url: redis_url,
pool_timeout: 5
}
end

Sidekiq.configure_client do |config|
config.redis = {
config.redis = {
url: redis_url,
pool_timeout: 5
}
Expand Down