@contrast/protect 1.28.0 → 1.28.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/esm-loader.mjs +54 -1
- package/lib/index.d.ts +3 -1
- package/lib/input-analysis/handlers.js +2 -1
- package/package.json +3 -3
package/lib/esm-loader.mjs
CHANGED
|
@@ -14,4 +14,57 @@
|
|
|
14
14
|
*/
|
|
15
15
|
|
|
16
16
|
import esmHooks from '@contrast/esm-hooks';
|
|
17
|
-
|
|
17
|
+
import { createRequire } from 'node:module';
|
|
18
|
+
|
|
19
|
+
const ERROR_MESSAGE = 'A fatal agent installation error has occurred. The application will be run without instrumentation.';
|
|
20
|
+
|
|
21
|
+
let getSource = async function getSource(url, context, defaultGetSource) {
|
|
22
|
+
return defaultGetSource(url, context, defaultGetSource);
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
let transformSource = async function transformSource(url, context, defaultTransformSource) {
|
|
26
|
+
return defaultTransformSource(url, context, defaultTransformSource);
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
let load = async function load(url, context, defaultLoad) {
|
|
30
|
+
return defaultLoad(url, context, defaultLoad);
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
const require = createRequire(import.meta.url);
|
|
34
|
+
const { name: agentName, version: agentVersion } = require('../package.json');
|
|
35
|
+
const core = { agentName, agentVersion };
|
|
36
|
+
try {
|
|
37
|
+
require('@contrast/core/lib/events')(core);
|
|
38
|
+
require('@contrast/config')(core);
|
|
39
|
+
require('@contrast/logger').default(core);
|
|
40
|
+
|
|
41
|
+
// @contrast/info ?
|
|
42
|
+
require('@contrast/core/lib/agent-info')(core);
|
|
43
|
+
require('@contrast/core/lib/system-info')(core);
|
|
44
|
+
require('@contrast/core/lib/app-info')(core);
|
|
45
|
+
require('@contrast/core/lib/sensitive-data-masking')(core);
|
|
46
|
+
require('@contrast/core/lib/is-agent-path')(core);
|
|
47
|
+
require('@contrast/core/lib/capture-stacktrace')(core);
|
|
48
|
+
|
|
49
|
+
require('@contrast/patcher')(core);
|
|
50
|
+
require('@contrast/rewriter')(core); // merge contrast-methods?
|
|
51
|
+
require('@contrast/core/lib/contrast-methods')(core); // can we remove dependency on patcher?
|
|
52
|
+
|
|
53
|
+
require('@contrast/dep-hooks')(core);
|
|
54
|
+
require('@contrast/scopes')(core);
|
|
55
|
+
require('@contrast/deadzones')(core);
|
|
56
|
+
require('@contrast/reporter').default(core);
|
|
57
|
+
require('@contrast/instrumentation')(core);
|
|
58
|
+
|
|
59
|
+
// TODO: i think we still need to INSTALL components.
|
|
60
|
+
({ getSource, transformSource, load } = esmHooks(core));
|
|
61
|
+
} catch (err) {
|
|
62
|
+
// TODO: Consider proper UNINSTALLATION and normal startup w/o agent
|
|
63
|
+
if (core.logger) {
|
|
64
|
+
core.logger.error({ err }, ERROR_MESSAGE);
|
|
65
|
+
} else {
|
|
66
|
+
console.error(new Error(ERROR_MESSAGE, { cause: err }));
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export { getSource, transformSource, load };
|
package/lib/index.d.ts
CHANGED
|
@@ -301,7 +301,8 @@ module.exports = function(core) {
|
|
|
301
301
|
const { policy: { rulesMask } } = sourceContext;
|
|
302
302
|
|
|
303
303
|
const cookiesArr = Object.entries(cookies).reduce((acc, [key, value]) => {
|
|
304
|
-
|
|
304
|
+
// things like booleans will cause agent-lib to throw
|
|
305
|
+
if (isString(value)) acc.push(key, value);
|
|
305
306
|
return acc;
|
|
306
307
|
}, []);
|
|
307
308
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contrast/protect",
|
|
3
|
-
"version": "1.28.
|
|
3
|
+
"version": "1.28.1",
|
|
4
4
|
"description": "Contrast service providing framework-agnostic Protect support",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE",
|
|
6
6
|
"author": "Contrast Security <nodejs@contrastsecurity.com> (https://www.contrastsecurity.com)",
|
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
"dependencies": {
|
|
20
20
|
"@contrast/agent-lib": "^7.0.1",
|
|
21
21
|
"@contrast/common": "1.15.1",
|
|
22
|
-
"@contrast/core": "1.26.
|
|
23
|
-
"@contrast/esm-hooks": "1.22.
|
|
22
|
+
"@contrast/core": "1.26.1",
|
|
23
|
+
"@contrast/esm-hooks": "1.22.1",
|
|
24
24
|
"@contrast/scopes": "1.4.0",
|
|
25
25
|
"ipaddr.js": "^2.0.1",
|
|
26
26
|
"semver": "^7.3.7"
|