@contrast/agent 5.0.0-beta.1 → 5.0.0-beta.10
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/LICENSE +12 -0
- package/lib/index.js +49 -21
- package/package.json +16 -15
package/LICENSE
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
Copyright: 2023 Contrast Security, Inc
|
|
2
|
+
Contact: support@contrastsecurity.com
|
|
3
|
+
License: Commercial
|
|
4
|
+
|
|
5
|
+
NOTICE: This Software and the patented inventions embodied within may only be
|
|
6
|
+
used as part of Contrast Security’s commercial offerings. Even though it is
|
|
7
|
+
made available through public repositories, use of this Software is subject to
|
|
8
|
+
the applicable End User Licensing Agreement found at
|
|
9
|
+
https://www.contrastsecurity.com/enduser-terms-0317a or as otherwise agreed
|
|
10
|
+
between Contrast Security and the End User. The Software may not be reverse
|
|
11
|
+
engineered, modified, repackaged, sold, redistributed or otherwise used in a
|
|
12
|
+
way not consistent with the End User License Agreement.
|
package/lib/index.js
CHANGED
|
@@ -16,20 +16,20 @@
|
|
|
16
16
|
'use strict';
|
|
17
17
|
|
|
18
18
|
const semver = require('semver');
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
19
|
+
const {
|
|
20
|
+
name: agentName,
|
|
21
|
+
version: agentVersion,
|
|
22
|
+
engines: {
|
|
23
|
+
node: nodeEngine,
|
|
24
|
+
npm: npmEngine
|
|
25
|
+
}
|
|
26
|
+
} = require('../package.json');
|
|
27
|
+
const agentify = require('@contrast/agentify')({ agentName, agentVersion });
|
|
26
28
|
|
|
27
29
|
agentify((core) => {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
if (!semver.satisfies(process.version, node)) {
|
|
30
|
+
if (!semver.satisfies(process.version, nodeEngine)) {
|
|
31
31
|
let validRanges = '';
|
|
32
|
-
|
|
32
|
+
nodeEngine.split('||').forEach((range) => {
|
|
33
33
|
const minVersion = semver.minVersion(range).toString();
|
|
34
34
|
const maxVersion = range.split('<').pop()
|
|
35
35
|
.trim();
|
|
@@ -38,15 +38,43 @@ agentify((core) => {
|
|
|
38
38
|
throw new Error(`Contrast only officially supports Node LTS versions between ${validRanges}but detected ${process.version}.`);
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
41
|
+
core.startupValidation = {
|
|
42
|
+
/**
|
|
43
|
+
* This will run after we onboard to the UI and pick up any remote settings.
|
|
44
|
+
*/
|
|
45
|
+
install() {
|
|
46
|
+
if (
|
|
47
|
+
!core.config.getEffectiveValue('assess.enable') &&
|
|
48
|
+
!core.config.getEffectiveValue('protect.enable')
|
|
49
|
+
) {
|
|
50
|
+
throw new Error('Neither Assess nor Protect are enabled. Check local configuration and UI settings');
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
};
|
|
48
54
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
55
|
+
core.npmVersionRange = npmEngine;
|
|
56
|
+
require('@contrast/assess')(core);
|
|
57
|
+
require('@contrast/architecture-components')(core);
|
|
58
|
+
require('@contrast/library-analysis')(core);
|
|
59
|
+
require('@contrast/route-coverage')(core);
|
|
60
|
+
require('@contrast/protect')(core); // protect loads lastly, being the only non-passive feature
|
|
61
|
+
}, {
|
|
62
|
+
installOrder: [
|
|
63
|
+
'reporter',
|
|
64
|
+
'startupValidation',
|
|
65
|
+
'contrastMethods',
|
|
66
|
+
'deadzones',
|
|
67
|
+
'scopes',
|
|
68
|
+
'sources',
|
|
69
|
+
'architectureComponents',
|
|
70
|
+
'assess',
|
|
71
|
+
'protect',
|
|
72
|
+
'depHooks',
|
|
73
|
+
'routeCoverage',
|
|
74
|
+
'libraryAnalysis',
|
|
75
|
+
'heapSnapshots',
|
|
76
|
+
'rewriteHooks',
|
|
77
|
+
'functionHooks',
|
|
78
|
+
'metrics',
|
|
79
|
+
],
|
|
52
80
|
});
|
package/package.json
CHANGED
|
@@ -1,27 +1,28 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contrast/agent",
|
|
3
|
-
"version": "5.0.0-beta.
|
|
3
|
+
"version": "5.0.0-beta.10",
|
|
4
4
|
"description": "Assess and Protect agents for Node.js",
|
|
5
|
+
"license": "SEE LICENSE IN LICENSE",
|
|
6
|
+
"author": "Contrast Security <nodejs@contrastsecurity.com> (https://www.contrastsecurity.com)",
|
|
7
|
+
"files": [
|
|
8
|
+
"lib/"
|
|
9
|
+
],
|
|
5
10
|
"main": "lib/index.js",
|
|
6
|
-
"
|
|
7
|
-
"lib": "lib"
|
|
8
|
-
},
|
|
11
|
+
"types": "lib/index.d.ts",
|
|
9
12
|
"engines": {
|
|
10
13
|
"npm": ">=6.13.7 <7 || >= 8.3.1",
|
|
11
|
-
"node": ">=14.15.0 <15 || >=16.9.1 <17 || >=18.7.0 <19"
|
|
14
|
+
"node": ">=14.15.0 <15 || >=16.9.1 <17 || >=18.7.0 <19 || >=20.5.0 <21"
|
|
12
15
|
},
|
|
13
16
|
"scripts": {
|
|
14
|
-
"test": "
|
|
17
|
+
"test": "../scripts/test.sh"
|
|
15
18
|
},
|
|
16
|
-
"author": "",
|
|
17
|
-
"license": "ISC",
|
|
18
19
|
"dependencies": {
|
|
19
|
-
"@contrast/
|
|
20
|
-
"@contrast/
|
|
21
|
-
"@contrast/
|
|
22
|
-
"@contrast/library-analysis": "1.
|
|
23
|
-
"@contrast/
|
|
24
|
-
"@contrast/
|
|
20
|
+
"@contrast/agentify": "1.16.0",
|
|
21
|
+
"@contrast/architecture-components": "1.13.1",
|
|
22
|
+
"@contrast/assess": "1.18.0",
|
|
23
|
+
"@contrast/library-analysis": "1.14.0",
|
|
24
|
+
"@contrast/protect": "1.28.1",
|
|
25
|
+
"@contrast/route-coverage": "1.12.0",
|
|
25
26
|
"semver": "^7.3.7"
|
|
26
27
|
}
|
|
27
|
-
}
|
|
28
|
+
}
|