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

Disable scoping for broken IdPs #750

Closed

Conversation

LukeCarrier
Copy link
Contributor

We've recently hit an issue with older versions of AD FS failing to process AuthnRequests containing <Scoping> elements. It appears to have been fixed as of 4.0 according to the documentation and our testing.

Unfortunately a large number of our customers will not be upgrading for several years. It seems prudent that SimpleSAMLphp should at least allow users to opt-in to some degree of feature loss for a workaround. This patch introduces a new disable.scoping option that can be set either in the remote IdP metadata or SP configuration.

Patch based on work by @ghalse in #498

Copy link
Member

@tvdijen tvdijen left a comment

Choose a reason for hiding this comment

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

Asking you to convert NULL to null to be PSR-2 compliant would be nitpicking here, but if anyone else has comments on your code, please change this on the go...

@tvdijen
Copy link
Member

tvdijen commented Dec 17, 2017

Thanks Luke for your contribution, but as you have already read in #498 the question is whether we want to accomodate non SAML-compliant behaviour...
I assume you're using SimpleSAMLphp as a SAML-proxy here?

@LukeCarrier
Copy link
Contributor Author

LukeCarrier commented Dec 17, 2017

@tvdijen I just want to accelerate a decision either way. 😉

Given that at least two users of SimpleSAMLphp are patching it in production to workaround non-compliance I think there's a case to be made in favour of adoption a workaround. I appreciate that it's an ugly workaround, though.

Am happy to go with lowercase null; I was following conventions on the 1.15 release and cherry-picked changes onto master. Will do this shortly.

@tvdijen
Copy link
Member

tvdijen commented Dec 17, 2017

I understand your motivation Luke, it's just that SAML-proxying isn't supported and I'm not sure if @jaimeperez is willing to do so in future releases, given there are perfect alternatives for that.

We also have to take into consideration that support for Server 2012 R2 will end on 9-10-2018 (and we're not gonna rely on LTS).

My personal view on this is that we could have merged #498 when it was posted, but we shouldn't do this anymore... There are alternatives, both for SAML-proxying as for IdP's with scoping-support.

@LukeCarrier
Copy link
Contributor Author

I completely understand -- if this seems inappropriate in scope for this project this patch ought to be rejected.

The impression I got from reading the scoping documentation was that IdP proxy behaviour was supported as a "best effort" rather than being a first-class feature.

For what it's worth, SimpleSAMLphp seemed the most logical means of delivering a SAML 2 IdP proxy. We settled on this use case after looking for an easy means of providing our corporate clients with access to multiple internal applications with minimal complexity in the configuration. I don't know of any products that would better meet our requirements (bearing in mind the context of a large existing base of PHP applications and associated staffing and infrastructure resource).

Should this PR be rejected we'll likely maintain a fork including this or a similar patch.

@ghalse
Copy link
Contributor

ghalse commented Dec 18, 2017

First of all, there's obviously my +1 for this. We're running the patch I had in #498 in production. I've just never got round to converting it into a pull request.

@tvdijen my testing suggests that the scoping problem persists in Windows Server 2016/AD FS 4.0 as well as in Azure AD so the comment about end-of-support is a straw man. It's also indicative of the fact that engaging with Microsoft on this (as CAF have done) is not going anywhere.

I'll echo what @LukeCarrier says. There might be other ways to do SAML proxies, but SimpleSAMLphp is both widely used in this configuration and an obvious choice for many people. It offers a huge advantage of a relatively low learning curve for people who already have in-house PHP skills. I'll happily debate with @jaimeperez about this :).

In some ways I view making AD FS talk to the R&E SAML world more as a protocol bridge than a proxy. AD FS is Microsoft's own special protocol that looks a bit like SAML, and we need to make it talk to the rest of the world in a more standards-compliant way ;). If you view it in this way, then the proposed change isn't so much of a violation of specs... :)

There are many examples of software including standards-breaking options to work around deficiencies in other implementations. To my mind, this is a natural extension of the Robustness Principle. The key thing is not to violate standards by default and to always require users to explicitly configure non-standard behaviour. Which is what the patch does.

@tvdijen
Copy link
Member

tvdijen commented Dec 18, 2017

@ghalse Apparently yours and @LukeCarrier's tests contradict each other then...

@LukeCarrier
Copy link
Contributor Author

@ghalse I'd be interested in seeing what issues you encountered with AD FS 4.0 then -- our testing echoes Microsoft's communications in the release notes.

@ghalse
Copy link
Contributor

ghalse commented Jan 3, 2018

@LukeCarrier my conclusions are based on testing by one of our IdPs, and unfortunately, they're currently closed for end-of-year vacation so I can't follow up with them right now. However, as I recall it worked better than previous versions but still kicked up an exception under some circumstances.

Copy link
Member

@thijskh thijskh left a comment

Choose a reason for hiding this comment

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

I would like to see testcases for this, covering both the enabled and disabled state of the new setting. This should not be too hard since there are already cases present that touch the surrounding code. I can help with this if needed.

@@ -58,7 +66,8 @@ public function __construct($info, $config) {
$this->entityId = $this->metadata->getString('entityID');
$this->idp = $this->metadata->getString('idp', NULL);
$this->discoURL = $this->metadata->getString('discoURL', NULL);

$this->disableScoping = $this->metadata->getBoolean('disable.scoping', NULL);
Copy link
Member

@thijskh thijskh Jan 3, 2018

Choose a reason for hiding this comment

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

Would it make sense to default to false instead of NULL? Keeps the type of the var above also simpler.


$ar->setIDPList(array_unique(array_merge($this->metadata->getArray('IDPList', array()),
$idpMetadata->getArray('IDPList', array()),
(array) $IDPList)));
Copy link
Member

Choose a reason for hiding this comment

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

Should this not be inside the if-statement? Because if scoping is disabled, we'd never want to setIDPList?

@LukeCarrier
Copy link
Contributor Author

@thijskh thanks for the review, I'll aim to get amends to you by the end of the week. I'd really appreciate it if you could link me to relevant test cases as I'm not sure how to approach this.

@thijskh
Copy link
Member

thijskh commented Jan 3, 2018

@thijskh
Copy link
Member

thijskh commented Feb 14, 2018

@LukeCarrier Were you able to look into this yet?

@thijskh
Copy link
Member

thijskh commented Nov 21, 2018

Fixed in #985

@thijskh thijskh closed this Nov 21, 2018
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 20, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants