Skip to content

Commit 6ad0243

Browse files
committed
fix: update xmldom and xml-crypto to fix security issues
1 parent 7ee7984 commit 6ad0243

File tree

6 files changed

+13
-13
lines changed

6 files changed

+13
-13
lines changed

lib/saml11.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
var path = require('path');
22
var utils = require('./utils');
3-
var Parser = require('xmldom').DOMParser;
3+
var Parser = require('@xmldom/xmldom').DOMParser;
44
var xmlenc = require('xml-encryption');
55
var moment = require('moment');
66
var async = require('async');
@@ -120,7 +120,7 @@ function createAssertion(options, strategies, callback) {
120120
conditions[0].setAttribute('NotBefore', now.format('YYYY-MM-DDTHH:mm:ss.SSS[Z]'));
121121
conditions[0].setAttribute('NotOnOrAfter', now.add(options.lifetimeInSeconds, 'seconds').format('YYYY-MM-DDTHH:mm:ss.SSS[Z]'));
122122
}
123-
123+
124124
if (options.audiences) {
125125
var audiences = options.audiences instanceof Array ? options.audiences : [options.audiences];
126126
audiences.forEach(function (audience) {
@@ -135,7 +135,7 @@ function createAssertion(options, strategies, callback) {
135135
var statement = doc.documentElement.getElementsByTagNameNS(NAMESPACE, 'AttributeStatement')[0];
136136
Object.keys(options.attributes).forEach(function(prop) {
137137
if(typeof options.attributes[prop] === 'undefined') return;
138-
138+
139139
// <saml:Attribute AttributeName="name" AttributeNamespace="http://schemas.xmlsoap.org/claims/identity">
140140
// <saml:AttributeValue>Foo Bar</saml:AttributeValue>
141141
// </saml:Attribute>
@@ -162,15 +162,15 @@ function createAssertion(options, strategies, callback) {
162162
.setAttribute('AuthenticationInstant', now.format('YYYY-MM-DDTHH:mm:ss.SSS[Z]'));
163163

164164
var nameID = doc.documentElement.getElementsByTagNameNS(NAMESPACE, 'NameIdentifier')[0];
165-
165+
166166
if (options.nameIdentifier) {
167167
nameID.textContent = options.nameIdentifier;
168-
168+
169169
doc.getElementsByTagName('saml:AuthenticationStatement')[0]
170170
.getElementsByTagName('saml:NameIdentifier')[0]
171171
.textContent = options.nameIdentifier;
172172
}
173-
173+
174174
if (options.nameIdentifierFormat) {
175175
var nameIDs = doc.documentElement.getElementsByTagNameNS(NAMESPACE, 'NameIdentifier');
176176
nameIDs[0].setAttribute('Format', options.nameIdentifierFormat);

lib/utils.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
var fs = require('fs');
2-
var Parser = require('xmldom').DOMParser;
2+
var Parser = require('@xmldom/xmldom').DOMParser;
33

44
exports.pemToCert = function(pem) {
55
var cert = /-----BEGIN CERTIFICATE-----([^-]*)-----END CERTIFICATE-----/g.exec(pem.toString());

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,13 @@
1919
"author": "Matias Woloski (Auth0)",
2020
"license": "MIT",
2121
"dependencies": {
22+
"@xmldom/xmldom": "^0.7.4",
2223
"async": "~0.2.9",
2324
"moment": "2.19.3",
2425
"valid-url": "~1.0.9",
25-
"xml-crypto": "2.0.0",
26+
"xml-crypto": "^2.1.3",
2627
"xml-encryption": "^1.2.1",
2728
"xml-name-validator": "~2.0.1",
28-
"xmldom": "0.1.17",
2929
"xpath": "0.0.5"
3030
},
3131
"scripts": {

test/saml11.tests.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ var assert = require('chai').assert;
22
var fs = require('fs');
33
var moment = require('moment');
44
var should = require('should');
5-
var xmldom = require('xmldom');
5+
var xmldom = require('@xmldom/xmldom');
66
var xmlenc = require('xml-encryption');
77

88
var utils = require('./utils');
@@ -27,7 +27,7 @@ describe('saml 1.1', function () {
2727
it: it.skip
2828
})
2929
});
30-
30+
3131
function saml11TestSuite(options) {
3232
var createAssertion = options.createAssertion;
3333
var assertSignature = options.assertSignature;

test/saml20.tests.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ var fs = require('fs');
33
var utils = require('./utils');
44
var moment = require('moment');
55
var should = require('should');
6-
var xmldom = require('xmldom');
6+
var xmldom = require('@xmldom/xmldom');
77
var xmlenc = require('xml-encryption');
88

99
var saml = require('../lib/saml20');

test/utils.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
var xmlCrypto = require('xml-crypto');
2-
var xmldom = require('xmldom');
2+
var xmldom = require('@xmldom/xmldom');
33

44
/**
55
* @param {string} assertion

0 commit comments

Comments
 (0)