@contrast/agent 5.0.0-beta.5 → 5.0.0-beta.6
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/lib/index.js +45 -13
- package/package.json +6 -6
package/lib/index.js
CHANGED
|
@@ -21,15 +21,20 @@ const archComponents = require('@contrast/architecture-components');
|
|
|
21
21
|
const libraryUsage = require('@contrast/library-analysis');
|
|
22
22
|
const protect = require('@contrast/protect');
|
|
23
23
|
const routeCoverage = require('@contrast/route-coverage');
|
|
24
|
-
const {
|
|
24
|
+
const {
|
|
25
|
+
name: agentName,
|
|
26
|
+
version: agentVersion,
|
|
27
|
+
engines: {
|
|
28
|
+
node: nodeEngine,
|
|
29
|
+
npm: npmEngine
|
|
30
|
+
}
|
|
31
|
+
} = require('../package.json');
|
|
25
32
|
const { agentify } = require('@contrast/core')({ agentName, agentVersion });
|
|
26
33
|
|
|
27
34
|
agentify((core) => {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
if (!semver.satisfies(process.version, node)) {
|
|
35
|
+
if (!semver.satisfies(process.version, nodeEngine)) {
|
|
31
36
|
let validRanges = '';
|
|
32
|
-
|
|
37
|
+
nodeEngine.split('||').forEach((range) => {
|
|
33
38
|
const minVersion = semver.minVersion(range).toString();
|
|
34
39
|
const maxVersion = range.split('<').pop()
|
|
35
40
|
.trim();
|
|
@@ -38,15 +43,42 @@ agentify((core) => {
|
|
|
38
43
|
throw new Error(`Contrast only officially supports Node LTS versions between ${validRanges}but detected ${process.version}.`);
|
|
39
44
|
}
|
|
40
45
|
|
|
46
|
+
core.startupValidation = {
|
|
47
|
+
/**
|
|
48
|
+
* This will run after we onboard to the UI and pick up any remote settings.
|
|
49
|
+
*/
|
|
50
|
+
install() {
|
|
51
|
+
if (
|
|
52
|
+
!core.config.getEffectiveValue('assess.enable') &&
|
|
53
|
+
!core.config.getEffectiveValue('protect.enable')
|
|
54
|
+
) {
|
|
55
|
+
throw new Error('Neither Assess nor Protect are enabled. Check local configuration and UI settings');
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
core.npmVersionRange = npmEngine;
|
|
61
|
+
assess(core);
|
|
41
62
|
archComponents(core);
|
|
42
63
|
libraryUsage(core);
|
|
43
64
|
routeCoverage(core);
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
65
|
+
protect(core); // protect loads lastly, being the only non-passive feature
|
|
66
|
+
}, {
|
|
67
|
+
installOrder: [
|
|
68
|
+
'reporter',
|
|
69
|
+
'startupValidation',
|
|
70
|
+
'contrastMethods',
|
|
71
|
+
'deadzones',
|
|
72
|
+
'scopes',
|
|
73
|
+
'sources',
|
|
74
|
+
'architectureComponents',
|
|
75
|
+
'assess',
|
|
76
|
+
'protect',
|
|
77
|
+
'depHooks',
|
|
78
|
+
'routeCoverage',
|
|
79
|
+
'libraryAnalysis',
|
|
80
|
+
'heapSnapshots',
|
|
81
|
+
'rewriteHooks',
|
|
82
|
+
'functionHooks'
|
|
83
|
+
],
|
|
52
84
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contrast/agent",
|
|
3
|
-
"version": "5.0.0-beta.
|
|
3
|
+
"version": "5.0.0-beta.6",
|
|
4
4
|
"description": "Assess and Protect agents for Node.js",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE",
|
|
6
6
|
"author": "Contrast Security <nodejs@contrastsecurity.com> (https://www.contrastsecurity.com)",
|
|
@@ -18,11 +18,11 @@
|
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
20
|
"@contrast/architecture-components": "1.13.1",
|
|
21
|
-
"@contrast/assess": "1.
|
|
22
|
-
"@contrast/core": "1.
|
|
23
|
-
"@contrast/library-analysis": "1.13.
|
|
24
|
-
"@contrast/route-coverage": "1.11.
|
|
25
|
-
"@contrast/protect": "1.
|
|
21
|
+
"@contrast/assess": "1.16.0",
|
|
22
|
+
"@contrast/core": "1.25.0",
|
|
23
|
+
"@contrast/library-analysis": "1.13.1",
|
|
24
|
+
"@contrast/route-coverage": "1.11.2",
|
|
25
|
+
"@contrast/protect": "1.27.0",
|
|
26
26
|
"semver": "^7.3.7"
|
|
27
27
|
}
|
|
28
28
|
}
|