Skip to content
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

Matching wrong provider when name is a substring of another provider #153

Closed
tommymccallig opened this issue Feb 16, 2018 · 3 comments · Fixed by #154, qstream/omniauth-saml#2 or qstream/omniauth-saml#3

Comments

@tommymccallig
Copy link
Contributor

tommymccallig commented Feb 16, 2018

Because the check in other_phase uses current_path.start_with?(request_path), it will match a provider whose name is a substring of another provider.

https://github.com/omniauth/omniauth-saml/blob/master/lib/omniauth/strategies/saml.rb#L72

request_path is defined in https://github.com/omniauth/omniauth/blob/master/lib/omniauth/strategy.rb#L386
as

@request_path ||= options[:request_path].is_a?(String) ?
    options[:request_path] :
    "#{path_prefix}/#{name}"

This can result in the wrong provider being set in env['omniauth.strategy'] and the wrong setup phase being run, etc.

Example:

provider1
provider10

If the path is /auth/provider10/metadata, then we'll match provider1, set env['omniauth.strategy'] to provider1 and run its setup phase.

@md5
Copy link
Contributor

md5 commented Feb 19, 2018

This seems like a valid report. How come you opened your PR against a fork?

@md5 md5 reopened this Feb 19, 2018
@md5
Copy link
Contributor

md5 commented Feb 19, 2018

Ah, I see there's another PR

@tommymccallig
Copy link
Contributor Author

@md5 Hi Mike, I've opened it against a fork and merged it so we can get this into production on our end as soon as possible. Obviously it would be ideal to have it available here so we don't diverge -
let me know if there are any changes required and I'd be happy to make them.

tommymccallig added a commit to qstream/omniauth-saml that referenced this issue Feb 19, 2018
tommymccallig added a commit to qstream/omniauth-saml that referenced this issue Feb 19, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants