@contrast/assess 1.57.0 → 1.58.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.
|
@@ -29,6 +29,27 @@ module.exports = function(core) {
|
|
|
29
29
|
}
|
|
30
30
|
} = core;
|
|
31
31
|
|
|
32
|
+
function iterateOverArgs(args, tags, history, globalOffset, isIteratingArray = false) {
|
|
33
|
+
const metadata = [];
|
|
34
|
+
|
|
35
|
+
for (let i = 0; i < args.length; i++) {
|
|
36
|
+
const arg = args[i];
|
|
37
|
+
const isArray = Array.isArray(arg);
|
|
38
|
+
if (isArray) return iterateOverArgs(arg, tags, history, globalOffset, true);
|
|
39
|
+
|
|
40
|
+
const strInfo = tracker.getData(arg);
|
|
41
|
+
if (strInfo) {
|
|
42
|
+
metadata.push({ tracked: true, value: arg });
|
|
43
|
+
history.add(strInfo);
|
|
44
|
+
tags = createAppendTags(tags, strInfo.tags, globalOffset);
|
|
45
|
+
} else {
|
|
46
|
+
metadata.push({ tracked: false, value: getAdjustedUntrackedValue(arg) });
|
|
47
|
+
}
|
|
48
|
+
globalOffset += `${arg}`.length + (isIteratingArray ? 1 : 0);
|
|
49
|
+
}
|
|
50
|
+
return [metadata, tags];
|
|
51
|
+
}
|
|
52
|
+
|
|
32
53
|
return core.assess.dataflow.propagation.stringInstrumentation.concat = {
|
|
33
54
|
install() {
|
|
34
55
|
const name = 'String.prototype.concat';
|
|
@@ -66,25 +87,9 @@ module.exports = function(core) {
|
|
|
66
87
|
const objInfo = tracker.getData(data.obj);
|
|
67
88
|
const history = objInfo ? new Set([objInfo]) : new Set();
|
|
68
89
|
|
|
69
|
-
|
|
70
|
-
const args = [];
|
|
71
|
-
let tags = objInfo?.tags;
|
|
72
|
-
|
|
73
|
-
for (const arg of data.args) {
|
|
74
|
-
const isArray = Array.isArray(arg);
|
|
75
|
-
// TODO NODE-3748: handle tag ranges when arg is an Array
|
|
76
|
-
const strInfo = tracker.getData(arg);
|
|
77
|
-
if (strInfo) {
|
|
78
|
-
args.push({ tracked: true, value: arg });
|
|
79
|
-
history.add(strInfo);
|
|
80
|
-
tags = createAppendTags(tags, strInfo.tags, globalOffset);
|
|
81
|
-
} else {
|
|
82
|
-
args.push({ tracked: false, value: getAdjustedUntrackedValue(arg) });
|
|
83
|
-
}
|
|
90
|
+
const globalOffset = typeof data.obj !== 'function' ? data.obj.length : 0;
|
|
84
91
|
|
|
85
|
-
|
|
86
|
-
globalOffset += isArray ? ArrayPrototypeJoin.call(arg).length : `${arg}`.length;
|
|
87
|
-
}
|
|
92
|
+
const [args, tags] = iterateOverArgs(data.args, objInfo?.tags, history, globalOffset);
|
|
88
93
|
|
|
89
94
|
if (history.size) {
|
|
90
95
|
const event = createPropagationEvent({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contrast/assess",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.58.1",
|
|
4
4
|
"description": "Contrast service providing framework-agnostic Assess support",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE",
|
|
6
6
|
"author": "Contrast Security <nodejs@contrastsecurity.com> (https://www.contrastsecurity.com)",
|
|
@@ -20,17 +20,17 @@
|
|
|
20
20
|
"test": "bash ../scripts/test.sh"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@contrast/common": "1.34.
|
|
24
|
-
"@contrast/config": "1.49.
|
|
25
|
-
"@contrast/core": "1.54.
|
|
26
|
-
"@contrast/dep-hooks": "1.23.
|
|
23
|
+
"@contrast/common": "1.34.1",
|
|
24
|
+
"@contrast/config": "1.49.1",
|
|
25
|
+
"@contrast/core": "1.54.1",
|
|
26
|
+
"@contrast/dep-hooks": "1.23.1",
|
|
27
27
|
"@contrast/distringuish": "^5.1.0",
|
|
28
|
-
"@contrast/instrumentation": "1.33.
|
|
29
|
-
"@contrast/logger": "1.27.
|
|
30
|
-
"@contrast/patcher": "1.26.
|
|
31
|
-
"@contrast/rewriter": "1.30.
|
|
32
|
-
"@contrast/route-coverage": "1.45.
|
|
33
|
-
"@contrast/scopes": "1.24.
|
|
28
|
+
"@contrast/instrumentation": "1.33.1",
|
|
29
|
+
"@contrast/logger": "1.27.1",
|
|
30
|
+
"@contrast/patcher": "1.26.1",
|
|
31
|
+
"@contrast/rewriter": "1.30.1",
|
|
32
|
+
"@contrast/route-coverage": "1.45.1",
|
|
33
|
+
"@contrast/scopes": "1.24.1",
|
|
34
34
|
"semver": "^7.6.0"
|
|
35
35
|
}
|
|
36
36
|
}
|