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

fix: xml encode entityId in shibboleth saml templates #2442

Merged
merged 1 commit into from
Oct 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -26,25 +26,25 @@

<Rule xsi:type="OR">
#foreach( $entityId in $trustParams.trustEntityIds.get($trustRelationship.inum) )
<Rule xsi:type="Requester" value="$entityId" />
<Rule xsi:type="Requester" value="$esc.xml($entityId)" />
#end
</Rule>
#else

<Rule xsi:type="Requester" value="$trustParams.trustEntityIds.get($trustRelationship.inum).get(0)" />
<Rule xsi:type="Requester" value="$esc.xml($trustParams.trustEntityIds.get($trustRelationship.inum).get(0))" />
#end
</PolicyRequirementRule>
#else
#if ($isFederation)

<PolicyRequirementRule xsi:type="OR">
#foreach( $entityId in $trustParams.trustEntityIds.get($trustRelationship.inum) )
<Rule xsi:type="Requester" value="$entityId" />
<Rule xsi:type="Requester" value="$esc.xml($entityId)" />
#end
</PolicyRequirementRule>
#else

<PolicyRequirementRule xsi:type="Requester" value="$trustParams.trustEntityIds.get($trustRelationship.inum).get(0)" />
<PolicyRequirementRule xsi:type="Requester" value="$esc.xml($trustParams.trustEntityIds.get($trustRelationship.inum).get(0))" />
#end
#end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@
#set($entityId = $trustRelationship.getEntityId())
#set($relyingPartyId = $StringHelper.removePunctuation($trustRelationship.inum))

<bean parent="RelyingPartyByName" id="$relyingPartyId" c:relyingPartyIds="$entityId">
<bean parent="RelyingPartyByName" id="$relyingPartyId" c:relyingPartyIds="$esc.xml($entityId)">
<property name="profileConfigurations">
<list>
#if($trustRelationship.specificRelyingPartyConfig and (not $trustRelationship.isFederation()))
Expand Down
7 changes: 7 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
<arquillian.drone.version>2.0.0.Final</arquillian.drone.version>
<arquillian.graphene.version>2.1.0.CR1</arquillian.graphene.version>
<shrinkwrap.version>2.1.0</shrinkwrap.version>
<velocity-tools.version>3.0</velocity-tools.version>

<sonar.projectKey>GluuFederation_oxTrust</sonar.projectKey>
<sonar.moduleKey>${project.groupId}:${project.artifactId}</sonar.moduleKey>
Expand Down Expand Up @@ -418,6 +419,12 @@
<artifactId>validation-api</artifactId>
<version>2.0.1.Final</version>
</dependency>

<dependency>
<groupId>org.apache.velocity.tools</groupId>
<artifactId>velocity-tools-generic</artifactId>
<version>${velocity-tools.version}</version>
</dependency>

<!-- Deprecated modules -->
<dependency>
Expand Down
5 changes: 5 additions & 0 deletions service/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,11 @@
<artifactId>velocity-engine-core</artifactId>
</dependency>

<dependency>
<groupId>org.apache.velocity.tools</groupId>
<artifactId>velocity-tools-generic</artifactId>
</dependency>

<!-- RestEasy -->
<dependency>
<groupId>org.jboss.resteasy</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
import org.apache.commons.io.IOUtils;
import org.apache.commons.io.LineIterator;
import org.apache.commons.lang3.StringUtils;
import org.apache.velocity.tools.generic.EscapeTool;
import org.apache.velocity.VelocityContext;
import org.gluu.config.oxtrust.AppConfiguration;
import org.gluu.config.oxtrust.AttributeResolverConfiguration;
Expand Down Expand Up @@ -687,6 +688,7 @@ private VelocityContext prepareVelocityContext(HashMap<String, Object> trustPara
VelocityContext context = new VelocityContext();

context.put("StringHelper", StringHelper.class);
context.put("esc",new EscapeTool());
context.put("salt", configurationFactory.getCryptoConfigurationSalt());

context.put("trustParams", trustParams);
Expand Down
Loading