Skip to content

Conversation

@gerardo-navarro
Copy link
Contributor

@gerardo-navarro gerardo-navarro commented Nov 7, 2025

This pull request adds support for disabling Single Logout (SLO) in the SAML strategy by introducing a new configuration option. When SLO is disabled, the related endpoints will return an HTTP 501 Not Implemented response. The documentation and tests have been updated to reflect this new behavior.

Why this change is needed

  • Addresses open redirect risk described in Open Relay in SLO #240 (Option 3).
  • Many apps don’t use SLO; exposing unused endpoints increases attack surface.
  • Secure-by-default: redirects/logout flow only available when explicitly enabled.

What changed

  • New strategy option: slo_enabled.
  • SLO endpoints short‑circuit with 501 unless slo_enabled: true.
  • Specs added/reordered to cover disabled vs enabled scenarios.

How to validate locally

  1. In your OmniAuth initializer:
    • Omit slo_enabled (or set false) and hit /users/auth/saml/spslo → expect 501.
    • Set slo_enabled: true, restart, hit same endpoint → previous SLO behavior (redirect/logout flow).
  2. Try a crafted RelayState (e.g. ?RelayState=//attacker.test) with slo_enabled: false → no redirect (501).

@gerardo-navarro gerardo-navarro changed the title Gerardo navarro remove changes unrelated to slo enabled Add option :slo_enabled to opt-out (diable) from SLO endpoints Nov 7, 2025
@gerardo-navarro gerardo-navarro changed the title Add option :slo_enabled to opt-out (diable) from SLO endpoints Add option :slo_enabled to opt-out (diable) from SLO endpoints completely Nov 7, 2025
@gerardo-navarro
Copy link
Contributor Author

@fh1ch @bufferoverflow Hi 👋 Can you please have a look at this PR when you have the time.

@gerardo-navarro gerardo-navarro marked this pull request as ready for review November 7, 2025 15:07
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds the ability to disable Single Logout (SLO) functionality in the SAML OmniAuth strategy by introducing a new :slo_enabled configuration option that defaults to true.

  • Adds :slo_enabled option with a default value of true to maintain backward compatibility
  • Returns HTTP 501 Not Implemented when SLO is disabled for both /auth/saml/slo and /auth/saml/spslo endpoints
  • Includes comprehensive test coverage for the new disabled SLO behavior

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
lib/omniauth/strategies/saml.rb Adds slo_enabled option, helper methods to check if SLO is enabled, and logic to return 501 response when disabled
spec/omniauth/strategies/saml_spec.rb Adds test coverage for both SLO endpoints when SLO is disabled, verifying 501 status and response body
README.md Documents the new :slo_enabled configuration option and explains how disabling SLO affects endpoint behavior

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Contributor

@fh1ch fh1ch left a comment

Choose a reason for hiding this comment

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

@gerardo-navarro really nice work here, thanks a lot 🙇

All good from my end, over to @bufferoverflow for the final merge.

@bufferoverflow bufferoverflow merged commit c8f0e97 into omniauth:master Nov 7, 2025
11 checks passed
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.

3 participants