cassproject 5.0.12 → 5.0.14

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 CHANGED
@@ -50,7 +50,6 @@ Development unit tests presume you have a CaSS Repository running on `localhost:
50
50
  * Update changelog using `npm run changelog`, and review the changes in `CHANGELOG.md`.
51
51
  * `npm install`
52
52
  * `npm audit` and fix any audit issues. Stop if `npm audit --omit=dev` has findings.
53
- * Update CaSS server version if necessary in package.json
54
53
  * `npm test` - Must not fail any tests.
55
54
  * `npm run webpack:cypressFirefoxHttps` See if the firefox test case has changed.
56
55
  * Document code coverage output by the previous step.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cassproject",
3
- "version": "5.0.12",
3
+ "version": "5.0.14",
4
4
  "description": "Competency and Skills Service",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -10,7 +10,7 @@
10
10
  "multitest": "concurrently --kill-others-on-fail \"npm run test15\" \"npm run test14\" \"npm run test13\" \"npm run test12\"",
11
11
  "testCassTest": "npm run testkill && docker run -d --platform linux/amd64 --network cass-net --name cass-test -p80:80 -e CASS_LOOPBACK cass-test && wait-on http://localhost/api/ping && npm run testNode18 && npm run testNode18Fips && npm run testCypressEdge && npm run testCypress && npm run testkill",
12
12
  "testDevHttps": "npm run testkill && docker run -d --platform linux/amd64 --network cass-net --name cass-test -p443:80 -e CASS_LOOPBACK -e HTTPS=true cassproject/cass:dev && wait-on https://localhost/api/ping && npm run testNode18HttpsFips && npm run testNode18Https && npm run testCypressEdgeHttps && npm run testCypressHttps",
13
- "test16HttpsFips": "export CASS_LOOPBACK=https://cass-testsf16/api/|| set CASS_LOOPBACK=https://cass-testsf16/api/&& npm run testkillsf16 && docker run -d --platform linux/amd64 --network cass-net --name cass-testsf16 -p450:443 -e CASS_LOOPBACK -e HTTPS=true cassproject/cass:1.6 && wait-on https://localhost:450/api/ping && concurrently --kill-others-on-fail \"npm run testCypressHttps\" \"npm run testNode24Https\" \"npm run testNode24HttpsFips\" \"npm run testNode24HttpsForceFips\" \"npm run testNode22Https\" \"npm run testNode22HttpsFips\" \"npm run testNode22HttpsForceFips\" \"npm run testNode20Https\" \"npm run testNode20HttpsFips\" \"npm run testNode20HttpsForceFips\" \"npm run testNode18Https\" && npm run testkillsf16",
13
+ "test16HttpsFips": "export CASS_LOOPBACK=https://cass-testsf16/api/|| set CASS_LOOPBACK=https://cass-testsf16/api/&& npm run testkillsf16 && docker run -d --platform linux/amd64 --network cass-net --name cass-testsf16 -p450:443 -e CASS_LOOPBACK -e HTTPS=true --pull always cassproject/cass:1.6 && wait-on https://localhost:450/api/ping && concurrently --kill-others-on-fail \"npm run testCypressHttps\" \"npm run testNode24Https\" \"npm run testNode24HttpsFips\" \"npm run testNode24HttpsForceFips\" \"npm run testNode22Https\" \"npm run testNode22HttpsFips\" \"npm run testNode22HttpsForceFips\" \"npm run testNode20Https\" \"npm run testNode20HttpsFips\" \"npm run testNode20HttpsForceFips\" \"npm run testNode18Https\" && npm run testkillsf16",
14
14
  "test16Https11Fips": "export CASS_LOOPBACK=https://cass-testsf1116/api/|| set CASS_LOOPBACK=https://cass-testsf1116/api/&& npm run testkillsf1116 && docker run -d --platform linux/amd64 --network cass-net --name cass-testsf1116 -p449:443 -e CASS_LOOPBACK -e HTTPS=true -e HTTP2=false cassproject/cass:1.6 && wait-on https://localhost:449/api/ping && concurrently --kill-others-on-fail \"npm run testCypressHttps\" \"npm run testNode24Https\" \"npm run testNode24HttpsFips\" \"npm run testNode24HttpsForceFips\" \"npm run testNode22Https\" \"npm run testNode22HttpsFips\" \"npm run testNode22HttpsForceFips\" \"npm run testNode20Https\" \"npm run testNode20HttpsFips\" \"npm run testNode20HttpsForceFips\" \"npm run testNode18Https\" && npm run testkillsf1116",
15
15
  "test16Https": "export CASS_LOOPBACK=https://cass-tests16/api/|| set CASS_LOOPBACK=https://cass-tests16/api/&& npm run testkills16 && docker run -d --platform linux/amd64 --network cass-net --name cass-tests16 -p448:443 -e CASS_LOOPBACK -e HTTPS=true cassproject/cass:1.6 && wait-on https://localhost:448/api/ping && concurrently --kill-others-on-fail \"npm run testCypressHttps\" \"npm run testNode24Https\" \"npm run testNode24HttpsFips\" \"npm run testNode22Https\" \"npm run testNode22HttpsFips\" \"npm run testNode20Https\" \"npm run testNode20HttpsFips\" \"npm run testNode18Https\" && npm run testkills16",
16
16
  "test16HttpsNoFips": "export CASS_LOOPBACK=https://cass-tests16/api/|| set CASS_LOOPBACK=https://cass-tests16/api/&& npm run testkills16 && docker run -d --platform linux/amd64 --network cass-net --name cass-tests16 -p448:443 -e CASS_LOOPBACK -e HTTPS=true cassproject/cass:1.6 && wait-on https://localhost:448/api/ping && concurrently --kill-others-on-fail \"npm run testCypressHttps\" \"npm run testNode24Https\" \"npm run testNode22Https\" \"npm run testNode20Https\" \"npm run testNode18Https\" && npm run testkills16",
@@ -82,18 +82,18 @@
82
82
  "autoindex": "nodemon index.js",
83
83
  "autonyc": "nodemon --exec \"npm run nyc\"",
84
84
  "nyc": "nyc --reporter lcov npm run mocha",
85
- "mocha": "mocha --timeout 60000 -b src/**/*.test.js",
86
- "mochaFips": "mocha -n 'force-fips' --timeout 60000 -b src/**/*.test.js",
87
- "mocha:httpsNoHttp2": "export HTTP2=false|| set HTTP2=false&& mocha --timeout 60000 -b src/**/*.test.js",
88
- "mocha:https": "export CASS_LOOPBACK=https://localhost/api/|| set CASS_LOOPBACK=https://localhost/api/&& mocha --timeout 60000 -b src/**/*.test.js",
89
- "mocha:clientSideCertificates": "export NODE_EXTRA_CA_CERTS=ca.crt|| set NODE_EXTRA_CA_CERTS=ca.crt&&export HTTP2=false|| set HTTP2=false&& mocha --timeout 60000 -b src/**/*.test.js",
90
- "mochaFips:clientSideCertificates": "export NODE_EXTRA_CA_CERTS=ca.crt|| set NODE_EXTRA_CA_CERTS=ca.crt&&export HTTP2=false|| set HTTP2=false&& mocha -n 'force-fips' --timeout 60000 -b src/**/*.test.js",
91
- "mocha:clientSideCertificatesDangerMouse": "export NODE_EXTRA_CA_CERTS=ca.crt|| set NODE_EXTRA_CA_CERTS=ca.crt&&export HTTP2=false|| set HTTP2=false&& mocha --timeout 60000 -b src/**/*.test.js",
92
- "mocha:custom": "export CASS_LOOPBACK=https://tides.eduworks.us/api/|| set CASS_LOOPBACK=https://tides.eduworks.us/api/&& export HTTP2=false|| set HTTP2=false&& mocha --timeout 600000 -b src/**/*.test.js",
93
- "mocha:dev": "export CASS_LOOPBACK=https://dev.cassproject.org/api/|| set CASS_LOOPBACK=https://dev.cassproject.org/api/&& export HTTP2=false|| set HTTP2=false&& mocha --timeout 600000 -b src/**/*.test.js",
94
- "mocha:demo": "export CASS_LOOPBACK=https://demo.cassproject.org/api/|| set CASS_LOOPBACK=https://demo.cassproject.org/api/&& export HTTP2=false|| set HTTP2=false&& mocha --timeout 600000 -b src/**/*.test.js",
95
- "mochaGraph": "mocha --timeout 60000 -b src/com/eduworks/ec/graph/**/*.test.js",
96
- "mochaCrypto": "mocha --timeout 60000 -b src/test/*Rsa*.test.js -b src/test/*Aes*.test.js -b src/test/*Crypto*.test.js",
85
+ "mocha": "mocha --exit --timeout 60000 -b src/**/*.test.js",
86
+ "mochaFips": "mocha --exit -n 'force-fips' --timeout 60000 -b src/**/*.test.js",
87
+ "mocha:httpsNoHttp2": "export HTTP2=false|| set HTTP2=false&& mocha --exit --timeout 60000 -b src/**/*.test.js",
88
+ "mocha:https": "export CASS_LOOPBACK=https://localhost/api/|| set CASS_LOOPBACK=https://localhost/api/&& mocha --exit --timeout 60000 -b src/**/*.test.js",
89
+ "mocha:clientSideCertificates": "export NODE_EXTRA_CA_CERTS=ca.crt|| set NODE_EXTRA_CA_CERTS=ca.crt&&export HTTP2=false|| set HTTP2=false&& mocha --exit --timeout 60000 -b src/**/*.test.js",
90
+ "mochaFips:clientSideCertificates": "export NODE_EXTRA_CA_CERTS=ca.crt|| set NODE_EXTRA_CA_CERTS=ca.crt&&export HTTP2=false|| set HTTP2=false&& mocha --exit -n 'force-fips' --timeout 60000 -b src/**/*.test.js",
91
+ "mocha:clientSideCertificatesDangerMouse": "export NODE_EXTRA_CA_CERTS=ca.crt|| set NODE_EXTRA_CA_CERTS=ca.crt&&export HTTP2=false|| set HTTP2=false&& mocha --exit --timeout 60000 -b src/**/*.test.js",
92
+ "mocha:custom": "export CASS_LOOPBACK=https://tides.eduworks.us/api/|| set CASS_LOOPBACK=https://tides.eduworks.us/api/&& export HTTP2=false|| set HTTP2=false&& mocha --exit --timeout 600000 -b src/**/*.test.js",
93
+ "mocha:dev": "export CASS_LOOPBACK=https://dev.cassproject.org/api/|| set CASS_LOOPBACK=https://dev.cassproject.org/api/&& export HTTP2=false|| set HTTP2=false&& mocha --exit --timeout 600000 -b src/**/*.test.js",
94
+ "mocha:demo": "export CASS_LOOPBACK=https://demo.cassproject.org/api/|| set CASS_LOOPBACK=https://demo.cassproject.org/api/&& export HTTP2=false|| set HTTP2=false&& mocha --exit --timeout 600000 -b src/**/*.test.js",
95
+ "mochaGraph": "mocha --exit --timeout 60000 -b src/com/eduworks/ec/graph/**/*.test.js",
96
+ "mochaCrypto": "mocha --exit --timeout 60000 -b src/test/*Rsa*.test.js -b src/test/*Aes*.test.js -b src/test/*Crypto*.test.js",
97
97
  "automocha": "nodemon --exec \"npm run mocha\"",
98
98
  "automochaGraph": "nodemon --exec \"npm run mochaGraph\"",
99
99
  "automochaCrypto": "nodemon --exec \"npm run mochaCrypto\"",
@@ -142,7 +142,7 @@
142
142
  "dependencies": {
143
143
  "base64-arraybuffer": "^1.0.2",
144
144
  "jsonld": "^9.0.0",
145
- "node-forge": "^1.3.3",
145
+ "node-forge": "^1.4.0",
146
146
  "papaparse": "^5.5.3",
147
147
  "promise-worker": "^2.0.1",
148
148
  "web-worker": "1.3.0"
@@ -172,17 +172,17 @@
172
172
  "@cypress/webpack-preprocessor": "^7.0.2",
173
173
  "chai": "^4.5.0",
174
174
  "concurrently": "^9.2.1",
175
- "cypress": "^15.10.0",
176
- "cypress-fail-fast": "^7.1.1",
177
- "eslint": "^10.0.1",
175
+ "cypress": "^15.13.1",
176
+ "cypress-fail-fast": "^8.1.0",
177
+ "eslint": "^10.2.0",
178
178
  "fake-indexeddb": "^6.2.5",
179
179
  "mocha": "^11.7.5",
180
180
  "node-polyfill-webpack-plugin": "^4.1.0",
181
181
  "nodemon": "^3.1.14",
182
- "nyc": "^17.1.0",
183
- "sinon": "^21.0.1",
184
- "wait-on": "^9.0.4",
185
- "webpack": "^5.105.2"
182
+ "nyc": "^18.0.0",
183
+ "sinon": "^21.1.2",
184
+ "wait-on": "^9.0.5",
185
+ "webpack": "^5.106.1"
186
186
  },
187
187
  "packageManager": "npm@11.3.0+sha512.96eb611483f49c55f7fa74df61b588de9e213f80a256728e6798ddc67176c7b07e4a1cfc7de8922422cbce02543714367037536955221fa451b0c4fefaf20c66"
188
188
  }
@@ -1,5 +1,7 @@
1
1
  const forge = require("node-forge");
2
2
  const realCrypto = require('crypto');
3
+ const base64 = require("base64-arraybuffer");
4
+
3
5
  /**
4
6
  * AES encryption tasks common across all variants of AES.
5
7
  * @class EcAes
@@ -16,7 +18,13 @@ module.exports = class EcAes {
16
18
  */
17
19
  static newSecret = function(i) {
18
20
  if (i == null) throw new Error("Undefined secret length.");
19
- return realCrypto.randomBytes(i).toString('base64');
21
+ let array = new Uint8Array(i);
22
+ if (typeof crypto !== "undefined" && crypto.getRandomValues) {
23
+ crypto.getRandomValues(array);
24
+ } else {
25
+ realCrypto.webcrypto.getRandomValues(array);
26
+ }
27
+ return base64.encode(array.buffer);
20
28
  };
21
29
  /**
22
30
  * Generates a random Initialization Vector of length @i
@@ -27,6 +35,12 @@ module.exports = class EcAes {
27
35
  */
28
36
  static newIv = function(i) {
29
37
  if (i == null) throw new Error("Undefined iv length.");
30
- return realCrypto.randomBytes(i).toString('base64');
38
+ let array = new Uint8Array(i);
39
+ if (typeof crypto !== "undefined" && crypto.getRandomValues) {
40
+ crypto.getRandomValues(array);
41
+ } else {
42
+ realCrypto.webcrypto.getRandomValues(array);
43
+ }
44
+ return base64.encode(array.buffer);
31
45
  };
32
46
  };
@@ -19,13 +19,34 @@ module.exports = class EcAssertion extends Assertion {
19
19
  async decrypt(eim) {
20
20
  eim = eim || EcIdentityManager.default;
21
21
  let a = new Assertion().copyFrom(this);
22
- a.setSubject(await this.getSubject(eim));
23
- a.setAgent(await this.getAgent(eim));
24
- a.setAssertionDate(await this.getAssertionDate(eim));
25
- a.setExpirationDate(await this.getExpirationDate(eim));
26
- a.setEvidence(await this.getEvidences(eim));
27
- a.setNegative(await this.getNegative(eim));
28
- a.setDecayFunction(await this.getDecayFunction(eim));
22
+ let subject = this.getSubject(eim);
23
+ let agent = this.getAgent(eim);
24
+ let assertionDate = this.getAssertionDate(eim);
25
+ let expirationDate = this.getExpirationDate(eim);
26
+ let evidences = this.getEvidences(eim);
27
+ let negative = this.getNegative(eim);
28
+ let decayFunction = this.getDecayFunction(eim);
29
+ subject = await subject;
30
+ agent = await agent;
31
+ assertionDate = await assertionDate;
32
+ expirationDate = await expirationDate;
33
+ evidences = await evidences;
34
+ negative = await negative;
35
+ decayFunction = await decayFunction;
36
+ if (subject)
37
+ a.setSubject(subject);
38
+ if (agent)
39
+ a.setAgent(agent);
40
+ if (assertionDate)
41
+ a.setAssertionDate(assertionDate);
42
+ if (expirationDate)
43
+ a.setExpirationDate(expirationDate);
44
+ if (evidences)
45
+ a.setEvidence(evidences);
46
+ if (negative)
47
+ a.setNegative(negative);
48
+ if (decayFunction)
49
+ a.setDecayFunction(decayFunction);
29
50
  a.setCompetency(this.competency);
30
51
  a.setLevel(this.level);
31
52
  a.setConfidence(this.confidence);
@@ -246,13 +246,13 @@ module.exports = class Assertion extends schema.CreativeWork {
246
246
  success(this.decayFunction);
247
247
  }
248
248
  getNegative() {
249
- return "true".equals(this.negative);
249
+ return "true".equals(this.negative) | this.negative === true;
250
250
  }
251
251
  setNegative(negativeB) {
252
252
  this.negative = negativeB;
253
253
  }
254
254
  getNegativeAsync(success, failure) {
255
- success("true".equals(this.negative));
255
+ success("true".equals(this.negative) | this.negative === true);
256
256
  }
257
257
  setCompetency(competencyUrl) {
258
258
  this.competency = competencyUrl;