@contrast/agentify 1.29.1 → 1.30.1
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 -0
- package/lib/sources.js +17 -2
- package/package.json +14 -14
package/lib/index.js
CHANGED
|
@@ -33,6 +33,7 @@ const ERROR_MESSAGE = 'An error prevented the Contrast agent from installing. Th
|
|
|
33
33
|
*/
|
|
34
34
|
const DEFAULT_INSTALL_ORDER = [
|
|
35
35
|
'reporter',
|
|
36
|
+
'telemetry',
|
|
36
37
|
'contrastMethods',
|
|
37
38
|
'deadzones',
|
|
38
39
|
'scopes',
|
|
@@ -143,6 +144,7 @@ module.exports = function init(core = {}) {
|
|
|
143
144
|
{ name: 'app-info', spec: '@contrast/core/lib/app-info' },
|
|
144
145
|
{ name: 'system-info', spec: '@contrast/core/lib/system-info' },
|
|
145
146
|
// was check for appInfo errors length and throw if found
|
|
147
|
+
{ name: 'telemetry', spec: '@contrast/telemetry' },
|
|
146
148
|
{ name: 'sensitive-data-masking', spec: '@contrast/core/lib/sensitive-data-masking' },
|
|
147
149
|
{ name: 'is-agent-path', spec: '@contrast/core/lib/is-agent-path' },
|
|
148
150
|
{ name: 'dep-hooks', spec: '@contrast/dep-hooks' },
|
package/lib/sources.js
CHANGED
|
@@ -15,8 +15,8 @@
|
|
|
15
15
|
|
|
16
16
|
'use strict';
|
|
17
17
|
|
|
18
|
+
const { EventEmitter } = require('events');
|
|
18
19
|
const { Event } = require('@contrast/common');
|
|
19
|
-
const patchType = 'sources';
|
|
20
20
|
|
|
21
21
|
module.exports = function(core) {
|
|
22
22
|
const {
|
|
@@ -25,6 +25,8 @@ module.exports = function(core) {
|
|
|
25
25
|
scopes: { sources: sourcesStorage }
|
|
26
26
|
} = core;
|
|
27
27
|
|
|
28
|
+
const _hooks = new EventEmitter();
|
|
29
|
+
|
|
28
30
|
function aroundHook(serverType) {
|
|
29
31
|
return function around(next, data) {
|
|
30
32
|
const { args: [event, req, res] } = data;
|
|
@@ -40,6 +42,16 @@ module.exports = function(core) {
|
|
|
40
42
|
}
|
|
41
43
|
};
|
|
42
44
|
|
|
45
|
+
if (_hooks._events.onSource) {
|
|
46
|
+
_hooks.emit('onSource', {
|
|
47
|
+
// future: non-http sources will have their own type
|
|
48
|
+
sourceType: 'HTTP',
|
|
49
|
+
store,
|
|
50
|
+
incomingMessage: req,
|
|
51
|
+
serverResponse: res,
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
|
|
43
55
|
res.on('finish', () => {
|
|
44
56
|
messages.emit(Event.RESPONSE_FINISH, store);
|
|
45
57
|
});
|
|
@@ -55,7 +67,7 @@ module.exports = function(core) {
|
|
|
55
67
|
patchObjects: [{
|
|
56
68
|
name: 'Server.prototype',
|
|
57
69
|
methods: ['emit'],
|
|
58
|
-
patchType,
|
|
70
|
+
patchType: 'sources',
|
|
59
71
|
around: aroundHook(moduleName)
|
|
60
72
|
}]
|
|
61
73
|
});
|
|
@@ -63,6 +75,9 @@ module.exports = function(core) {
|
|
|
63
75
|
}
|
|
64
76
|
return core.sources = {
|
|
65
77
|
install,
|
|
78
|
+
addHook(name, handler) {
|
|
79
|
+
if (name === 'onSource') _hooks.on(name, handler);
|
|
80
|
+
},
|
|
66
81
|
aroundHook
|
|
67
82
|
};
|
|
68
83
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contrast/agentify",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.30.1",
|
|
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)",
|
|
@@ -17,20 +17,20 @@
|
|
|
17
17
|
"test": "../scripts/test.sh"
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@contrast/common": "1.
|
|
21
|
-
"@contrast/config": "1.
|
|
22
|
-
"@contrast/core": "1.
|
|
23
|
-
"@contrast/deadzones": "1.
|
|
24
|
-
"@contrast/dep-hooks": "1.3.
|
|
25
|
-
"@contrast/esm-hooks": "2.
|
|
20
|
+
"@contrast/common": "1.24.0",
|
|
21
|
+
"@contrast/config": "1.31.0",
|
|
22
|
+
"@contrast/core": "1.35.1",
|
|
23
|
+
"@contrast/deadzones": "1.5.1",
|
|
24
|
+
"@contrast/dep-hooks": "1.3.4",
|
|
25
|
+
"@contrast/esm-hooks": "2.9.1",
|
|
26
26
|
"@contrast/find-package-json": "^1.1.0",
|
|
27
|
-
"@contrast/instrumentation": "1.
|
|
28
|
-
"@contrast/logger": "1.8.
|
|
29
|
-
"@contrast/metrics": "1.
|
|
30
|
-
"@contrast/patcher": "1.7.
|
|
31
|
-
"@contrast/reporter": "1.
|
|
32
|
-
"@contrast/rewriter": "1.
|
|
33
|
-
"@contrast/scopes": "1.4.
|
|
27
|
+
"@contrast/instrumentation": "1.13.1",
|
|
28
|
+
"@contrast/logger": "1.8.5",
|
|
29
|
+
"@contrast/metrics": "1.11.1",
|
|
30
|
+
"@contrast/patcher": "1.7.5",
|
|
31
|
+
"@contrast/reporter": "1.30.1",
|
|
32
|
+
"@contrast/rewriter": "1.11.1",
|
|
33
|
+
"@contrast/scopes": "1.4.2",
|
|
34
34
|
"semver": "^7.6.0"
|
|
35
35
|
}
|
|
36
36
|
}
|