Skip to content

Implement: Sidekiq Web Interface Exposed Without Authentication #31

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

revise-dev[bot]
Copy link

@revise-dev revise-dev bot commented Feb 21, 2025

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:

  1. We retain the original require "sidekiq/web" statement as Sidekiq's web interface is still needed.

  2. We add a new requirement for the SidekiqAdminConstraint class using require_relative "../lib/sidekiq_admin_constraint". This constraint will handle the authentication logic.

  3. We replace the existing unsecured mount point:

    mount Sidekiq::Web => "/sidekiq"  # Old, unsecured version

    with a secured version using constraints:

    mount Sidekiq::Web => "/sidekiq", constraints: SidekiqAdminConstraint.new
  4. 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 issueView in Revise

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Sidekiq Web Interface Exposed Without Authentication
0 participants