Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
8 changed files
with
397 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,178 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
check_bindings.xsl | ||
Checking ruleset that checks SAML 2.0 metadata Binding values. | ||
Author: Ian A. Young <ian@iay.org.uk> | ||
--> | ||
<xsl:stylesheet version="1.0" | ||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" | ||
xmlns:md="urn:oasis:names:tc:SAML:2.0:metadata" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xmlns="urn:oasis:names:tc:SAML:2.0:metadata"> | ||
|
||
<!-- | ||
Common support functions. | ||
--> | ||
<xsl:import href="check_framework.xsl"/> | ||
|
||
<xsl:template match="md:ArtifactResolutionService | ||
[@Binding != 'urn:oasis:names:tc:SAML:1.0:bindings:SOAP-binding'] | ||
[@Binding != 'urn:oasis:names:tc:SAML:2.0:bindings:SOAP'] | ||
"> | ||
<xsl:call-template name="error"> | ||
<xsl:with-param name="m"> | ||
<xsl:text>invalid binding '</xsl:text> | ||
<xsl:value-of select="@Binding"/> | ||
<xsl:text>' on </xsl:text> | ||
<xsl:value-of select="name()"/> | ||
</xsl:with-param> | ||
</xsl:call-template> | ||
</xsl:template> | ||
|
||
<xsl:template match="md:AssertionConsumerService | ||
[@Binding != 'http://schemas.xmlsoap.org/ws/2003/07/secext'] | ||
[@Binding != 'urn:oasis:names:tc:SAML:1.0:profiles:artifact-01'] | ||
[@Binding != 'urn:oasis:names:tc:SAML:1.0:profiles:browser-post'] | ||
[@Binding != 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Artifact'] | ||
[@Binding != 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST'] | ||
[@Binding != 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST-SimpleSign'] | ||
[@Binding != 'urn:oasis:names:tc:SAML:2.0:bindings:PAOS'] | ||
[@Binding != 'urn:oasis:names:tc:SAML:2.0:profiles:holder-of-key:SSO:browser'] | ||
"> | ||
<xsl:call-template name="error"> | ||
<xsl:with-param name="m"> | ||
<xsl:text>invalid binding '</xsl:text> | ||
<xsl:value-of select="@Binding"/> | ||
<xsl:text>' on </xsl:text> | ||
<xsl:value-of select="name()"/> | ||
</xsl:with-param> | ||
</xsl:call-template> | ||
</xsl:template> | ||
|
||
<xsl:template match="md:AssertionIDRequestService | ||
[@Binding != 'urn:oasis:names:tc:SAML:2.0:bindings:SOAP'] | ||
[@Binding != 'urn:oasis:names:tc:SAML:2.0:bindings:URI'] | ||
"> | ||
<xsl:call-template name="error"> | ||
<xsl:with-param name="m"> | ||
<xsl:text>invalid binding '</xsl:text> | ||
<xsl:value-of select="@Binding"/> | ||
<xsl:text>' on </xsl:text> | ||
<xsl:value-of select="name()"/> | ||
</xsl:with-param> | ||
</xsl:call-template> | ||
</xsl:template> | ||
|
||
<xsl:template match="md:AttributeService | ||
[@Binding != 'urn:oasis:names:tc:SAML:1.0:bindings:SOAP-binding'] | ||
[@Binding != 'urn:oasis:names:tc:SAML:2.0:bindings:SOAP'] | ||
"> | ||
<xsl:call-template name="error"> | ||
<xsl:with-param name="m"> | ||
<xsl:text>invalid binding '</xsl:text> | ||
<xsl:value-of select="@Binding"/> | ||
<xsl:text>' on </xsl:text> | ||
<xsl:value-of select="name()"/> | ||
</xsl:with-param> | ||
</xsl:call-template> | ||
</xsl:template> | ||
|
||
<xsl:template match="md:ManageNameIDService | ||
[@Binding != 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Artifact'] | ||
[@Binding != 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST'] | ||
[@Binding != 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST-SimpleSign'] | ||
[@Binding != 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect'] | ||
[@Binding != 'urn:oasis:names:tc:SAML:2.0:bindings:SOAP'] | ||
"> | ||
<xsl:call-template name="error"> | ||
<xsl:with-param name="m"> | ||
<xsl:text>invalid binding '</xsl:text> | ||
<xsl:value-of select="@Binding"/> | ||
<xsl:text>' on </xsl:text> | ||
<xsl:value-of select="name()"/> | ||
</xsl:with-param> | ||
</xsl:call-template> | ||
</xsl:template> | ||
|
||
<xsl:template match="md:NameIDMappingService | ||
[@Binding != 'urn:oasis:names:tc:SAML:2.0:bindings:SOAP'] | ||
"> | ||
<xsl:call-template name="error"> | ||
<xsl:with-param name="m"> | ||
<xsl:text>invalid binding '</xsl:text> | ||
<xsl:value-of select="@Binding"/> | ||
<xsl:text>' on </xsl:text> | ||
<xsl:value-of select="name()"/> | ||
</xsl:with-param> | ||
</xsl:call-template> | ||
</xsl:template> | ||
|
||
<xsl:template match="md:SingleLogoutService | ||
[@Binding != 'http://schemas.xmlsoap.org/ws/2003/07/secext'] | ||
[@Binding != 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Artifact'] | ||
[@Binding != 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST'] | ||
[@Binding != 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST-SimpleSign'] | ||
[@Binding != 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect'] | ||
[@Binding != 'urn:oasis:names:tc:SAML:2.0:bindings:SOAP'] | ||
"> | ||
<xsl:call-template name="error"> | ||
<xsl:with-param name="m"> | ||
<xsl:text>invalid binding '</xsl:text> | ||
<xsl:value-of select="@Binding"/> | ||
<xsl:text>' on </xsl:text> | ||
<xsl:value-of select="name()"/> | ||
</xsl:with-param> | ||
</xsl:call-template> | ||
</xsl:template> | ||
|
||
<xsl:template match="md:SingleSignOnService | ||
[@Binding != 'urn:mace:shibboleth:1.0:profiles:AuthnRequest'] | ||
[@Binding != 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Artifact'] | ||
[@Binding != 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST'] | ||
[@Binding != 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST-SimpleSign'] | ||
[@Binding != 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect'] | ||
[@Binding != 'urn:oasis:names:tc:SAML:2.0:bindings:SOAP'] | ||
[@Binding != 'urn:oasis:names:tc:SAML:2.0:profiles:holder-of-key:SSO:browser'] | ||
[@Binding != 'http://schemas.xmlsoap.org/ws/2003/07/secext'] | ||
"> | ||
<xsl:call-template name="error"> | ||
<xsl:with-param name="m"> | ||
<xsl:text>invalid binding '</xsl:text> | ||
<xsl:value-of select="@Binding"/> | ||
<xsl:text>' on </xsl:text> | ||
<xsl:value-of select="name()"/> | ||
</xsl:with-param> | ||
</xsl:call-template> | ||
</xsl:template> | ||
|
||
<!-- | ||
Issue warnings for all Bindings on elements other than the ones | ||
called out above, as they may well be accurate but need additional | ||
checks researched. | ||
--> | ||
<xsl:template match="md:* | ||
[@Binding] | ||
[local-name() != 'ArtifactResolutionService'] | ||
[local-name() != 'AssertionConsumerService'] | ||
[local-name() != 'AssertionIDRequestService'] | ||
[local-name() != 'AttributeService'] | ||
[local-name() != 'ManageNameIDService'] | ||
[local-name() != 'NameIDMappingService'] | ||
[local-name() != 'SingleLogoutService'] | ||
[local-name() != 'SingleSignOnService'] | ||
"> | ||
<xsl:call-template name="warning"> | ||
<xsl:with-param name="m"> | ||
<xsl:text>unknown binding '</xsl:text> | ||
<xsl:value-of select="@Binding"/> | ||
<xsl:text>' on </xsl:text> | ||
<xsl:value-of select="name()"/> | ||
</xsl:with-param> | ||
</xsl:call-template> | ||
</xsl:template> | ||
|
||
</xsl:stylesheet> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,128 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
check_framework.xsl | ||
XSL stylesheet providing a framework for use by rule checking files. | ||
Author: Ian A. Young <ian@iay.org.uk> | ||
--> | ||
<xsl:stylesheet version="1.0" | ||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" | ||
xmlns:md="urn:oasis:names:tc:SAML:2.0:metadata" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> | ||
|
||
<!-- | ||
The stylesheet output will be a text file, which will probably be thrown | ||
away in any case. The real output from the check is sent using the | ||
xsl:message element. | ||
--> | ||
<xsl:output method="text"/> | ||
|
||
|
||
<!-- | ||
Common template to call to report an error on some element within an entity. | ||
--> | ||
<xsl:template name="error"> | ||
<xsl:param name="m"/> | ||
<xsl:variable name="entity" select="ancestor-or-self::md:EntityDescriptor"/> | ||
<xsl:message terminate='no'> | ||
<xsl:text>[ERROR] </xsl:text> | ||
<!-- | ||
If we're processing an aggregate, we need to indicate which | ||
individual entity we're dealing with. | ||
--> | ||
<xsl:if test="ancestor-or-self::md:EntitiesDescriptor"> | ||
<!-- | ||
Use an ID if available, otherwise the entityID. | ||
--> | ||
<xsl:choose> | ||
<xsl:when test="$entity/@ID"> | ||
<xsl:value-of select="$entity/@ID"/> | ||
</xsl:when> | ||
<xsl:otherwise> | ||
<xsl:value-of select="$entity/@entityID"/> | ||
</xsl:otherwise> | ||
</xsl:choose> | ||
<xsl:text>: </xsl:text> | ||
</xsl:if> | ||
<xsl:value-of select="$m"/> | ||
</xsl:message> | ||
</xsl:template> | ||
|
||
|
||
<!-- | ||
Common template to call to report a warning on some element within an entity. | ||
--> | ||
<xsl:template name="warning"> | ||
<xsl:param name="m"/> | ||
<xsl:variable name="entity" select="ancestor-or-self::md:EntityDescriptor"/> | ||
<xsl:message terminate='no'> | ||
<xsl:text>[WARN] </xsl:text> | ||
<!-- | ||
If we're processing an aggregate, we need to indicate which | ||
individual entity we're dealing with. | ||
--> | ||
<xsl:if test="ancestor-or-self::md:EntitiesDescriptor"> | ||
<!-- | ||
Use an ID if available, otherwise the entityID. | ||
--> | ||
<xsl:choose> | ||
<xsl:when test="$entity/@ID"> | ||
<xsl:value-of select="$entity/@ID"/> | ||
</xsl:when> | ||
<xsl:otherwise> | ||
<xsl:value-of select="$entity/@entityID"/> | ||
</xsl:otherwise> | ||
</xsl:choose> | ||
<xsl:text>: </xsl:text> | ||
</xsl:if> | ||
<xsl:value-of select="$m"/> | ||
</xsl:message> | ||
</xsl:template> | ||
|
||
|
||
<!-- | ||
Common template to call to report an informational message on some element within an entity. | ||
--> | ||
<xsl:template name="info"> | ||
<xsl:param name="m"/> | ||
<xsl:variable name="entity" select="ancestor-or-self::md:EntityDescriptor"/> | ||
<xsl:message terminate='no'> | ||
<xsl:text>[INFO] </xsl:text> | ||
<!-- | ||
If we're processing an aggregate, we need to indicate which | ||
individual entity we're dealing with. | ||
--> | ||
<xsl:if test="ancestor-or-self::md:EntitiesDescriptor"> | ||
<!-- | ||
Use an ID if available, otherwise the entityID. | ||
--> | ||
<xsl:choose> | ||
<xsl:when test="$entity/@ID"> | ||
<xsl:value-of select="$entity/@ID"/> | ||
</xsl:when> | ||
<xsl:otherwise> | ||
<xsl:value-of select="$entity/@entityID"/> | ||
</xsl:otherwise> | ||
</xsl:choose> | ||
<xsl:text>: </xsl:text> | ||
</xsl:if> | ||
<xsl:value-of select="$m"/> | ||
</xsl:message> | ||
</xsl:template> | ||
|
||
|
||
<!-- Recurse down through all elements by default. --> | ||
<xsl:template match="*"> | ||
<xsl:apply-templates select="node()|@*"/> | ||
</xsl:template> | ||
|
||
|
||
<!-- Discard text blocks, comments and attributes by default. --> | ||
<xsl:template match="text()|comment()|@*"> | ||
<!-- do nothing --> | ||
</xsl:template> | ||
|
||
</xsl:stylesheet> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
Inject an "info" status. | ||
--> | ||
<xsl:stylesheet version="1.0" | ||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" | ||
xmlns:md="urn:oasis:names:tc:SAML:2.0:metadata" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xmlns="urn:oasis:names:tc:SAML:2.0:metadata"> | ||
|
||
<!-- | ||
Common support functions. | ||
--> | ||
<xsl:import href="../_rules/check_framework.xsl"/> | ||
|
||
<xsl:template match="md:EntityDescriptor"> | ||
<xsl:call-template name="info"> | ||
<xsl:with-param name="m"> | ||
<xsl:text>informational message for entity '</xsl:text> | ||
<xsl:value-of select="@entityID"/> | ||
<xsl:text>'</xsl:text> | ||
</xsl:with-param> | ||
</xsl:call-template> | ||
</xsl:template> | ||
|
||
</xsl:stylesheet> |
Oops, something went wrong.