cassproject 1.5.12 → 1.5.13

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
@@ -49,6 +49,14 @@ Development unit tests presume you have a CaSS Repository running on `localhost:
49
49
 
50
50
  # Changelog
51
51
 
52
+ ## 1.5.13
53
+ * Audit logging.
54
+ * Classification and Markings remain unencrypted on objects.
55
+ * Last login time field in stored identity object.
56
+
57
+ ## 1.5.12
58
+ * Improved window crypto detection.
59
+
52
60
  ## 1.5.11
53
61
  * Login fix for folks with contacts.
54
62
 
package/index.js CHANGED
@@ -3,6 +3,8 @@ if (typeof window !== "undefined" && window) {
3
3
  window.module = {};
4
4
  }
5
5
 
6
+ require("./src/org/cassproject/general/AuditLogger.js");
7
+
6
8
  global.generateUUID = function () {
7
9
  var d = new Date().getTime();
8
10
  if (typeof window !== "undefined" && window && window.performance && typeof window.performance.now === "function") {
package/package.json CHANGED
@@ -1,43 +1,48 @@
1
1
  {
2
2
  "name": "cassproject",
3
- "version": "1.5.12",
3
+ "version": "1.5.13",
4
4
  "description": "Competency and Skills Service",
5
5
  "main": "index.js",
6
6
  "scripts": {
7
7
  "test": "npm run test15Https11 && npm run test15Https && npm run test15 && npm run test14 && npm run test13 && npm run test12",
8
- "testCassTest": "npm run testkill && docker run -d --name cass-test -p80:80 cass-test && wait-on http://localhost/api/ping && npm run testCypressEdge && npm run testCypress && npm run testNode18 && npm run testNode18Fips && npm run testNode16 && npm run testNode15 && npm run testNode14 && npm run testNode13 && npm run testNode12 && npm run testkill",
9
- "testDevHttps": "npm run testkill && docker run -d --name cass-test -p443:80 -e HTTPS=true cassproject/cass:dev && wait-on https://localhost/api/ping && npm run testCypressEdgeHttps && npm run testCypressHttps && npm run testNode18HttpsFips && npm run testNode18Https && npm run testNode16Https && npm run testNode15Https && npm run testNode14Https && npm run testNode13Https && npm run testNode12Https",
10
- "test15Https": "npm run testkill && docker run -d --name cass-test -p443:443 -e HTTPS=true cassproject/cass:1.5.10 && wait-on https://localhost/api/ping && npm run testCypressEdgeHttps && npm run testCypressHttps && npm run testNode18HttpsFips && npm run testNode18Https && npm run testNode16Https && npm run testkill",
11
- "test15Https11": "npm run testkill && docker run -d --name cass-test -p443:443 -e HTTPS=true -e HTTP2=false cassproject/cass:1.5.10 && wait-on https://localhost/api/ping && npm run testCypressEdgeHttps && npm run testCypressHttps && npm run testNode18HttpsFips && npm run testNode18Https && npm run testNode16Https && npm run testkill",
12
- "test15": "npm run testkill && docker run -d --name cass-test -p80:80 cassproject/cass:1.5.10 && wait-on http://localhost/api/ping && npm run testCypressEdge && npm run testCypress && npm run testNode18 && npm run testNode18Fips && npm run testNode16 && npm run testNode15 && npm run testNode14 && npm run testNode13 && npm run testNode12 && npm run testkill",
13
- "test14": "npm run testkill && docker run -d --name cass-test -p80:80 cassproject/cass:1.4.4 && wait-on http://localhost/api/ping && npm run testCypressEdge && npm run testCypress && npm run testNode16 && npm run testNode15 && npm run testNode14 && npm run testNode13 && npm run testNode12 && npm run testkill",
14
- "test13": "npm run testkill && docker run -d --name cass-test -p80:80 cassproject/cass:1.3.18 && wait-on http://localhost/api/ping && npm run testCypressEdge && npm run testCypress && npm run testNode16 && npm run testNode15 && npm run testNode14 && npm run testNode13 && npm run testNode12 && npm run testkill",
15
- "test12": "npm run testkill && docker run -d --name cass-test -p80:80 cassproject/cass:1.2.44 && wait-on http://localhost/api/ping && npm run testCypressEdge && npm run testCypress && npm run testNode16 && npm run testNode15 && npm run testNode14 && npm run testNode13 && npm run testNode12 && npm run testkill",
8
+ "multitest": "concurrently --kill-others --kill-others-on-fail \"npm run test15\" \"npm run test14\" \"npm run test13\" \"npm run test12\"",
9
+ "testCassTest": "npm run testkill && docker run -d --name cass-test -p80:80 -e CASS_LOOPBACK cass-test && wait-on http://localhost/api/ping && npm run testNode18 && npm run testNode18Fips && npm run testNode16 && npm run testNode15 && npm run testNode14 && npm run testNode13 && npm run testNode12 && npm run testCypressEdge && npm run testCypress && npm run testkill",
10
+ "testDevHttps": "npm run testkill && docker run -d --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 testNode16Https && npm run testNode15Https && npm run testNode14Https && npm run testNode13Https && npm run testNode12Https && npm run testCypressEdgeHttps && npm run testCypressHttps",
11
+ "test15Https": "npm run testkill && docker run -d --name cass-test -p443:443 -e CASS_LOOPBACK -e HTTPS=true cassproject/cass:1.5.11 && wait-on https://localhost/api/ping && npm run testNode18HttpsFips && npm run testNode18Https && npm run testNode16Https && npm run testCypressEdgeHttps && npm run testCypressHttps && npm run testkill",
12
+ "test15Https11": "npm run testkill && docker run -d --name cass-test -p443:443 -e CASS_LOOPBACK -e HTTPS=true -e HTTP2=false cassproject/cass:1.5.11 && wait-on https://localhost/api/ping && npm run testNode18HttpsFips && npm run testNode18Https && npm run testNode16Https && npm run testCypressEdgeHttps && npm run testCypressHttps && npm run testkill",
13
+ "test15": "export CASS_LOOPBACK=http://localhost/api/|| set CASS_LOOPBACK=http://localhost/api/&& npm run testkill15 && docker run -d -e CASS_LOOPBACK --name cass-test15 -p80:80 cassproject/cass:1.5.11 && wait-on http://localhost/api/ping && npm run testNode18 && npm run testNode18Fips && npm run testNode16 && npm run testNode15 && npm run testNode14 && npm run testNode13 && npm run testNode12 && npm run testCypressEdge && npm run testCypress && npm run testkill15",
14
+ "test14": "npm run testkill14 && docker run -d -e CASS_LOOPBACK --name cass-test14 -p80:80 cassproject/cass:1.4.4 && wait-on http://localhost/api/ping && npm run testNode16 && npm run testNode15 && npm run testNode14 && npm run testNode13 && npm run testNode12 && npm run testCypressEdge && npm run testCypress && npm run testkill14",
15
+ "test13": "npm run testkill13 && docker run -d -e CASS_LOOPBACK --name cass-test13 -p80:80 cassproject/cass:1.3.18 && wait-on http://localhost/api/ping && npm run testNode16 && npm run testNode15 && npm run testNode14 && npm run testNode13 && npm run testNode12 && npm run testCypressEdge && npm run testCypress && npm run testkill13",
16
+ "test12": "npm run testkill12 && docker run -d -e CASS_LOOPBACK --name cass-test12 -p80:80 cassproject/cass:1.2.44 && wait-on http://localhost/api/ping && npm run testNode16 && npm run testNode15 && npm run testNode14 && npm run testNode13 && npm run testNode12 && npm run testCypressEdge && npm run testCypress && npm run testkill12",
17
+ "testkill15": "docker kill cass-test15 | exit 0 && docker rm cass-test15 | exit 0",
18
+ "testkill14": "docker kill cass-test14 | exit 0 && docker rm cass-test14 | exit 0",
19
+ "testkill13": "docker kill cass-test13 | exit 0 && docker rm cass-test13 | exit 0",
20
+ "testkill12": "docker kill cass-test12 | exit 0 && docker rm cass-test12 | exit 0",
16
21
  "testkill": "docker kill cass-test | exit 0 && docker rm cass-test | exit 0",
17
- "testNode18": "docker kill npm-cass & docker rm -f npm-cass & docker build --progress plain -f docker/node18 -t npm-cass . & docker run --network=\"host\" --name npm-cass npm-cass",
18
- "testNode18Https": "docker kill npm-cass & docker rm -f npm-cass & docker build --progress plain -f docker/node18https -t npm-cass . & docker run -it --network=\"host\" --name npm-cass npm-cass",
19
- "testNode18HttpsFips": "docker kill npm-cass & docker rm -f npm-cass & docker build --progress plain -f docker/node18httpsfips -t npm-cass . & docker run --network=\"host\" --name npm-cass npm-cass",
20
- "testNode18Fips": "docker kill npm-cass & docker rm -f npm-cass & docker build --progress plain -f docker/node18fips -t npm-cass . & docker run --network=\"host\" --name npm-cass npm-cass",
21
- "testNode16": "docker kill npm-cass & docker rm -f npm-cass & docker build --progress plain -f docker/node16 -t npm-cass . & docker run --network=\"host\" --name npm-cass npm-cass",
22
- "testNode16Https": "docker kill npm-cass & docker rm -f npm-cass & docker build --progress plain -f docker/node16https -t npm-cass . & docker run --network=\"host\" --name npm-cass npm-cass",
23
- "testNode15": "docker kill npm-cass & docker rm -f npm-cass & docker build --progress plain -f docker/node15 -t npm-cass . & docker run --network=\"host\" --name npm-cass npm-cass",
24
- "testNode15Https": "docker kill npm-cass & docker rm -f npm-cass & docker build --progress plain -f docker/node15https -t npm-cass . & docker run --network=\"host\" --name npm-cass npm-cass",
25
- "testNode14": "docker kill npm-cass & docker rm -f npm-cass & docker build --progress plain -f docker/node14 -t npm-cass . & docker run --network=\"host\" --name npm-cass npm-cass",
26
- "testNode14Https": "docker kill npm-cass & docker rm -f npm-cass & docker build --progress plain -f docker/node14https -t npm-cass . & docker run --network=\"host\" --name npm-cass npm-cass",
27
- "testNode13": "docker kill npm-cass & docker rm -f npm-cass & docker build --progress plain -f docker/node13 -t npm-cass . & docker run --network=\"host\" --name npm-cass npm-cass",
28
- "testNode13Https": "docker kill npm-cass & docker rm -f npm-cass & docker build --progress plain -f docker/node13https -t npm-cass . & docker run --network=\"host\" --name npm-cass npm-cass",
29
- "testNode12": "docker kill npm-cass & docker rm -f npm-cass & docker build --progress plain -f docker/node12 -t npm-cass . & docker run --network=\"host\" --name npm-cass npm-cass",
30
- "testNode12Https": "docker kill npm-cass & docker rm -f npm-cass & docker build --progress plain -f docker/node12https -t npm-cass . & docker run --network=\"host\" --name npm-cass npm-cass",
31
- "testCypress": "docker kill npm-cass & docker rm -f npm-cass & docker build --progress plain -f docker/cypress -t npm-cass . & docker run --network=\"host\" --name npm-cass npm-cass",
32
- "testCypressEdge": "docker kill npm-cass & docker rm -f npm-cass & docker build --progress plain -f docker/cypressEdge -t npm-cass . & docker run --network=\"host\" --name npm-cass npm-cass",
33
- "testCypressHttps": "docker kill npm-cass & docker rm -f npm-cass & docker build --progress plain -f docker/cypressHttps -t npm-cass . & docker run --network=\"host\" --name npm-cass npm-cass",
34
- "testCypressEdgeHttps": "docker kill npm-cass & docker rm -f npm-cass & docker build --progress plain -f docker/cypressEdgeHttps -t npm-cass . & docker run --network=\"host\" --name npm-cass npm-cass",
22
+ "testNode18": "docker build --progress plain -f docker/node18 -t npm-cass18 . & docker run -e CASS_LOOPBACK --rm --network=\"host\" npm-cass18",
23
+ "testNode18Https": "docker build --progress plain -f docker/node18https -t npm-cass18https . & docker run -e CASS_LOOPBACK --rm --network=\"host\" npm-cass18https",
24
+ "testNode18HttpsFips": "docker build --progress plain -f docker/node18httpsfips -t npm-cass18httpsfips . & docker run -e CASS_LOOPBACK --rm --network=\"host\" npm-cass18httpsfips",
25
+ "testNode18Fips": "docker build --progress plain -f docker/node18fips -t npm-cass18fips . & docker run -e CASS_LOOPBACK --rm --network=\"host\" npm-cass18fips",
26
+ "testNode16": "docker build --progress plain -f docker/node16 -t npm-cass16 . & docker run -e CASS_LOOPBACK --rm --network=\"host\" npm-cass16",
27
+ "testNode16Https": "docker build --progress plain -f docker/node16https -t npm-cass16https . & docker run -e CASS_LOOPBACK --rm --network=\"host\" npm-cass16https",
28
+ "testNode15": "docker build --progress plain -f docker/node15 -t npm-cass15 . & docker run -e CASS_LOOPBACK --rm --network=\"host\" npm-cass15",
29
+ "testNode15Https": "docker build --progress plain -f docker/node15https -t npm-cass15https . & docker run -e CASS_LOOPBACK --rm --network=\"host\" npm-cass15https",
30
+ "testNode14": "docker build --progress plain -f docker/node14 -t npm-cass14 . & docker run -e CASS_LOOPBACK --rm --network=\"host\" npm-cass14",
31
+ "testNode14Https": "docker build --progress plain -f docker/node14https -t npm-cass14https . & docker run -e CASS_LOOPBACK --rm --network=\"host\" npm-cass14https",
32
+ "testNode13": "docker build --progress plain -f docker/node13 -t npm-cass13 . & docker run -e CASS_LOOPBACK --rm --network=\"host\" npm-cass13",
33
+ "testNode13Https": "docker build --progress plain -f docker/node13https -t npm-cass13https . & docker run -e CASS_LOOPBACK --rm --network=\"host\" npm-cass13https",
34
+ "testNode12": "docker build --progress plain -f docker/node12 -t npm-cass12 . & docker run -e CASS_LOOPBACK --rm --network=\"host\" npm-cass12",
35
+ "testNode12Https": "docker build --progress plain -f docker/node12https -t npm-cass12https . & docker run -e CASS_LOOPBACK --rm --network=\"host\" npm-cass12https",
36
+ "testCypress": "docker build --progress plain -f docker/cypress -t npm-casscypress . & docker run -e CASS_LOOPBACK --rm --network=\"host\" npm-casscypress",
37
+ "testCypressEdge": "docker build --progress plain -f docker/cypressEdge -t npm-casscypressedge . & docker run -e CASS_LOOPBACK --rm --network=\"host\" npm-casscypressedge",
38
+ "testCypressHttps": "docker build --progress plain -f docker/cypressHttps -t npm-casscypresshttps . & docker run -e CASS_LOOPBACK --rm --network=\"host\" npm-casscypresshttps",
39
+ "testCypressEdgeHttps": "docker build --progress plain -f docker/cypressEdgeHttps -t npm-casscypressedgehttps . & docker run -e CASS_LOOPBACK --rm --network=\"host\" npm-casscypressedgehttps",
35
40
  "autotest": "nodemon test.js",
36
41
  "autoindex": "nodemon index.js",
37
42
  "mocha": "nyc --reporter=lcov --reporter=text mocha -b src/**/*.test.js",
38
- "mocha:httpsNoHttp2": "export CASS_LOOPBACK=https://127.0.0.1/api/|| set CASS_LOOPBACK=https://127.0.0.1/api/&&export HTTP2=false|| set HTTP2=false&& mocha -b src/**/*.test.js",
39
- "mocha:https": "export CASS_LOOPBACK=https://127.0.0.1/api/|| set CASS_LOOPBACK=https://127.0.0.1/api/&& mocha -b src/**/*.test.js",
40
- "mocha:clientSideCertificates": "export CASS_LOOPBACK=https://127.0.0.1/api/|| set CASS_LOOPBACK=https://127.0.0.1/api/&& mocha -b src/**/*.test.js",
43
+ "mocha:httpsNoHttp2": "export HTTP2=false|| set HTTP2=false&& mocha -b src/**/*.test.js",
44
+ "mocha:https": "mocha -b src/**/*.test.js",
45
+ "mocha:clientSideCertificates": "export CASS_LOOPBACK=https://localhost/api/|| set CASS_LOOPBACK=https://localhost/api/&& mocha -b src/**/*.test.js",
41
46
  "mochaGraph": "mocha -b src/com/eduworks/ec/graph/**/*.test.js",
42
47
  "automocha": "nodemon --exec \"npm run mocha\"",
43
48
  "automochaGraph": "nodemon --exec \"npm run mochaGraph\"",
@@ -68,12 +73,16 @@
68
73
  "email": "tom.buskirk@eduworks.com"
69
74
  },
70
75
  {
71
- "name": "Kristin Wood",
76
+ "name": "Kristin Wood (Retired)",
72
77
  "email": "kristin.wood@eduworks.com"
73
78
  },
74
79
  {
75
80
  "name": "Ronald 'Fritz' Ray",
76
81
  "email": "fritz.ray@eduworks.com"
82
+ },
83
+ {
84
+ "name": "Mile Divovic",
85
+ "email": "mile.divovic@eduworks.com"
77
86
  }
78
87
  ],
79
88
  "dependencies": {
@@ -112,8 +121,8 @@
112
121
  },
113
122
  "homepage": "https://github.com/cassproject/cass-npm#readme",
114
123
  "devDependencies": {
115
- "@babel/core": "^7.18.2",
116
- "@babel/preset-env": "^7.18.2",
124
+ "@babel/core": "^7.18.6",
125
+ "@babel/preset-env": "^7.18.6",
117
126
  "@cypress/browserify-preprocessor": "^3.0.2",
118
127
  "@cypress/vite-dev-server": "^2.2.3",
119
128
  "@cypress/webpack-preprocessor": "^5.12.0",
@@ -121,15 +130,16 @@
121
130
  "babel-loader": "^8.2.5",
122
131
  "babel-plugin-transform-remove-strict-mode": "^0.0.2",
123
132
  "chai": "^4.3.6",
133
+ "concurrently": "^7.2.2",
124
134
  "convert-hrtime": "^5.0.0",
125
135
  "cypress": "^9.7.0",
126
136
  "eslint": "^8.17.0",
127
137
  "mocha": "^10.0.0",
128
138
  "node-polyfill-webpack-plugin": "^1.1.4",
129
- "nodemon": "^2.0.16",
139
+ "nodemon": "^2.0.18",
130
140
  "nyc": "^15.1.0",
131
141
  "wait-on": "^6.0.1",
132
142
  "webpack": "^5.73.0",
133
- "webpack-cli": "^4.9.2"
143
+ "webpack-cli": "^4.10.0"
134
144
  }
135
145
  }
@@ -1,5 +1,6 @@
1
1
  var base64 = require("base64-arraybuffer");
2
2
  let forge = require("node-forge");
3
+ require("../../../../org/cassproject/general/AuditLogger.js");
3
4
  if (typeof crypto == 'undefined')
4
5
  {
5
6
  if (typeof window !== 'undefined' && window != null && window !== undefined)
@@ -10,7 +11,7 @@ if (typeof crypto == 'undefined')
10
11
  if (requireResult != null)
11
12
  var crypto = requireResult;
12
13
  } catch (err) {
13
- console.log("Webcrypto not available. Tests will fail. Please upgrade, if possible, to Node 16. Non-test mode will fallback to slower cryptograpy methods.: " + err);
14
+ global.auditLogger.report(global.auditLogger.LogCategory.SYSTEM, global.auditLogger.Severity.INFO, "EcAesCtrAsync", "Webcrypto not available. Tests will fail. Please upgrade, if possible, to Node 16. Non-test mode will fallback to slower cryptograpy methods.: " + err);
14
15
  }
15
16
  }
16
17
 
@@ -32,7 +33,7 @@ module.exports = class EcAesCtrAsync {
32
33
  realCrypto.setFips(true);
33
34
  //console.log("FIPS compliant crypto provider has been enabled.");
34
35
  } catch (e) {
35
- console.log("ERR_CRYPTO_FIPS_UNAVAILABLE",e);
36
+ global.auditLogger.report(global.auditLogger.LogCategory.SYSTEM, global.auditLogger.Severity.INFO, "EcAesCtrAsyncFips", "ERR_CRYPTO_FIPS_UNAVAILABLE", e);
36
37
  }
37
38
  }
38
39
 
@@ -43,7 +44,7 @@ module.exports = class EcAesCtrAsync {
43
44
  realCrypto.setFips(false);
44
45
  //console.log("FIPS compliant crypto provider has been disabled.");
45
46
  } catch (e) {
46
- console.log("ERR_CRYPTO_FIPS_UNAVAILABLE",e);
47
+ global.auditLogger.report(global.auditLogger.LogCategory.SYSTEM, global.auditLogger.Severity.INFO, "EcAesCtrAsyncFips", "ERR_CRYPTO_FIPS_UNAVAILABLE", e);
47
48
  }
48
49
  }
49
50
 
@@ -1,6 +1,7 @@
1
1
  var pemJwk = require("pem-jwk");
2
2
  let forge = require("node-forge");
3
3
  let EcPk = require("./EcPk.js");
4
+ require("../../../../org/cassproject/general/AuditLogger.js");
4
5
  /**
5
6
  * Helper classes for dealing with RSA Private Keys.
6
7
  *
@@ -33,7 +34,7 @@ module.exports = class EcPpk {
33
34
  try {
34
35
  pk.ppk = forge.pki.privateKeyFromPem(pem);
35
36
  } catch (ex) {
36
- console.trace(ex);
37
+ global.auditLogger.report(global.auditLogger.LogCategory.SYSTEM, global.auditLogger.Severity.ERROR, "EcPpkFromPem", ex);
37
38
  return null;
38
39
  }
39
40
  EcPpk.cache[pem] = pk;
@@ -1,6 +1,7 @@
1
1
  var base64 = require("base64-arraybuffer");
2
2
  let forge = require("node-forge");
3
3
  const EcAesCtrAsync = require("./EcAesCtrAsync.js");
4
+ require("../../../../org/cassproject/general/AuditLogger.js");
4
5
  if (typeof crypto == 'undefined')
5
6
  {
6
7
  if (typeof window !== 'undefined' && window != null && window !== undefined)
@@ -11,7 +12,7 @@ if (typeof crypto == 'undefined')
11
12
  if (requireResult != null)
12
13
  var crypto = requireResult;
13
14
  } catch (err) {
14
- console.log("Webcrypto not available. Tests will fail. Please upgrade, if possible, to Node 16. Non-test mode will fallback to slower cryptograpy methods.: " + err);
15
+ global.auditLogger.report(global.auditLogger.LogCategory.SYSTEM, global.auditLogger.Severity.INFO, "EcRsaOaepAsync", "Webcrypto not available. Tests will fail. Please upgrade, if possible, to Node 16. Non-test mode will fallback to slower cryptograpy methods.: " + err);
15
16
  }
16
17
  }
17
18
 
@@ -148,7 +149,7 @@ module.exports = class EcRsaOaepAsync {
148
149
  })
149
150
  .then(afterKeyIsImported)
150
151
  .catch((error) => {
151
- console.trace(ppk, cipherText, error);
152
+ global.auditLogger.report(global.auditLogger.LogCategory.SYSTEM, global.auditLogger.Severity.ERROR, "EcRsaOaepAsyncDecrypt", ppk, cipherText, error);
152
153
  EcAesCtrAsync.fipsOff();
153
154
  return null;
154
155
  });
@@ -158,7 +159,7 @@ module.exports = class EcRsaOaepAsync {
158
159
  .decrypt(algorithm, ppk.key, base64.decode(cipherText))
159
160
  .then(afterKeyIsImported)
160
161
  .catch((error) => {
161
- console.trace(error);
162
+ global.auditLogger.report(global.auditLogger.LogCategory.SYSTEM, global.auditLogger.Severity.ERROR, "EcRsaOaepAsyncDecrypt", error);
162
163
  EcAesCtrAsync.fipsOff();
163
164
  return null;
164
165
  });
@@ -8,6 +8,7 @@ let EcCrypto = require("./EcCrypto.js");
8
8
  let forge = require("node-forge");
9
9
  let cassPromisify = require("../promises/helpers.js").cassPromisify;
10
10
  let cassReturnAsPromise = require("../promises/helpers.js").cassReturnAsPromise;
11
+ require("../../../../org/cassproject/general/AuditLogger.js");
11
12
 
12
13
  /**
13
14
  * Asynchronous implementation of {{#crossLink
@@ -48,12 +49,12 @@ module.exports = class EcRsaOaepAsyncWorker {
48
49
  try {
49
50
  wkr = new Worker(url.pathToFileURL(path.resolve(__dirname, 'forgeAsync.js')));
50
51
  } catch (e) {
51
- console.trace(e);
52
+ global.auditLogger.report(global.auditLogger.LogCategory.SYSTEM, global.auditLogger.Severity.ERROR, "EcRsaOaepAsyncWorker", e);
52
53
  try {
53
54
  wkr = new Worker(path.resolve(__dirname, 'forgeAsync.js'));
54
55
  wkr.onerror = function(event) {
55
56
  wkr = null;
56
- console.log(event);
57
+ global.auditLogger.report(global.auditLogger.LogCategory.SYSTEM, global.auditLogger.Severity.ERROR, "EcRsaOaepAsyncWorker", event);
57
58
  wkr = new Worker(path.resolve(__dirname, 'cass-editor/forgeAsync.js'));
58
59
  if (wkr != null) {
59
60
  // replace errored worker at index
@@ -61,7 +62,7 @@ module.exports = class EcRsaOaepAsyncWorker {
61
62
  }
62
63
  }
63
64
  } catch (e) {
64
- console.trace(e);
65
+ global.auditLogger.report(global.auditLogger.LogCategory.SYSTEM, global.auditLogger.Severity.ERROR, "EcRsaOaepAsyncWorker", e);
65
66
  // Eat quietly.
66
67
  }
67
68
  }
@@ -174,7 +174,8 @@ describe("EcFrameworkGraph", () => {
174
174
  () => {}
175
175
  ).then(() => {
176
176
  let result = [];
177
- result.push(fg.getMetaStateCompetency(c)["positiveAssertion"]?.length);
177
+ if (fg.getMetaStateCompetency(c)["positiveAssertion"] != null)
178
+ result.push(fg.getMetaStateCompetency(c)["positiveAssertion"].length);
178
179
  return result;
179
180
  }).catch((err) => {
180
181
  assert.fail(err);
@@ -211,7 +212,8 @@ describe("EcFrameworkGraph", () => {
211
212
  () => {}
212
213
  ).then(() => {
213
214
  let result = [];
214
- result.push(fg.getMetaStateCompetency(c)["negativeAssertion"]?.length);
215
+ if (fg.getMetaStateCompetency(c)["negativeAssertion"] != null)
216
+ result.push(fg.getMetaStateCompetency(c)["negativeAssertion"].length);
215
217
  return result;
216
218
  }).catch((err) => {
217
219
  console.trace(err);
@@ -251,8 +253,10 @@ describe("EcFrameworkGraph", () => {
251
253
  () => {}
252
254
  ).then(() => {
253
255
  let result = [];
254
- result.push(fg.getMetaStateCompetency(c)["positiveAssertion"]?.length);
255
- result.push(fg.getMetaStateCompetency(c)["negativeAssertion"]?.length);
256
+ if (fg.getMetaStateCompetency(c)["positiveAssertion"] != null)
257
+ result.push(fg.getMetaStateCompetency(c)["positiveAssertion"].length);
258
+ if (fg.getMetaStateCompetency(c)["negativeAssertion"] != null)
259
+ result.push(fg.getMetaStateCompetency(c)["negativeAssertion"].length);
256
260
  return result;
257
261
  }).catch((err) => {
258
262
  assert.fail(err);
@@ -327,8 +331,10 @@ describe("EcFrameworkGraph", () => {
327
331
  () => {}
328
332
  ).then(() => {
329
333
  let result = [];
330
- result.push(fg.getMetaStateCompetency(c)["positiveAssertion"]?.length);
331
- result.push(fg.getMetaStateCompetency(c2)["positiveAssertion"]?.length);
334
+ if (fg.getMetaStateCompetency(c)["positiveAssertion"] != null)
335
+ result.push(fg.getMetaStateCompetency(c)["positiveAssertion"].length);
336
+ if (fg.getMetaStateCompetency(c2)["positiveAssertion"] != null)
337
+ result.push(fg.getMetaStateCompetency(c2)["positiveAssertion"].length);
332
338
  return result;
333
339
  }).catch((err) => {
334
340
  assert.fail(err);
@@ -370,8 +376,10 @@ describe("EcFrameworkGraph", () => {
370
376
  () => {}
371
377
  ).then(() => {
372
378
  let result = [];
373
- result.push(fg.getMetaStateCompetency(c)["negativeAssertion"]?.length);
374
- result.push(fg.getMetaStateCompetency(c2)["negativeAssertion"]?.length);
379
+ if (fg.getMetaStateCompetency(c)["negativeAssertion"] != null)
380
+ result.push(fg.getMetaStateCompetency(c)["negativeAssertion"].length);
381
+ if (fg.getMetaStateCompetency(c2)["negativeAssertion"] != null)
382
+ result.push(fg.getMetaStateCompetency(c2)["negativeAssertion"].length);
375
383
  return result;
376
384
  }).catch((err) => {
377
385
  assert.fail(err);
@@ -415,10 +423,14 @@ describe("EcFrameworkGraph", () => {
415
423
  () => {}
416
424
  ).then(() => {
417
425
  let result = [];
418
- result.push(fg.getMetaStateCompetency(c)["positiveAssertion"]?.length);
419
- result.push(fg.getMetaStateCompetency(c2)["positiveAssertion"]?.length);
420
- result.push(fg.getMetaStateCompetency(c)["negativeAssertion"]?.length);
421
- result.push(fg.getMetaStateCompetency(c2)["negativeAssertion"]?.length);
426
+ if (fg.getMetaStateCompetency(c)["positiveAssertion"] != null)
427
+ result.push(fg.getMetaStateCompetency(c)["positiveAssertion"].length);
428
+ if (fg.getMetaStateCompetency(c2)["positiveAssertion"] != null)
429
+ result.push(fg.getMetaStateCompetency(c2)["positiveAssertion"].length);
430
+ if (fg.getMetaStateCompetency(c)["negativeAssertion"] != null)
431
+ result.push(fg.getMetaStateCompetency(c)["negativeAssertion"].length);
432
+ if (fg.getMetaStateCompetency(c2)["negativeAssertion"] != null)
433
+ result.push(fg.getMetaStateCompetency(c2)["negativeAssertion"].length);
422
434
  return result;
423
435
  }).catch((err) => {
424
436
  assert.fail(err);
@@ -507,9 +519,12 @@ describe("EcFrameworkGraph", () => {
507
519
  () => {}
508
520
  ).then(() => {
509
521
  let result = [];
510
- result.push(fg.getMetaStateCompetency(c)["positiveAssertion"]?.length);
511
- result.push(fg.getMetaStateCompetency(c2)["positiveAssertion"]?.length);
512
- result.push(fg.getMetaStateCompetency(c3)["positiveAssertion"]?.length);
522
+ if (fg.getMetaStateCompetency(c)["positiveAssertion"] != null)
523
+ result.push(fg.getMetaStateCompetency(c)["positiveAssertion"].length);
524
+ if (fg.getMetaStateCompetency(c2)["positiveAssertion"] != null)
525
+ result.push(fg.getMetaStateCompetency(c2)["positiveAssertion"].length);
526
+ if (fg.getMetaStateCompetency(c3)["positiveAssertion"] != null)
527
+ result.push(fg.getMetaStateCompetency(c3)["positiveAssertion"].length);
513
528
  return result;
514
529
  }).catch((err) => {
515
530
  assert.fail(err);
@@ -557,7 +572,8 @@ describe("EcFrameworkGraph", () => {
557
572
  let result = [];
558
573
  result.push(fg.getMetaStateCompetency(c)["positiveAssertion"]);
559
574
  result.push(fg.getMetaStateCompetency(c2)["positiveAssertion"]);
560
- result.push(fg.getMetaStateCompetency(c3)["positiveAssertion"]?.length);
575
+ if (fg.getMetaStateCompetency(c3)["positiveAssertion"] != null)
576
+ result.push(fg.getMetaStateCompetency(c3)["positiveAssertion"].length);
561
577
  return result;
562
578
  }).catch((err) => {
563
579
  assert.fail(err);
@@ -600,8 +616,10 @@ describe("EcFrameworkGraph", () => {
600
616
  () => {}
601
617
  ).then(() => {
602
618
  let result = [];
603
- result.push(fg.getMetaStateCompetency(c)["positiveAssertion"]?.length);
604
- result.push(fg.getMetaStateCompetency(c2)["positiveAssertion"]?.length);
619
+ if (fg.getMetaStateCompetency(c)["positiveAssertion"] != null)
620
+ result.push(fg.getMetaStateCompetency(c)["positiveAssertion"].length);
621
+ if (fg.getMetaStateCompetency(c2)["positiveAssertion"] != null)
622
+ result.push(fg.getMetaStateCompetency(c2)["positiveAssertion"].length);
605
623
  return result;
606
624
  }).catch((err) => {
607
625
  assert.fail(err);
@@ -643,8 +661,10 @@ describe("EcFrameworkGraph", () => {
643
661
  () => {}
644
662
  ).then(() => {
645
663
  let result = [];
646
- result.push(fg.getMetaStateCompetency(c)["negativeAssertion"]?.length);
647
- result.push(fg.getMetaStateCompetency(c2)["negativeAssertion"]?.length);
664
+ if (fg.getMetaStateCompetency(c)["negativeAssertion"] != null)
665
+ result.push(fg.getMetaStateCompetency(c)["negativeAssertion"].length);
666
+ if (fg.getMetaStateCompetency(c2)["negativeAssertion"] != null)
667
+ result.push(fg.getMetaStateCompetency(c2)["negativeAssertion"].length);
648
668
  return result;
649
669
  }).catch((err) => {
650
670
  assert.fail(err);
@@ -686,8 +706,10 @@ describe("EcFrameworkGraph", () => {
686
706
  () => {}
687
707
  ).then(() => {
688
708
  let result = [];
689
- result.push(fg.getMetaStateCompetency(c)["positiveAssertion"]?.length);
690
- result.push(fg.getMetaStateCompetency(c2)["positiveAssertion"]?.length);
709
+ if (fg.getMetaStateCompetency(c)["positiveAssertion"] != null)
710
+ result.push(fg.getMetaStateCompetency(c)["positiveAssertion"].length);
711
+ if (fg.getMetaStateCompetency(c2)["positiveAssertion"] != null)
712
+ result.push(fg.getMetaStateCompetency(c2)["positiveAssertion"].length);
691
713
  return result;
692
714
  }).catch((err) => {
693
715
  assert.fail(err);
@@ -729,8 +751,10 @@ describe("EcFrameworkGraph", () => {
729
751
  () => {}
730
752
  ).then(() => {
731
753
  let result = [];
732
- result.push(fg.getMetaStateCompetency(c)["negativeAssertion"]?.length);
733
- result.push(fg.getMetaStateCompetency(c2)["negativeAssertion"]?.length);
754
+ if (fg.getMetaStateCompetency(c)["negativeAssertion"] != null)
755
+ result.push(fg.getMetaStateCompetency(c)["negativeAssertion"].length);
756
+ if (fg.getMetaStateCompetency(c2)["negativeAssertion"] != null)
757
+ result.push(fg.getMetaStateCompetency(c2)["negativeAssertion"].length);
734
758
  return result;
735
759
  }).catch((err) => {
736
760
  assert.fail(err);
@@ -776,9 +800,12 @@ describe("EcFrameworkGraph", () => {
776
800
  () => {}
777
801
  ).then(() => {
778
802
  let result = [];
779
- result.push(fg.getMetaStateCompetency(c)["positiveAssertion"]?.length);
780
- result.push(fg.getMetaStateCompetency(c2)["positiveAssertion"]?.length);
781
- result.push(fg.getMetaStateCompetency(c3)["positiveAssertion"]?.length);
803
+ if (fg.getMetaStateCompetency(c)["positiveAssertion"] != null)
804
+ result.push(fg.getMetaStateCompetency(c)["positiveAssertion"].length);
805
+ if (fg.getMetaStateCompetency(c2)["positiveAssertion"] != null)
806
+ result.push(fg.getMetaStateCompetency(c2)["positiveAssertion"].length);
807
+ if (fg.getMetaStateCompetency(c3)["positiveAssertion"] != null)
808
+ result.push(fg.getMetaStateCompetency(c3)["positiveAssertion"].length);
782
809
  return result;
783
810
  }).catch((err) => {
784
811
  assert.fail(err);
@@ -826,9 +853,12 @@ describe("EcFrameworkGraph", () => {
826
853
  () => {}
827
854
  ).then(() => {
828
855
  let result = [];
829
- result.push(fg.getMetaStateCompetency(c)["negativeAssertion"]?.length);
830
- result.push(fg.getMetaStateCompetency(c2)["negativeAssertion"]?.length);
831
- result.push(fg.getMetaStateCompetency(c3)["negativeAssertion"]?.length);
856
+ if (fg.getMetaStateCompetency(c)["negativeAssertion"] != null)
857
+ result.push(fg.getMetaStateCompetency(c)["negativeAssertion"].length);
858
+ if (fg.getMetaStateCompetency(c2)["negativeAssertion"] != null)
859
+ result.push(fg.getMetaStateCompetency(c2)["negativeAssertion"].length);
860
+ if (fg.getMetaStateCompetency(c3)["negativeAssertion"] != null)
861
+ result.push(fg.getMetaStateCompetency(c3)["negativeAssertion"].length);
832
862
  return result;
833
863
  }).catch((err) => {
834
864
  assert.fail(err);
@@ -866,7 +896,8 @@ describe("EcFrameworkGraph", () => {
866
896
  () => {}
867
897
  ).then(() => {
868
898
  let result = [];
869
- result.push(fg.getMetaStateCompetency(c)["positiveAssertion"]?.length);
899
+ if (fg.getMetaStateCompetency(c)["positiveAssertion"] != null)
900
+ result.push(fg.getMetaStateCompetency(c)["positiveAssertion"].length);
870
901
  return result;
871
902
  }).catch((err) => {
872
903
  assert.fail(err);
@@ -1,3 +1,5 @@
1
+ require("../../../../org/cassproject/general/AuditLogger.js");
2
+
1
3
  global.axiosOptions = {};
2
4
  var isNode = false;
3
5
  if (typeof process === 'object') {
@@ -35,7 +37,7 @@ if (global.axios == null)
35
37
  http2 = require("http2-wrapper");
36
38
  https = require("https");
37
39
  } catch(e) {
38
- console.log(e);
40
+ global.auditLogger.report(global.auditLogger.LogCategory.NETWORK, global.auditLogger.Severity.ERROR, "EcRemoteInitHttp2", e);
39
41
  }
40
42
  function http2AdapterEnhancer(adapter) {
41
43
  return async (config) => {
@@ -88,7 +90,7 @@ if (global.axios == null)
88
90
  try {
89
91
  https = require("https");
90
92
  } catch(e) {
91
- console.log(e);
93
+ global.auditLogger.report(global.auditLogger.LogCategory.NETWORK, global.auditLogger.Severity.ERROR, "EcRemoteInitHttps", e);
92
94
  }
93
95
  function httpsAdapterEnhancer(adapter) {
94
96
  return async (config) => {
@@ -245,10 +247,12 @@ module.exports = class EcRemote {
245
247
  maxBodyLength: Infinity
246
248
  })
247
249
  .then((response) => {
250
+ //global.auditLogger.report(global.auditLogger.LogCategory.NETWORK, global.auditLogger.Severity.INFO, "EcRemotePostInner", response.request.socket ? response.request.socket.remoteAddress : '', url, postHeaders);
248
251
  return response.data;
249
252
  })
250
253
  .catch((err) => {
251
254
  if (err != null) {
255
+ global.auditLogger.report(global.auditLogger.LogCategory.NETWORK, global.auditLogger.Severity.ERROR, "EcRemotePostInner", err && err.response && err.response.request.socket ? err.response.request.socket.remoteAddress : '', url, postHeaders, err);
252
256
  if (err.response != null) {
253
257
  if (err.response.data != null)
254
258
  throw err.response.data;
@@ -256,7 +260,7 @@ module.exports = class EcRemote {
256
260
  }
257
261
  throw err;
258
262
  }
259
- console.trace("Internal error in Axios?");
263
+ else global.auditLogger.report(global.auditLogger.LogCategory.NETWORK, global.auditLogger.Severity.ERROR, "EcRemotePostInner", "Internal error in Axios?");
260
264
  });
261
265
  return cassPromisify(p, successCallback, failureCallback);
262
266
  }
@@ -295,9 +299,11 @@ module.exports = class EcRemote {
295
299
  let p = axios
296
300
  .get(url,axiosOptions)
297
301
  .then((response) => {
302
+ global.auditLogger.report(global.auditLogger.LogCategory.NETWORK, global.auditLogger.Severity.INFO, "EcRemoteGetExpectString", response.request.socket ? response.request.socket.remoteAddress : '', url);
298
303
  return response.data;
299
304
  })
300
305
  .catch((err) => {
306
+ global.auditLogger.report(global.auditLogger.LogCategory.NETWORK, global.auditLogger.Severity.ERROR, "EcRemoteGetExpectString", err && err.response && err.response.request.socket ? err.response.request.socket.remoteAddress : '', url, err);
301
307
  if (err) {
302
308
  if (err.response) {
303
309
  if (err.response.data)
@@ -340,9 +346,11 @@ module.exports = class EcRemote {
340
346
  headers: { signatureSheet: signatureSheet }
341
347
  })
342
348
  .then((response) => {
349
+ //global.auditLogger.report(global.auditLogger.LogCategory.NETWORK, global.auditLogger.Severity.INFO, "EcRemoteDelete", response.request.socket ? response.request.socket.remoteAddress : '', url, signatureSheet);
343
350
  return response.data;
344
351
  })
345
352
  .catch((err) => {
353
+ global.auditLogger.report(global.auditLogger.LogCategory.NETWORK, global.auditLogger.Severity.ERROR, "EcRemoteDelete", err && err.response && err.response.request.socket ? err.response.request.socket.remoteAddress : '', url, signatureSheet, err);
346
354
  if (err) {
347
355
  if (err.response) {
348
356
  if (err.response.data)
@@ -1,5 +1,7 @@
1
1
  const EcRepository = require("../../../../../org/cassproject/ebac/repository/EcRepository");
2
2
 
3
+ require("../../../../../org/cassproject/general/AuditLogger.js");
4
+
3
5
  /**
4
6
  * @author debbie.brown@eduworks.com
5
7
  */
@@ -535,7 +537,7 @@ module.exports = class ExtPerson extends schema.Person {
535
537
  if (url.indexOf("http") > 0) this.additionalType = url;
536
538
  else if (ExtPerson.positionLabelsMap[url] != null)
537
539
  this.additionalType = ExtPerson.positionLabelsMap[url];
538
- else console.log("error: " + url + " not a supported position");
540
+ else global.auditLogger.report(global.auditLogger.LogCategory.SYSTEM, global.auditLogger.Severity.ERROR, "ExtPersSetPos", "error: " + url + " not a supported position");
539
541
  }
540
542
  /**
541
543
  * Returns position label corresponding to the URL form
@@ -1,5 +1,6 @@
1
1
  const EcRepository = require("../../cassproject/ebac/repository/EcRepository.js");
2
2
  const Competency = require("../../cassproject/schema/cass/competency/Competency.js");
3
+ require("../../cassproject/general/AuditLogger.js");
3
4
  /**
4
5
  * Implementation of a Competency object with methods for interacting with CASS
5
6
  * services on a server.
@@ -384,15 +385,15 @@ module.exports = class EcCompetency extends Competency {
384
385
  */
385
386
  async _delete(success, failure, repo, eim) {
386
387
  var me = this;
387
- if (repo != null) console.log(await this.relations(repo));
388
+ if (repo != null) global.auditLogger.report(global.auditLogger.LogCategory.SYSTEM, global.auditLogger.Severity.INFO, "EcCompDelete", await this.relations(repo));
388
389
  if (repo != null) {
389
- console.log(JSON.stringify(await this.relations(repo)));
390
+ global.auditLogger.report(global.auditLogger.LogCategory.SYSTEM, global.auditLogger.Severity.INFO, "EcCompDelete", JSON.stringify(await this.relations(repo)));
390
391
  (await this.relations(repo)).forEach(
391
392
  async (relation) => await EcRepository.DELETE(relation, null, null, repo, eim)
392
393
  );
393
394
  }
394
395
  if (repo != null) {
395
- console.log(JSON.stringify(await this.levels(repo)));
396
+ global.auditLogger.report(global.auditLogger.LogCategory.SYSTEM, global.auditLogger.Severity.INFO, "EcCompDelete", JSON.stringify(await this.levels(repo)));
396
397
  (await this.levels(repo)).forEach(
397
398
  async (level) => await EcRepository.DELETE(level, null, null, repo, eim)
398
399
  );
@@ -38,10 +38,17 @@ module.exports = class EcIdentity {
38
38
  /**
39
39
  * String identifying where this identity came from
40
40
  *
41
- * @property displayName
41
+ * @property source
42
42
  * @type String
43
43
  */
44
44
  source = null;
45
+ /**
46
+ * Timestamp of last login
47
+ *
48
+ * @property lastLogin
49
+ * @type Number
50
+ */
51
+ lastLogin = null;
45
52
  /**
46
53
  * Helper function to decrypt a credential (storable version of an identity)
47
54
  * into an identity)
@@ -1,6 +1,7 @@
1
1
  const EcPk = require("../../../../com/eduworks/ec/crypto/EcPk");
2
2
  const EcRsaOaepAsync = require("../../../../com/eduworks/ec/crypto/EcRsaOaepAsync");
3
3
  const EcRemoteLinkedData = require("../../schema/general/EcRemoteLinkedData");
4
+ require("../../general/AuditLogger.js");
4
5
 
5
6
  /**
6
7
  * The record used to request a rekey of a given public key
@@ -47,7 +48,7 @@ module.exports = class EcRekeyRequest extends EcRemoteLinkedData {
47
48
  * @method generateRekeyRequestId
48
49
  */
49
50
  async finalizeRequest(oldKeyPpk) {
50
- console.log("creating: " + this.toSignableJson());
51
+ global.auditLogger.report(global.auditLogger.LogCategory.SYSTEM, global.auditLogger.Severity.INFO, "EcRekeyReqFinalReq", "creating: " + this.toSignableJson());
51
52
  this.rekeySignature = await EcRsaOaepAsync.signSha256(
52
53
  oldKeyPpk,
53
54
  this.toSignableJson()
@@ -81,7 +82,7 @@ module.exports = class EcRekeyRequest extends EcRemoteLinkedData {
81
82
  delete d["rekeySignature"];
82
83
  var e = new EcLinkedData(d.context, d.type);
83
84
  e.copyFrom(d);
84
- console.log("verifying: " + e.toJson());
85
+ global.auditLogger.report(global.auditLogger.LogCategory.SYSTEM, global.auditLogger.Severity.INFO, "EcRekeyReqToSign", "verifying: " + e.toJson());
85
86
  return e.toJson();
86
87
  }
87
88
  /**
@@ -9,6 +9,7 @@ const EcIdentityManager = require("../EcIdentityManager");
9
9
  const RemoteIdentityManagerInterface = require("./RemoteIdentityManagerInterface");
10
10
  let forge = require("node-forge");
11
11
  const EcPpkFacade = require("../../../../../com/eduworks/ec/crypto/EcPpkFacade");
12
+ require("../../../general/AuditLogger.js")
12
13
 
13
14
  /**
14
15
  * Logs into and stores/retrieves credentials from a compatible remote server.
@@ -365,7 +366,7 @@ module.exports = class EcRemoteIdentityManager extends RemoteIdentityManagerInte
365
366
  }
366
367
  catch(ex)
367
368
  {
368
- console.error(ex);
369
+ global.auditLogger.report(global.auditLogger.LogCategory.SYSTEM, global.auditLogger.Severity.ERROR, "EcRemoIdenManaFetch", ex);
369
370
  }
370
371
  if (identity == null || identity.ppk == null)
371
372
  {
@@ -380,6 +381,7 @@ module.exports = class EcRemoteIdentityManager extends RemoteIdentityManagerInte
380
381
  }
381
382
  if (identity.ppk == null)
382
383
  throw new Error("Could not retreive encrypted ppks from credential packet.")
384
+ identity.lastLogin = cs.lastLogin;
383
385
  eim.addIdentity(identity);
384
386
  }
385
387
  if (cs.contacts != null)
@@ -395,7 +397,7 @@ module.exports = class EcRemoteIdentityManager extends RemoteIdentityManagerInte
395
397
  }
396
398
  catch(ex)
397
399
  {
398
- console.error(ex);
400
+ global.auditLogger.report(global.auditLogger.LogCategory.SYSTEM, global.auditLogger.Severity.ERROR, "EcRemoIdenManaFetch", ex);
399
401
  }
400
402
  if (identity == null || identity.pk == null)
401
403
  {
@@ -417,7 +419,7 @@ module.exports = class EcRemoteIdentityManager extends RemoteIdentityManagerInte
417
419
  return eim;
418
420
  },
419
421
  function (arg0) {
420
- console.trace(arg0);
422
+ global.auditLogger.report(global.auditLogger.LogCategory.SYSTEM, global.auditLogger.Severity.ERROR, "EcRemoIdenManaFetch", arg0);
421
423
  throw new Error(arg0);
422
424
  }
423
425
  ),
@@ -12,6 +12,7 @@ const EcLinkedData = require("../../../json/ld/EcLinkedData");
12
12
  const EcIdentityManager = require("../identity/EcIdentityManager");
13
13
  const base64 = require("base64-arraybuffer");
14
14
  const EcRemoteLinkedData = require("../../schema/general/EcRemoteLinkedData");
15
+ require("../../general/AuditLogger.js")
15
16
 
16
17
  /**
17
18
  * Represents an encrypted piece of data. Provides helper functions for
@@ -125,6 +126,12 @@ module.exports = class EcEncryptedValue extends EbacEncryptedValue {
125
126
  if (d["name"] != null) {
126
127
  v.name = d["name"];
127
128
  }
129
+ if (d["Classification"] != null) {
130
+ v.Classification = d["Classification"];
131
+ }
132
+ if (d["Markings"] != null) {
133
+ v.Markings = d["Markings"];
134
+ }
128
135
  var newIv = EcAes.newIv(16);
129
136
  var newSecret = EcAes.newIv(16);
130
137
  return this.encryptValueActual(
@@ -470,7 +477,7 @@ module.exports = class EcEncryptedValue extends EbacEncryptedValue {
470
477
  JSON.parse(decryptedSecret)
471
478
  );
472
479
  }
473
- console.log(JSON.stringify(decryptedSecret, null, 2));
480
+ global.auditLogger.report(global.auditLogger.LogCategory.SYSTEM, global.auditLogger.Severity.INFO, "EcEncrValIterate", JSON.stringify(decryptedSecret, null, 2));
474
481
  return new Promise(iterate);
475
482
  }
476
483
  );
@@ -11,6 +11,7 @@ const EcCrypto = require("../../../../com/eduworks/ec/crypto/EcCrypto");
11
11
  const EcIdentity = require("../identity/EcIdentity");
12
12
  const EcPpkFacade = require("../../../../com/eduworks/ec/crypto/EcPpkFacade");
13
13
  const EcPk = require("../../../../com/eduworks/ec/crypto/EcPk");
14
+ require("../../general/AuditLogger.js")
14
15
 
15
16
  /**
16
17
  * Repository object used to interact with the CASS Repository web services.
@@ -65,11 +66,12 @@ module.exports = class EcRepository {
65
66
  }
66
67
  }
67
68
  };
68
- var failureCheck = console.trace;
69
69
  EcRemote.timeout = oldTimeout;
70
70
  return EcRemote.getExpectingObject(this.selectedServerProxy != null ? this.selectedServerProxy : this.selectedServer, "ping")
71
71
  .then(successCheck)
72
- .catch(failureCheck);
72
+ .catch((error) => {
73
+ global.auditLogger.report(global.auditLogger.LogCategory.SYSTEM, global.auditLogger.Severity.ERROR, "EcRepoTimeOffset", error);
74
+ });
73
75
  };
74
76
  buildKeyForwardingTable = function (success, failure, eim) {
75
77
  var params = {size: 10000};
@@ -85,10 +87,7 @@ module.exports = class EcRepository {
85
87
  for (var i = 0; i < rekeyRequests.length; i++) {
86
88
  rekeyRequests[i].addRekeyRequestToForwardingTable();
87
89
  }
88
- console.log(
89
- EcObject.keys(EcRemoteLinkedData.forwardingTable).length +
90
- " records now in forwarding table."
91
- );
90
+ global.auditLogger.report(global.auditLogger.LogCategory.SYSTEM, global.auditLogger.Severity.INFO, "EcRepoBuildKeyForwTable", EcObject.keys(EcRemoteLinkedData.forwardingTable).length + " records now in forwarding table.");
92
91
  }),
93
92
  success,
94
93
  failure
@@ -80,6 +80,7 @@ let changeNameAndSaveAndCheckMultiput = async (rld) => {
80
80
  let newName = "Some Thing " + EcCrypto.generateUUID();
81
81
  rld.setName(newName);
82
82
  await repo.multiput([rld]);
83
+ await setTimeout(()=>{},1000);
83
84
  assert.equal((await EcEncryptedValue.fromEncryptedValue(await EcRepository.get(rld.shortId(), null, null, repo))).getName(), newName);
84
85
  };
85
86
 
@@ -0,0 +1,15 @@
1
+ if (!global.auditLogger) { // Running client-side
2
+ global.auditLogger = {
3
+ report: function(system, severity, message, ...data) {
4
+ if (severity === 'error') {
5
+ console.trace(system + ": " + severity + ": " + message + ": " + data);
6
+ } else {
7
+ console.log(system + ": " + severity + ": " + message + ": " + data);
8
+ }
9
+ },
10
+ LogCategory: {},
11
+ Severity: {
12
+ ERROR: 'error'
13
+ }
14
+ }
15
+ }
@@ -1,4 +1,5 @@
1
1
  const EcRepository = require("../../ebac/repository/EcRepository");
2
+ require("../AuditLogger.js")
2
3
 
3
4
  /**
4
5
  * Implementation of a file with methods for communicating with repository services
@@ -96,7 +97,7 @@ module.exports = class EcFile extends GeneralFile {
96
97
  if (this.name == null || this.name == "") {
97
98
  var msg = "File Name can not be empty";
98
99
  if (failure != null) failure(msg);
99
- else console.error(msg);
100
+ else global.auditLogger.report(global.auditLogger.LogCategory.SYSTEM, global.auditLogger.Severity.ERROR, "EcFileSave", msg);
100
101
  return;
101
102
  }
102
103
  return EcRepository.save(this, success, failure, repo, eim);
@@ -6,6 +6,7 @@ const EcPpkFacade = require("../../../../com/eduworks/ec/crypto/EcPpkFacade.js")
6
6
  const EcRsaOaepAsync = require("../../../../com/eduworks/ec/crypto/EcRsaOaepAsync.js");
7
7
  const EcLinkedData = require("../../../json/ld/EcLinkedData.js");
8
8
  const Ebac = require("./Ebac.js");
9
+ require("../../general/AuditLogger.js")
9
10
 
10
11
  /**
11
12
  * Data wrapper to represent remotely hosted data. Includes necessary KBAC fields for
@@ -281,7 +282,7 @@ module.exports = class EcRemoteLinkedData extends EcLinkedData {
281
282
  this.toSignableJson(),
282
283
  sig
283
284
  );
284
- console.log(verify);
285
+ global.auditLogger.report(global.auditLogger.LogCategory.SYSTEM, global.auditLogger.Severity.INFO, "EcRemoteLDVerify", verify);
285
286
  } catch (ex) {
286
287
  verify = false;
287
288
  }
@@ -1,5 +1,6 @@
1
1
  const EcArray = require("../../../com/eduworks/ec/array/EcArray");
2
2
  const EcObject = require("../../../com/eduworks/ec/array/EcObject");
3
+ require("../../../org/cassproject/general/AuditLogger.js")
3
4
 
4
5
  global.jsonld = require("jsonld");
5
6
  /**
@@ -274,7 +275,7 @@ global.jsonld = require("jsonld");
274
275
  actual = await jsonld.expand(json);
275
276
  } catch(error) {
276
277
  if (error != null) {
277
- console.error(error["message"]);
278
+ global.auditLogger.report(global.auditLogger.LogCategory.SYSTEM, global.auditLogger.Severity.ERROR, "EcLinkedDataRecast", error["message"]);
278
279
  return;
279
280
  }
280
281
  }
@@ -283,7 +284,7 @@ global.jsonld = require("jsonld");
283
284
  o = await jsonld.compact(actual, finalTargetContext);
284
285
  } catch(s) {
285
286
  if (s != null) {
286
- console.error(s);
287
+ global.auditLogger.report(global.auditLogger.LogCategory.SYSTEM, global.auditLogger.Severity.ERROR, "EcLinkedDataRecast", s);
287
288
  return;
288
289
  }
289
290
  }
@@ -1,5 +1,6 @@
1
1
  const EcArray = require("../../com/eduworks/ec/array/EcArray");
2
2
  const EcRepository = require("../cassproject/ebac/repository/EcRepository");
3
+ require("../cassproject/general/AuditLogger.js")
3
4
 
4
5
  module.exports = class EcOrganization extends schema.Organization {
5
6
  static ORG_PPK_SET_KEY = "https://schema.cassproject.org/0.3/ppkSet";
@@ -165,7 +166,7 @@ module.exports = class EcOrganization extends schema.Organization {
165
166
  if (repo == null) {
166
167
  var msg = "Repository cannot be null for a rekey operation";
167
168
  if (failure != null) failure(msg);
168
- else console.error(msg);
169
+ else global.auditLogger.report(global.auditLogger.LogCategory.SYSTEM, global.auditLogger.Severity.ERROR, "EcOrgRekeyAndSave", msg);
169
170
  return;
170
171
  } else {
171
172
  var oldKey = await this.getCurrentOrgKey();