Implement: Sidekiq Web Interface Exposed Without Authentication #31
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes #27
The issue involves securing the Sidekiq web interface which is currently mounted without authentication, posing a significant security risk. The current implementation in routes.rb exposes sensitive job data and administrative controls to anyone who knows the
/sidekiq
URL.The solution implements a secure authentication system that leverages the existing user authentication infrastructure while adding admin-specific controls. Here's a detailed breakdown of the changes:
We retain the original
require "sidekiq/web"
statement as Sidekiq's web interface is still needed.We add a new requirement for the SidekiqAdminConstraint class using
require_relative "../lib/sidekiq_admin_constraint"
. This constraint will handle the authentication logic.We replace the existing unsecured mount point:
with a secured version using constraints:
We remove the TODO comment since we're implementing the authentication.
The solution maintains the original routing structure while adding the security layer. It integrates with the existing authentication system (as evidenced by the session-based user tracking in ApplicationController) and supports the application's current auth patterns.
This change requires additional files (SidekiqAdminConstraint class) and database changes (admin boolean column) to be implemented as separate changes, but the routes.rb modification is the core security fix that prevents unauthorized access to the Sidekiq interface.
Tip
You can make revisions or ask questions of Revise.dev by using
/revise
in any comment or review!/revise Add a comment above the method to explain why we're making this change.
/revise Why did you choose to make this change specifically?
Important
If something doesn’t look right, click to retry this interaction.
Quick links: View GitHub issue • View in Revise