@contrast/core 1.54.2 → 1.55.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.
|
@@ -27,8 +27,8 @@ module.exports = function (core) {
|
|
|
27
27
|
sensitiveDataMasking: { policy, getRedactedText, traverseAndMask },
|
|
28
28
|
} = core;
|
|
29
29
|
|
|
30
|
-
messages.on(Event.PROTECT, (
|
|
31
|
-
if (!
|
|
30
|
+
messages.on(Event.PROTECT, (store) => {
|
|
31
|
+
if (!store.protect || !policy.keywordSets.length || !store.sourceInfo) {
|
|
32
32
|
return;
|
|
33
33
|
}
|
|
34
34
|
|
|
@@ -36,33 +36,33 @@ module.exports = function (core) {
|
|
|
36
36
|
|
|
37
37
|
const unmasked = policy.maskAttackVector ? new Set() : undefined;
|
|
38
38
|
if (policy.maskHttpBody) {
|
|
39
|
-
|
|
39
|
+
store.protect.parsedBody = `${CONTRAST_REDACTED}-body`;
|
|
40
40
|
} else {
|
|
41
|
-
traverseAndMask(
|
|
41
|
+
traverseAndMask(store.protect?.parsedBody, unmasked);
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
traverseAndMask(
|
|
45
|
-
traverseAndMask(
|
|
44
|
+
traverseAndMask(store.protect?.parsedCookies, unmasked);
|
|
45
|
+
traverseAndMask(store.protect?.parsedQuery, unmasked);
|
|
46
46
|
|
|
47
47
|
// Do parsed URL path params and urlPath together
|
|
48
|
-
const params =
|
|
48
|
+
const params = store.protect?.parsedParams;
|
|
49
49
|
if (params) {
|
|
50
50
|
for (const [key, value] of Object.entries(params)) {
|
|
51
51
|
const redactedText = getRedactedText(key);
|
|
52
52
|
if (redactedText) {
|
|
53
53
|
const encoded = encodeURIComponent(value);
|
|
54
|
-
|
|
55
|
-
|
|
54
|
+
store.sourceInfo.uriPath = StringPrototypeReplace.call(
|
|
55
|
+
store.sourceInfo.uriPath,
|
|
56
56
|
encoded,
|
|
57
57
|
redactedText
|
|
58
58
|
);
|
|
59
|
-
|
|
59
|
+
store.protect.parsedParams[key] = redactedText;
|
|
60
60
|
}
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
63
|
|
|
64
64
|
// raw headers
|
|
65
|
-
const headers =
|
|
65
|
+
const headers = store.sourceInfo.rawHeaders;
|
|
66
66
|
for (let i = 0; i <= headers.length - 2; i += 2) {
|
|
67
67
|
const key = headers[i];
|
|
68
68
|
|
|
@@ -73,20 +73,20 @@ module.exports = function (core) {
|
|
|
73
73
|
}
|
|
74
74
|
|
|
75
75
|
// raw queries
|
|
76
|
-
if (
|
|
77
|
-
const searchParams = new URLSearchParams(
|
|
76
|
+
if (store.sourceInfo?.queries) {
|
|
77
|
+
const searchParams = new URLSearchParams(store.sourceInfo.queries);
|
|
78
78
|
for (const [key] of searchParams) {
|
|
79
79
|
const redactedText = getRedactedText(key);
|
|
80
80
|
if (redactedText) {
|
|
81
81
|
searchParams.set(key, redactedText);
|
|
82
82
|
}
|
|
83
83
|
}
|
|
84
|
-
|
|
84
|
+
store.sourceInfo.queries = searchParams.toString();
|
|
85
85
|
}
|
|
86
86
|
|
|
87
87
|
if (policy.maskAttackVector) {
|
|
88
88
|
// attack values
|
|
89
|
-
const inputAnalysis = Object.entries(
|
|
89
|
+
const inputAnalysis = Object.entries(store.protect?.resultsMap);
|
|
90
90
|
for (const [, results] of inputAnalysis) {
|
|
91
91
|
for (const result of results) {
|
|
92
92
|
const redactedText = getRedactedText(result.key);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contrast/core",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.55.0",
|
|
4
4
|
"description": "Preconfigured Contrast agent core services and models",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE",
|
|
6
6
|
"author": "Contrast Security <nodejs@contrastsecurity.com> (https://www.contrastsecurity.com)",
|
|
@@ -19,15 +19,15 @@
|
|
|
19
19
|
"test": "bash ../scripts/test.sh"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@contrast/common": "1.
|
|
23
|
-
"@contrast/config": "1.
|
|
22
|
+
"@contrast/common": "1.35.0",
|
|
23
|
+
"@contrast/config": "1.50.0",
|
|
24
24
|
"@contrast/find-package-json": "^1.1.0",
|
|
25
25
|
"@contrast/fn-inspect": "^4.3.0",
|
|
26
|
-
"@contrast/logger": "1.
|
|
27
|
-
"@contrast/patcher": "1.
|
|
26
|
+
"@contrast/logger": "1.28.0",
|
|
27
|
+
"@contrast/patcher": "1.27.0",
|
|
28
28
|
"@contrast/perf": "1.3.1",
|
|
29
29
|
"@tsxper/crc32": "^2.1.3",
|
|
30
|
-
"axios": "^1.
|
|
30
|
+
"axios": "^1.11.0",
|
|
31
31
|
"semver": "^7.6.0"
|
|
32
32
|
}
|
|
33
33
|
}
|