saml 3.0.1 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +23 -0
- package/lib/saml11.js +4 -0
- package/lib/saml20.js +4 -0
- package/lib/xml/encrypt.js +3 -1
- package/package.json +12 -12
- package/.github/workflows/semgrep.yml +0 -15
- package/.idea/modules.xml +0 -8
- package/.idea/node-saml.iml +0 -12
- package/.idea/vcs.xml +0 -6
- package/.travis.yml +0 -4
- package/CHANGELOG.md +0 -82
- package/commitlint.config.js +0 -1
- package/test/saml11.tests.js +0 -489
- package/test/saml20.tests.js +0 -688
- package/test/test-auth0-chain.pem +0 -160
- package/test/test-auth0.der +0 -0
- package/test/test-auth0.key +0 -27
- package/test/test-auth0.pem +0 -24
- package/test/test-auth0_rsa.pub +0 -9
- package/test/utils.js +0 -116
- package/test/utils.tests.js +0 -63
package/README.md
CHANGED
|
@@ -32,6 +32,29 @@ var signedAssertion = saml.create(options);
|
|
|
32
32
|
|
|
33
33
|
Everything except the cert and key is optional.
|
|
34
34
|
|
|
35
|
+
### Encryption
|
|
36
|
+
|
|
37
|
+
SAML assertions can optionally be encrypted, by providing a certificate and public key, as follows:
|
|
38
|
+
|
|
39
|
+
```js
|
|
40
|
+
var saml = require('saml').Saml20; // or Saml11
|
|
41
|
+
|
|
42
|
+
var options = {
|
|
43
|
+
cert: fs.readFileSync(__dirname + '/test-auth0.pem'),
|
|
44
|
+
key: fs.readFileSync(__dirname + '/test-auth0.key'),
|
|
45
|
+
nameIdentifier: 'foo',
|
|
46
|
+
encryptionPublicKey: fs.readFileSync(__dirname + '/encryption-key.pub'),
|
|
47
|
+
encryptionCert: fs.readFileSync(__dirname + '/encryption-cert.pem'),
|
|
48
|
+
encryptionAlgorithm: 'http://www.w3.org/2001/04/xmlenc#aes256-cbc', // Defaults to http://www.w3.org/2009/xmlenc11#aes256-gcm if not specified
|
|
49
|
+
disallowEncryptionWithInsecureAlgorithm: true,
|
|
50
|
+
warnOnInsecureEncryptionAlgorithm: true
|
|
51
|
+
}
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
See [node-xml-encryption](https://github.com/auth0/node-xml-encryption) for documentation on the allowed algorithms. If using algorithms treated as insecure by [node-xml-encryption](https://github.com/auth0/node-xml-encryption), you must provide disallowEncryptionWithInsecureAlgorithm option set to false.
|
|
55
|
+
A warning will be piped to `stderr` using console.warn() by default when the insecure algorithms are used and above mentioned flag is false. This can be disabled via the `warnOnInsecureEncryptionAlgorithm` flag.
|
|
56
|
+
|
|
57
|
+
|
|
35
58
|
## Issue Reporting
|
|
36
59
|
|
|
37
60
|
If you have found a bug or if you have a feature request, please report them at this repository issues section. Please do not report security vulnerabilities on the public GitHub issue tracker. The [Responsible Disclosure Program](https://auth0.com/whitehat) details the procedure for disclosing security issues.
|
package/lib/saml11.js
CHANGED
|
@@ -56,6 +56,8 @@ function extractSaml11Options(opts) {
|
|
|
56
56
|
* @param [options.encryptionPublicKey] {Buffer}
|
|
57
57
|
* @param [options.encryptionAlgorithm] {string}
|
|
58
58
|
* @param [options.keyEncryptionAlgorithm] {string}
|
|
59
|
+
* @param [options.disallowEncryptionWithInsecureAlgorithm] {boolean}
|
|
60
|
+
* @param [options.warnOnInsecureEncryptionAlgorithm] {boolean}
|
|
59
61
|
*
|
|
60
62
|
* @param {Function} [callback] required if encrypting
|
|
61
63
|
* @return {String|*}
|
|
@@ -89,6 +91,8 @@ exports.create = function(options, callback) {
|
|
|
89
91
|
* @param [options.encryptionPublicKey] {Buffer}
|
|
90
92
|
* @param [options.encryptionAlgorithm] {string}
|
|
91
93
|
* @param [options.keyEncryptionAlgorithm] {string}
|
|
94
|
+
* @param [options.disallowEncryptionWithInsecureAlgorithm] {boolean}
|
|
95
|
+
* @param [options.warnOnInsecureEncryptionAlgorithm] {boolean}
|
|
92
96
|
*
|
|
93
97
|
* @param {Function} [callback] required if encrypting
|
|
94
98
|
* @return {String|*}
|
package/lib/saml20.js
CHANGED
|
@@ -95,6 +95,8 @@ function extractSaml20Options(opts) {
|
|
|
95
95
|
* @param [options.encryptionPublicKey] {Buffer}
|
|
96
96
|
* @param [options.encryptionAlgorithm] {string}
|
|
97
97
|
* @param [options.keyEncryptionAlgorithm] {string}
|
|
98
|
+
* @param [options.disallowEncryptionWithInsecureAlgorithm] {boolean}
|
|
99
|
+
* @param [options.warnOnInsecureEncryptionAlgorithm] {boolean}
|
|
98
100
|
*
|
|
99
101
|
* @param {Function} [callback] required if encrypting
|
|
100
102
|
* @return {*}
|
|
@@ -134,6 +136,8 @@ exports.create = function createSignedAssertion(options, callback) {
|
|
|
134
136
|
* @param [options.encryptionPublicKey] {Buffer}
|
|
135
137
|
* @param [options.encryptionAlgorithm] {string}
|
|
136
138
|
* @param [options.keyEncryptionAlgorithm] {string}
|
|
139
|
+
* @param [options.disallowEncryptionWithInsecureAlgorithm] {boolean}
|
|
140
|
+
* @param [options.warnOnInsecureEncryptionAlgorithm] {boolean}
|
|
137
141
|
*
|
|
138
142
|
* @param {Function} [callback] required if encrypting
|
|
139
143
|
* @return {*}
|
package/lib/xml/encrypt.js
CHANGED
|
@@ -9,8 +9,10 @@ exports.fromEncryptXmlOptions = function (options) {
|
|
|
9
9
|
const encryptOptions = {
|
|
10
10
|
rsa_pub: options.encryptionPublicKey,
|
|
11
11
|
pem: options.encryptionCert,
|
|
12
|
-
encryptionAlgorithm: options.encryptionAlgorithm || 'http://www.w3.org/
|
|
12
|
+
encryptionAlgorithm: options.encryptionAlgorithm || 'http://www.w3.org/2009/xmlenc11#aes256-gcm',
|
|
13
13
|
keyEncryptionAlgorithm: options.keyEncryptionAlgorithm || 'http://www.w3.org/2001/04/xmlenc#rsa-oaep-mgf1p',
|
|
14
|
+
disallowEncryptionWithInsecureAlgorithm: options?.disallowEncryptionWithInsecureAlgorithm !== false,
|
|
15
|
+
warnInsecureAlgorithm: options?.warnOnInsecureEncryptionAlgorithm !== false,
|
|
14
16
|
};
|
|
15
17
|
|
|
16
18
|
// expose the encryptOptions as these are needed when adding the SubjectConfirmation
|
package/package.json
CHANGED
|
@@ -1,18 +1,23 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "saml",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0",
|
|
4
4
|
"engines": {
|
|
5
5
|
"node": ">=12"
|
|
6
6
|
},
|
|
7
7
|
"devDependencies": {
|
|
8
|
-
"@commitlint/cli": "^
|
|
9
|
-
"@commitlint/config-conventional": "^
|
|
8
|
+
"@commitlint/cli": "^20.3.1",
|
|
9
|
+
"@commitlint/config-conventional": "^20.3.1",
|
|
10
|
+
"@semantic-release/exec": "^7.0.3",
|
|
10
11
|
"chai": "^4.2.0",
|
|
11
|
-
"husky": "^
|
|
12
|
+
"husky": "^9.1.7",
|
|
12
13
|
"mocha": "^8.2.0",
|
|
14
|
+
"semantic-release": "^25.0.2",
|
|
13
15
|
"should": "~1.2.1",
|
|
14
|
-
"
|
|
16
|
+
"sinon": "^9.0.2"
|
|
15
17
|
},
|
|
18
|
+
"files": [
|
|
19
|
+
"lib"
|
|
20
|
+
],
|
|
16
21
|
"main": "./lib",
|
|
17
22
|
"repository": "https://github.com/auth0/node-saml",
|
|
18
23
|
"keywords": [
|
|
@@ -27,17 +32,12 @@
|
|
|
27
32
|
"moment": "^2.29.4",
|
|
28
33
|
"valid-url": "~1.0.9",
|
|
29
34
|
"xml-crypto": "^2.1.3",
|
|
30
|
-
"xml-encryption": "^
|
|
35
|
+
"xml-encryption": "^4.0.0",
|
|
31
36
|
"xml-name-validator": "~2.0.1",
|
|
32
37
|
"xpath": "0.0.5"
|
|
33
38
|
},
|
|
34
39
|
"scripts": {
|
|
35
|
-
"
|
|
40
|
+
"prepare": "husky",
|
|
36
41
|
"test": "mocha"
|
|
37
|
-
},
|
|
38
|
-
"husky": {
|
|
39
|
-
"hooks": {
|
|
40
|
-
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
|
|
41
|
-
}
|
|
42
42
|
}
|
|
43
43
|
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
name: Semgrep
|
|
2
|
-
on:
|
|
3
|
-
pull_request: {}
|
|
4
|
-
push:
|
|
5
|
-
branches: ["master"]
|
|
6
|
-
jobs:
|
|
7
|
-
semgrep:
|
|
8
|
-
name: Scan
|
|
9
|
-
runs-on: ubuntu-latest
|
|
10
|
-
if: (github.actor != 'dependabot[bot]' && github.actor != 'snyk-bot')
|
|
11
|
-
steps:
|
|
12
|
-
- uses: actions/checkout@v2
|
|
13
|
-
- uses: returntocorp/semgrep-action@v1
|
|
14
|
-
with:
|
|
15
|
-
publishToken: ${{ secrets.SEMGREP_APP_TOKEN }}
|
package/.idea/modules.xml
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
-
<project version="4">
|
|
3
|
-
<component name="ProjectModuleManager">
|
|
4
|
-
<modules>
|
|
5
|
-
<module fileurl="file://$PROJECT_DIR$/.idea/node-saml.iml" filepath="$PROJECT_DIR$/.idea/node-saml.iml" />
|
|
6
|
-
</modules>
|
|
7
|
-
</component>
|
|
8
|
-
</project>
|
package/.idea/node-saml.iml
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
-
<module type="WEB_MODULE" version="4">
|
|
3
|
-
<component name="NewModuleRootManager">
|
|
4
|
-
<content url="file://$MODULE_DIR$">
|
|
5
|
-
<excludeFolder url="file://$MODULE_DIR$/temp" />
|
|
6
|
-
<excludeFolder url="file://$MODULE_DIR$/.tmp" />
|
|
7
|
-
<excludeFolder url="file://$MODULE_DIR$/tmp" />
|
|
8
|
-
</content>
|
|
9
|
-
<orderEntry type="inheritedJdk" />
|
|
10
|
-
<orderEntry type="sourceFolder" forTests="false" />
|
|
11
|
-
</component>
|
|
12
|
-
</module>
|
package/.idea/vcs.xml
DELETED
package/.travis.yml
DELETED
package/CHANGELOG.md
DELETED
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
# Changelog
|
|
2
|
-
|
|
3
|
-
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
|
-
|
|
5
|
-
### [3.0.1](https://github.com/auth0/node-saml/compare/v3.0.0...v3.0.1) (2022-08-26)
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
### Bug Fixes
|
|
9
|
-
|
|
10
|
-
* update async and moment dependencies to fix reported CVEs ([663a73e](https://github.com/auth0/node-saml/commit/663a73ef4f933c5b264ab0ba3b69fd35039eab64))
|
|
11
|
-
|
|
12
|
-
## [3.0.0](https://github.com/auth0/node-saml/compare/v2.0.1...v3.0.0) (2022-05-12)
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
### ⚠ BREAKING CHANGES
|
|
16
|
-
|
|
17
|
-
* handle poorly formatted PEM files (#85)
|
|
18
|
-
|
|
19
|
-
### Bug Fixes
|
|
20
|
-
|
|
21
|
-
* handle poorly formatted PEM files ([#85](https://github.com/auth0/node-saml/issues/85)) ([8830a23](https://github.com/auth0/node-saml/commit/8830a238d33e2e198acd81fb6d972583848bfe26))
|
|
22
|
-
|
|
23
|
-
### [2.0.1](https://github.com/auth0/node-saml/compare/v2.0.0...v2.0.1) (2022-02-09)
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
### Bug Fixes
|
|
27
|
-
|
|
28
|
-
* **saml11:** do not mutate moment() when options.lifetimeInSeconds is provided ([0a5afd1](https://github.com/auth0/node-saml/commit/0a5afd1977dc832f1cc51de6af7c801cc95f78b5))
|
|
29
|
-
|
|
30
|
-
## [2.0.0](https://github.com/auth0/node-saml/compare/v1.0.1...v2.0.0) (2022-02-04)
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
### ⚠ BREAKING CHANGES
|
|
34
|
-
|
|
35
|
-
* Requires NodeJS >= 12
|
|
36
|
-
|
|
37
|
-
Upgraded the xml-encryption package which removes the vulnerable node-forge dependency
|
|
38
|
-
See https://github.com/advisories/GHSA-8fr3-hfg3-gpgp
|
|
39
|
-
|
|
40
|
-
### Bug Fixes
|
|
41
|
-
|
|
42
|
-
* remove vulnerable node-forge dependency ([0106c61](https://github.com/auth0/node-saml/commit/0106c611a1263150e42692411aeeea0c95ec0755))
|
|
43
|
-
|
|
44
|
-
### [1.0.1](https://github.com/auth0/node-saml/compare/v1.0.0...v1.0.1) (2021-09-17)
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
### Bug Fixes
|
|
48
|
-
|
|
49
|
-
* update xmldom and xml-crypto to fix security issues ([6ad0243](https://github.com/auth0/node-saml/commit/6ad0243fe8c2f90d71d335500e9a9c8a2c436cb7))
|
|
50
|
-
|
|
51
|
-
## [1.0.0](https://github.com/auth0/node-saml/compare/v0.15.0...v1.0.0) (2020-11-04)
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
### ⚠ BREAKING CHANGES
|
|
55
|
-
|
|
56
|
-
* update xml-crypto and xmldom dependencies to fix sec issues
|
|
57
|
-
* stop supporting node v4 and v8
|
|
58
|
-
* xml-encryption major version bump, fix typo in config property
|
|
59
|
-
from `keyEncryptionAlgorighm` to `keyEncryptionAlgorithm` consumed by
|
|
60
|
-
new xml-encryption library version.
|
|
61
|
-
|
|
62
|
-
### Features
|
|
63
|
-
|
|
64
|
-
* fix sec issues with dependencies ([06acc02](https://github.com/auth0/node-saml/commit/06acc0238d7161c123f2f6924aa9f5984a5a2f32))
|
|
65
|
-
* update xml-crypto and xmldom dependencies to fix sec issues ([772c30e](https://github.com/auth0/node-saml/commit/772c30e4333d0af0e783c163e371c49ec0386c23))
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
* remove node v4 and v8 in travis configuration ([d8c62af](https://github.com/auth0/node-saml/commit/d8c62af972e6c6edbc052fafed749b254e73569c))
|
|
69
|
-
|
|
70
|
-
## [0.15.0](https://github.com/auth0/node-saml/compare/v0.13.0...v0.15.0) (2020-10-01)
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
### Features
|
|
74
|
-
|
|
75
|
-
* **saml11:** adds saml11.createUnsignedAssertion() ([51170c9](https://github.com/auth0/node-saml/commit/51170c91f5ddf9c31cb00b03fe5d8c513131e165))
|
|
76
|
-
* **saml20:** adds Saml20.createUnsignedAssertion() ([de0e766](https://github.com/auth0/node-saml/commit/de0e766f3fcb52913a93ff52cc1feefebf47eb00))
|
|
77
|
-
* **xml/sign:** unsigned assertions should have whitespace removed as well ([968d0e7](https://github.com/auth0/node-saml/commit/968d0e7559dd72f7d029752ced9887855e7d44c4))
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
### Bug Fixes
|
|
81
|
-
|
|
82
|
-
* **saml20:** parses saml20.template only once at start up ([cb3bfcd](https://github.com/auth0/node-saml/commit/cb3bfcdc4b034b6ac3ea52172c1be7d6193fddec))
|
package/commitlint.config.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
module.exports = { extends: ['@commitlint/config-conventional'] };
|