@contrast/agent 5.15.0 → 5.17.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 +15 -15
- package/lib/start-agent.js +3 -2
- package/package.json +8 -8
package/README.md
CHANGED
|
@@ -18,9 +18,9 @@ easiest and cheapest to remediate.
|
|
|
18
18
|
|
|
19
19
|
## New in version 5
|
|
20
20
|
|
|
21
|
-
- The agent no longer ships or operates with the `contrast-service` "sidecar" executables. This allows for a drastically smaller download and simplified deployments.
|
|
21
|
+
- The agent no longer ships or operates with the `contrast-service` "sidecar" executables. This allows for a drastically smaller download size and simplified deployments.
|
|
22
22
|
|
|
23
|
-
- Framework support includes `express`, `koa`,
|
|
23
|
+
- Framework support includes `express`, `koa`, `fastify`, `hapi`, and `restify`.
|
|
24
24
|
|
|
25
25
|
- The agent does not respond to any command-line configuration flags. Configuration options can be set using environment variables and/or `contrast_security.yaml` file. If you were previously using the agent's `-c` CLI option to set the location of your configuration file, you can use `CONTRAST_CONFIG_PATH` environment variable instead. See more about configuration [below](#configuration).
|
|
26
26
|
|
|
@@ -28,6 +28,7 @@ easiest and cheapest to remediate.
|
|
|
28
28
|
|
|
29
29
|
- Ablility to run Assess and Protect modes concurrently.
|
|
30
30
|
|
|
31
|
+
- Full support for ESM modules
|
|
31
32
|
|
|
32
33
|
## Getting Started
|
|
33
34
|
|
|
@@ -35,7 +36,7 @@ Existing Contrast Node.js agent users should install and update the Contrast
|
|
|
35
36
|
Node.js agent from [npm](https://www.npmjs.com/). The Contrast Node.js agent follows semantic
|
|
36
37
|
versioning (`major.minor.patch`).
|
|
37
38
|
|
|
38
|
-
An API key, provided by Contrast Security, is required for the agent to function.
|
|
39
|
+
An API key or token, provided by Contrast Security, is required for the agent to function.
|
|
39
40
|
|
|
40
41
|
Ensure you have installed the latest LTS (Long Term Support) version of [Node.js](http://nodejs.org/)
|
|
41
42
|
|
|
@@ -60,14 +61,14 @@ node --import @contrast/agent app-main [app arguments]
|
|
|
60
61
|
|
|
61
62
|
Notes:
|
|
62
63
|
- `--import` should be used for Node.js LTS (Active and Maintenance) versions `>=18.19.0`
|
|
63
|
-
- Node.js versions `>=20.0.0
|
|
64
|
+
- Node.js versions `>=20.0.0 <20.6.0` are not supported
|
|
64
65
|
|
|
65
66
|
### With end-of-life Node.js Versions
|
|
66
67
|
|
|
67
68
|
When using the agent with end-of-life Node.js versions, use either the `--loader` or
|
|
68
69
|
`--require` flag, depending on the version of Node.js and the module system used.
|
|
69
70
|
|
|
70
|
-
Use the `--loader` flag for Node.js versions `>=16.17.0
|
|
71
|
+
Use the `--loader` flag for Node.js versions `>=16.17.0 <18.19.0`.
|
|
71
72
|
|
|
72
73
|
```sh
|
|
73
74
|
node --loader @contrast/agent app-main.mjs [app arguments]
|
|
@@ -82,15 +83,6 @@ node -r @contrast/agent app-main [app arguments]
|
|
|
82
83
|
Note:
|
|
83
84
|
- `-r` will still work for Node.js versions that have no ESM modules or dependencies.
|
|
84
85
|
|
|
85
|
-
### With @contrast/agent v4
|
|
86
|
-
|
|
87
|
-
The Contrast Node.js agent v4 is still available for use, but does not support ESM
|
|
88
|
-
modules. To use the v4 agent, use the `--require` (`-r`) flag.
|
|
89
|
-
|
|
90
|
-
```sh
|
|
91
|
-
node -r @contrast/agent app-main [app arguments]
|
|
92
|
-
```
|
|
93
|
-
|
|
94
86
|
### Configuration
|
|
95
87
|
|
|
96
88
|
#### File Locations
|
|
@@ -131,7 +123,7 @@ The agent will look for the `contrast_security.yaml` configuration file in the f
|
|
|
131
123
|
You can also specify the location of the configuration file with the `CONTRAST_CONFIG_PATH` environment variable:
|
|
132
124
|
|
|
133
125
|
```sh
|
|
134
|
-
CONTRAST_CONFIG_PATH=/path/to/config.yaml node
|
|
126
|
+
CONTRAST_CONFIG_PATH=/path/to/config.yaml node --import @contrast/agent app-main
|
|
135
127
|
```
|
|
136
128
|
|
|
137
129
|
> Note: If `process.env.CONTRAST_CONFIG_PATH` set, the agent will look at that location _only_. If there is an issue reading the configuration file from this location the agent will not look in the standard locations described above, but instead do the following:
|
|
@@ -155,6 +147,14 @@ api:
|
|
|
155
147
|
url: https://app.contrastsecurity.com
|
|
156
148
|
```
|
|
157
149
|
|
|
150
|
+
OR
|
|
151
|
+
|
|
152
|
+
```yaml
|
|
153
|
+
api:
|
|
154
|
+
# base64 encoded JSON object containing the url, api_key, service_key, and user_name
|
|
155
|
+
token: eyJ1cmwiOiJodHRwczovL2FwcC5jb250cmFzdHNlY3VyaXR5LmNvbSIsImFwaV9rZXkiOiJkQ0J2bTQ2dUVKQVVWMm11c05GYjM1N1NudnFZcmxxMSIsInNlcnZpY2Vfa2V5IjoiUFpVNDk5S0szWUQ0WDJEVCIsInVzZXJfbmFtZSI6ImFnZW50X2QyMjhhNTI3LTEzMGMtMThjYy05M2I4LTIwMDk2MTM2YmEwYkBVc2VyT3JnIn0=
|
|
156
|
+
```
|
|
157
|
+
|
|
158
158
|
Visit https://agent.config.contrastsecurity.com/ to use our online tool for building your YAML file interactively.
|
|
159
159
|
|
|
160
160
|
For detailed installation and configuration instructions, see the [Node.js Agent documentation](https://docs.contrastsecurity.com/en/install-node-js.html).
|
package/lib/start-agent.js
CHANGED
|
@@ -16,8 +16,9 @@
|
|
|
16
16
|
'use strict';
|
|
17
17
|
|
|
18
18
|
const process = require('process');
|
|
19
|
-
const { isMainThread } = require('worker_threads');
|
|
19
|
+
const { isMainThread, threadId } = require('worker_threads');
|
|
20
20
|
const _agentify = require('@contrast/agentify');
|
|
21
|
+
|
|
21
22
|
const {
|
|
22
23
|
name: agentName,
|
|
23
24
|
version: agentVersion,
|
|
@@ -100,7 +101,7 @@ function startAgent({ type = 'cjs' } = {}) {
|
|
|
100
101
|
console.error(err);
|
|
101
102
|
}
|
|
102
103
|
} else {
|
|
103
|
-
console.warn('Not in main thread. Thread continuing without instrumentation.');
|
|
104
|
+
console.warn('Not in main thread. Thread (tid: %d) continuing without instrumentation.', threadId);
|
|
104
105
|
}
|
|
105
106
|
}
|
|
106
107
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contrast/agent",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.17.0",
|
|
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)",
|
|
@@ -21,12 +21,12 @@
|
|
|
21
21
|
"test": "../scripts/test.sh"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@contrast/agentify": "1.
|
|
25
|
-
"@contrast/architecture-components": "1.
|
|
26
|
-
"@contrast/assess": "1.
|
|
27
|
-
"@contrast/library-analysis": "1.
|
|
28
|
-
"@contrast/protect": "1.
|
|
29
|
-
"@contrast/route-coverage": "1.
|
|
30
|
-
"@contrast/telemetry": "1.
|
|
24
|
+
"@contrast/agentify": "1.34.0",
|
|
25
|
+
"@contrast/architecture-components": "1.26.0",
|
|
26
|
+
"@contrast/assess": "1.37.0",
|
|
27
|
+
"@contrast/library-analysis": "1.27.0",
|
|
28
|
+
"@contrast/protect": "1.45.0",
|
|
29
|
+
"@contrast/route-coverage": "1.27.0",
|
|
30
|
+
"@contrast/telemetry": "1.14.0"
|
|
31
31
|
}
|
|
32
32
|
}
|