@contrast/agentify 1.22.2 → 1.22.3
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/rewrite-hooks.js +8 -1
- package/lib/rewrite-is-deadzoned.js +35 -0
- package/package.json +2 -2
package/lib/rewrite-hooks.js
CHANGED
|
@@ -18,6 +18,8 @@
|
|
|
18
18
|
|
|
19
19
|
const Module = require('node:module');
|
|
20
20
|
|
|
21
|
+
const rewriteIsDeadzoned = require('./rewrite-is-deadzoned');
|
|
22
|
+
|
|
21
23
|
/**
|
|
22
24
|
* @param {import('.').Core & {
|
|
23
25
|
* rewriteHooks?: import('@contrast/common').Installable;
|
|
@@ -47,6 +49,11 @@ module.exports = function init(core) {
|
|
|
47
49
|
trim: false,
|
|
48
50
|
};
|
|
49
51
|
|
|
52
|
+
if (rewriteIsDeadzoned(filename)) {
|
|
53
|
+
core.logger.debug('Skipping rewrite-deadzoned file %s', filename);
|
|
54
|
+
return Reflect.apply(_compile, this, [content, filename]);
|
|
55
|
+
}
|
|
56
|
+
|
|
50
57
|
const result = core.rewriter.rewriteSync(content, options);
|
|
51
58
|
|
|
52
59
|
try {
|
|
@@ -74,7 +81,7 @@ module.exports = function init(core) {
|
|
|
74
81
|
* @param {string} filename The file path of the module
|
|
75
82
|
*/
|
|
76
83
|
Module._extensions['.js'] = function (module, filename) {
|
|
77
|
-
if (!core.config.agent.node.rewrite.cache.enable) {
|
|
84
|
+
if (!core.config.agent.node.rewrite.cache.enable || rewriteIsDeadzoned(filename)) {
|
|
78
85
|
return Reflect.apply(js, this, [module, filename]);
|
|
79
86
|
}
|
|
80
87
|
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright: 2024 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
|
+
'use strict';
|
|
16
|
+
|
|
17
|
+
// i'm leaving out index.js now because it doesn't really matter and i want
|
|
18
|
+
// to keep this list short. maybe a little bit of experimentation to figure
|
|
19
|
+
// out optimal way to do this lookup.
|
|
20
|
+
const doNotRewriteEndingPaths = [
|
|
21
|
+
//'node_modules/bcryptjs/index.js',
|
|
22
|
+
'node_modules/bcryptjs/dist/bcrypt.js',
|
|
23
|
+
];
|
|
24
|
+
|
|
25
|
+
module.exports = function rewriteIsDeadzoned(filename) {
|
|
26
|
+
// make all windows separators into unix separators
|
|
27
|
+
filename = filename.replace(/\\/g, '/');
|
|
28
|
+
for (const endingPath of doNotRewriteEndingPaths) {
|
|
29
|
+
if (filename.endsWith(endingPath)) {
|
|
30
|
+
return true;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
return false;
|
|
34
|
+
}
|
|
35
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contrast/agentify",
|
|
3
|
-
"version": "1.22.
|
|
3
|
+
"version": "1.22.3",
|
|
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)",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"@contrast/core": "1.30.0",
|
|
23
23
|
"@contrast/deadzones": "1.1.2",
|
|
24
24
|
"@contrast/dep-hooks": "1.3.1",
|
|
25
|
-
"@contrast/esm-hooks": "2.4.
|
|
25
|
+
"@contrast/esm-hooks": "2.4.1",
|
|
26
26
|
"@contrast/instrumentation": "1.6.0",
|
|
27
27
|
"@contrast/logger": "1.8.0",
|
|
28
28
|
"@contrast/metrics": "1.6.0",
|