-
Notifications
You must be signed in to change notification settings - Fork 23
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
Prevent adding empty renamed attribute #1322
Conversation
272a819
to
0d700e4
Compare
$oldAttributeName | ||
) | ||
); | ||
unset($attributes[$oldAttributeName]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@thijskh in this testcase; edupersontargetedId is in the assertion but is set to be an empty array as value.
The enforcer now tests if the value is empty, and pops it out of the assertion. Is that expected behavior for Engine? I think, prior to this change. EB would allow this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed. The problem only occurs when the attribute is completely unset. So I would limit the solution to that only.
$oldAttributeName | ||
) | ||
); | ||
unset($attributes[$oldAttributeName]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed. The problem only occurs when the attribute is completely unset. So I would limit the solution to that only.
@@ -37,6 +37,29 @@ public function enforce(array $attributes, array $releaseAsOverrides) | |||
{ | |||
foreach ($releaseAsOverrides as $oldAttributeName => $overrideValue) { | |||
$newAttributeName = $overrideValue[0]['release_as']; | |||
if (!array_key_exists($oldAttributeName, $attributes)) { | |||
$this->logger->warning( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is in principle also 'normal' behaviour. The ARP specification of release_as basically should be read as "If this attribute is released, then use this name". So if it's not present it should not be causing warning level messages. Info is probably fine.
0d700e4
to
4a1307c
Compare
4a1307c
to
653e72c
Compare
tests/unit/OpenConext/EngineBlock/Service/ReleaseAsEnforcerTest.php
Outdated
Show resolved
Hide resolved
653e72c
to
9f9ca82
Compare
Issue: #1321 describes it perfectly. When Manage configures an override for an attribute name. But the targetted attribute is not in the assertion, then Engine would add an empty attribute with the overridden value to the assertion. The SAML2 lib would then warn us that an empty attribute value can not be processed. To fix that. I added a test statement that verifies if the targetted attribute is present in the assertion. If not, the substitution is not made and a warning is logged. It is not allowed to rename an attribute with a null value. It is allowed to rename an empty attribute. See: #1321
9f9ca82
to
550c91a
Compare
When Manage configures an override for an attribute name. But the targetted attribute is not in the assertion, then Engine would add an empty attribute with the overridden value to the assertion. The SAML2 lib would then warn us that an empty attribute value can not be processed.
To fix that. I added a test statement that verifies if the targetted attribute is present in the assertion. If not, the substitution is not made and a warning is logged.
See, Fixes: #1321