Skip to content

Commit 414e2b7

Browse files
authored
Fix xss
Fix xss
2 parents 247855d + 0fc98a2 commit 414e2b7

File tree

3 files changed

+21
-1
lines changed

3 files changed

+21
-1
lines changed

spid-validator/server/app/idp_demo.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -649,6 +649,12 @@ module.exports = function(app, checkAuthorisation, getEntityDir, sendLogoutRespo
649649
assertionConsumerURL = metadataParser.getAssertionConsumerServiceURL(assertionConsumerIndex);
650650
}
651651

652+
// if no valid AssertionConsumerURL return error
653+
let existsAssertionConsumerServiceURL = metadataParser.existsAssertionConsumerServiceURL(assertionConsumerURL);
654+
if(!existsAssertionConsumerServiceURL) {
655+
return res.status(400).send("AssertionConsumerServiceURL not valid");
656+
}
657+
652658
// defaults
653659
let defaults = [];
654660
defaults = Utility.defaultParam(defaults, "Issuer", config_demo.entityID);

spid-validator/server/lib/saml-utils.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,20 @@ class MetadataParser {
169169
return serviceProviderEntityId;
170170
}
171171

172+
existsAssertionConsumerServiceURL(url) {
173+
let exists = false;
174+
let doc = new DOMParser().parseFromString(this.metadata.xml);
175+
let acs = select("//md:EntityDescriptor/md:SPSSODescriptor/md:AssertionConsumerService", doc);
176+
for(let i in acs) {
177+
let acsLocation = acs[i].getAttribute("Location");
178+
if(acsLocation==url) {
179+
exists = true;
180+
break;
181+
}
182+
}
183+
return exists;
184+
}
185+
172186
getAssertionConsumerServiceURL(index) {
173187
let assertionConsumerServiceURL = null;
174188
let doc = new DOMParser().parseFromString(this.metadata.xml);

spid-validator/server/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "spid-validator",
3-
"version": "1.10.3",
3+
"version": "1.10.4",
44
"description": "Tool for validating Service Provider compliance to SPID response from Identity Provider",
55
"main": "spid-validator",
66
"author": "Michele D'Amico (damikael) - AgID",

0 commit comments

Comments
 (0)