@contrast/agentify 1.52.1 → 1.53.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/lib/index.js +2 -2
- package/package.json +15 -14
- package/lib/sources.js +0 -94
package/lib/index.js
CHANGED
|
@@ -12,7 +12,6 @@
|
|
|
12
12
|
* engineered, modified, repackaged, sold, redistributed or otherwise used in a
|
|
13
13
|
* way not consistent with the End User License Agreement.
|
|
14
14
|
*/
|
|
15
|
-
/*eslint node/no-unsupported-features/es-syntax: ["error", {version: >=10.0.0}]*/
|
|
16
15
|
'use strict';
|
|
17
16
|
|
|
18
17
|
const Module = require('module');
|
|
@@ -137,6 +136,7 @@ module.exports = function init(core = {}) {
|
|
|
137
136
|
|
|
138
137
|
logger.info('Starting %s v%s', core.agentName, core.agentVersion);
|
|
139
138
|
logger.info({ config }, 'Agent configuration');
|
|
139
|
+
logger.debug({ effectiveConfig: config.getReport({ redact: true }) }, 'Effective configuration');
|
|
140
140
|
|
|
141
141
|
const plugin = await _callback?.(core);
|
|
142
142
|
|
|
@@ -191,9 +191,9 @@ module.exports = function init(core = {}) {
|
|
|
191
191
|
{ name: 'reporter', spec: '@contrast/reporter', default: true },
|
|
192
192
|
{ name: 'instrumentation', spec: '@contrast/instrumentation' },
|
|
193
193
|
{ name: 'metrics', spec: '@contrast/metrics' },
|
|
194
|
+
{ name: 'sources', spec: '@contrast/sources' },
|
|
194
195
|
// compose additional local services
|
|
195
196
|
{ name: 'heap-snapshots', spec: './heap-snapshots' },
|
|
196
|
-
{ name: 'sources', spec: './sources' },
|
|
197
197
|
{ name: 'function-hooks', spec: './function-hooks' },
|
|
198
198
|
{ name: 'diagnostics', spec: './diagnostics' },
|
|
199
199
|
{ name: 'rewrite-hooks', spec: './rewrite-hooks' },
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contrast/agentify",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.53.0",
|
|
4
4
|
"description": "Configures Contrast agent services and instrumentation within an application",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE",
|
|
6
6
|
"author": "Contrast Security <nodejs@contrastsecurity.com> (https://www.contrastsecurity.com)",
|
|
@@ -20,21 +20,22 @@
|
|
|
20
20
|
"test": "bash ../scripts/test.sh"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@contrast/common": "1.
|
|
24
|
-
"@contrast/config": "1.
|
|
25
|
-
"@contrast/core": "1.
|
|
26
|
-
"@contrast/deadzones": "1.
|
|
27
|
-
"@contrast/dep-hooks": "1.
|
|
28
|
-
"@contrast/esm-hooks": "2.
|
|
23
|
+
"@contrast/common": "1.35.0",
|
|
24
|
+
"@contrast/config": "1.50.0",
|
|
25
|
+
"@contrast/core": "1.55.0",
|
|
26
|
+
"@contrast/deadzones": "1.27.0",
|
|
27
|
+
"@contrast/dep-hooks": "1.24.0",
|
|
28
|
+
"@contrast/esm-hooks": "2.29.0",
|
|
29
29
|
"@contrast/find-package-json": "^1.1.0",
|
|
30
|
-
"@contrast/instrumentation": "1.
|
|
31
|
-
"@contrast/logger": "1.
|
|
32
|
-
"@contrast/metrics": "1.
|
|
33
|
-
"@contrast/patcher": "1.
|
|
30
|
+
"@contrast/instrumentation": "1.34.0",
|
|
31
|
+
"@contrast/logger": "1.28.0",
|
|
32
|
+
"@contrast/metrics": "1.32.0",
|
|
33
|
+
"@contrast/patcher": "1.27.0",
|
|
34
34
|
"@contrast/perf": "1.3.1",
|
|
35
|
-
"@contrast/reporter": "1.
|
|
36
|
-
"@contrast/rewriter": "1.
|
|
37
|
-
"@contrast/scopes": "1.
|
|
35
|
+
"@contrast/reporter": "1.52.0",
|
|
36
|
+
"@contrast/rewriter": "1.31.0",
|
|
37
|
+
"@contrast/scopes": "1.25.0",
|
|
38
|
+
"@contrast/sources": "1.1.0",
|
|
38
39
|
"on-finished": "^2.4.1",
|
|
39
40
|
"semver": "^7.6.0"
|
|
40
41
|
}
|
package/lib/sources.js
DELETED
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright: 2025 Contrast Security, Inc
|
|
3
|
-
* Contact: support@contrastsecurity.com
|
|
4
|
-
* License: Commercial
|
|
5
|
-
|
|
6
|
-
* NOTICE: This Software and the patented inventions embodied within may only be
|
|
7
|
-
* used as part of Contrast Security’s commercial offerings. Even though it is
|
|
8
|
-
* made available through public repositories, use of this Software is subject to
|
|
9
|
-
* the applicable End User Licensing Agreement found at
|
|
10
|
-
* https://www.contrastsecurity.com/enduser-terms-0317a or as otherwise agreed
|
|
11
|
-
* between Contrast Security and the End User. The Software may not be reverse
|
|
12
|
-
* engineered, modified, repackaged, sold, redistributed or otherwise used in a
|
|
13
|
-
* way not consistent with the End User License Agreement.
|
|
14
|
-
*/
|
|
15
|
-
|
|
16
|
-
'use strict';
|
|
17
|
-
|
|
18
|
-
const { EventEmitter } = require('events');
|
|
19
|
-
const onFinished = require('on-finished');
|
|
20
|
-
const { Event, primordials: { StringPrototypeToLowerCase } } = require('@contrast/common');
|
|
21
|
-
|
|
22
|
-
module.exports = function(core) {
|
|
23
|
-
const {
|
|
24
|
-
messages,
|
|
25
|
-
instrumentation: { instrument },
|
|
26
|
-
scopes: { sources: sourcesStorage }
|
|
27
|
-
} = core;
|
|
28
|
-
|
|
29
|
-
const _hooks = new EventEmitter();
|
|
30
|
-
|
|
31
|
-
function aroundHook(serverType) {
|
|
32
|
-
return function around(next, data) {
|
|
33
|
-
const { args: [event, req, res] } = data;
|
|
34
|
-
|
|
35
|
-
if (event !== 'request') {
|
|
36
|
-
if (event === 'listening') {
|
|
37
|
-
// take a snapshot of Perf.all at this point. this will get logged
|
|
38
|
-
// at some point on the perf interval timer.
|
|
39
|
-
core.Perf.mark('listening');
|
|
40
|
-
}
|
|
41
|
-
return next();
|
|
42
|
-
}
|
|
43
|
-
// let's count requests.
|
|
44
|
-
core.Perf.requestCount += 1;
|
|
45
|
-
|
|
46
|
-
const store = {
|
|
47
|
-
sourceInfo: {
|
|
48
|
-
port: req.socket.address?.()?.port || 0,
|
|
49
|
-
protocol: serverType === 'http' ? 'http' : 'https',
|
|
50
|
-
serverType,
|
|
51
|
-
time: Date.now(),
|
|
52
|
-
method: StringPrototypeToLowerCase.call(req.method),
|
|
53
|
-
}
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
if (_hooks._events.onSource) {
|
|
57
|
-
_hooks.emit('onSource', {
|
|
58
|
-
// future: non-http sources will have their own type
|
|
59
|
-
sourceType: 'HTTP',
|
|
60
|
-
store,
|
|
61
|
-
incomingMessage: req,
|
|
62
|
-
serverResponse: res,
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
onFinished(res, (/* err, req */) => {
|
|
67
|
-
messages.emit(Event.RESPONSE_FINISH, store);
|
|
68
|
-
});
|
|
69
|
-
|
|
70
|
-
return sourcesStorage.run(store, next);
|
|
71
|
-
};
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
function install() {
|
|
75
|
-
['http', 'https', 'spdy', 'http2'].forEach((moduleName) => {
|
|
76
|
-
instrument({
|
|
77
|
-
moduleName,
|
|
78
|
-
patchObjects: [{
|
|
79
|
-
name: 'Server.prototype',
|
|
80
|
-
methods: ['emit'],
|
|
81
|
-
patchType: 'sources',
|
|
82
|
-
around: aroundHook(moduleName)
|
|
83
|
-
}]
|
|
84
|
-
});
|
|
85
|
-
});
|
|
86
|
-
}
|
|
87
|
-
return core.sources = {
|
|
88
|
-
install,
|
|
89
|
-
addHook(name, handler) {
|
|
90
|
-
if (name === 'onSource') _hooks.on(name, handler);
|
|
91
|
-
},
|
|
92
|
-
aroundHook
|
|
93
|
-
};
|
|
94
|
-
};
|