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

[BUG] multi-saml strategy cannot be used by concurrent requests #425

Closed
gunzip opened this issue Feb 25, 2020 · 4 comments
Closed

[BUG] multi-saml strategy cannot be used by concurrent requests #425

gunzip opened this issue Feb 25, 2020 · 4 comments

Comments

@gunzip
Copy link
Contributor

gunzip commented Feb 25, 2020

It looks like Multisaml strategy (which is a singleton object) calls override the shared property this._saml: https://github.com/bergie/passport-saml/blob/master/multiSamlStrategy.js#L34
In case of concurrent HTTP calls is there any chance that this value gets overridden by a subsequent call ?

cc @stavros-wb

@stavros-wb
Copy link
Contributor

stavros-wb commented Feb 26, 2020

Yes.. 😔 We should do something like:

newStrategy = { ...self, _saml: new saml.SAML(Object.assign({}, self._options, samlOptions)) };
self.constructor.super_.prototype.authenticate.call(newStrategy, req, options);

The tricky part here is, we can't instantiate N strategies, cause they all get registered in passport and can override each other there. We only want to have the _saml property change dynamically and reuse the same methods for the rest of the calls.

@gunzip
Copy link
Contributor Author

gunzip commented Feb 26, 2020

Do you think this can be considered more a bug or a vulnerability ? I see at least the chance of a DoS (making fast calls to the login endpoint that override the saml client options for previous requests).

Anyway the MultiSamlStrategy as is should not be used in production, so I wonder if it's better to get rid of the modue entirely to discourage unsecure setups.

About using multiple passport strategy it is actually possible if you create multiple Passport() instances like in the example by @sp90 here: #276 (comment)

@gunzip gunzip changed the title [Question] concurrent calls in multi-saml strategy [BUG] multi-saml strategy cannot be used by concurrent requests Feb 26, 2020
stavros-wb added a commit to stavros-wb/passport-saml that referenced this issue Feb 26, 2020
stavros-wb added a commit to stavros-wb/passport-saml that referenced this issue Feb 26, 2020
stavros-wb added a commit to stavros-wb/passport-saml that referenced this issue Feb 26, 2020
stavros-wb added a commit to stavros-wb/passport-saml that referenced this issue Feb 26, 2020
markstos pushed a commit that referenced this issue Jul 21, 2020
* Fix multi saml strategy race conditions

#425

* Add warning for MultiSaml in Readme
@cjbarth
Copy link
Collaborator

cjbarth commented Sep 19, 2020

Given that a PR was merged to address this, is there more work associated with this, or can it be closed?

@markstos markstos closed this as completed Oct 7, 2020
@moomoo-dev
Copy link

Was this fixed, and if so does this make the warning on the website invalid? Just checking because the link is still valid but I see this was closed 2 years ago.

https://www.passportjs.org/packages/passport-saml/

⚠️ There's a race condition bug in versions < 1.3.3 which makes it vulnerable to DOS attacks: Please use > 1.3.3 if you want to use this issue

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

No branches or pull requests

5 participants