@contrast/assess 1.27.2 → 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/constants.js +3 -3
- package/lib/crypto-analysis/install/crypto.js +1 -1
- package/lib/dataflow/propagation/install/JSON/parse.js +2 -2
- package/lib/dataflow/propagation/install/JSON/stringify.js +10 -11
- package/lib/dataflow/propagation/install/array-prototype-join.js +10 -12
- package/lib/dataflow/propagation/install/buffer.js +3 -1
- package/lib/dataflow/propagation/install/contrast-methods/add.js +73 -72
- package/lib/dataflow/propagation/install/contrast-methods/number.js +4 -5
- package/lib/dataflow/propagation/install/contrast-methods/string.js +3 -2
- package/lib/dataflow/propagation/install/contrast-methods/tag.js +3 -6
- package/lib/dataflow/propagation/install/joi/boolean.js +2 -4
- package/lib/dataflow/propagation/install/joi/expression.js +2 -4
- package/lib/dataflow/propagation/install/joi/index.js +1 -1
- package/lib/dataflow/propagation/install/joi/number.js +2 -4
- package/lib/dataflow/propagation/install/joi/string-schema.js +8 -3
- package/lib/dataflow/propagation/install/joi/values.js +5 -1
- package/lib/dataflow/propagation/install/path/format.js +7 -4
- package/lib/dataflow/propagation/install/path/parse.js +4 -5
- package/lib/dataflow/propagation/install/querystring/escape.js +1 -1
- package/lib/dataflow/propagation/install/querystring/parse.js +6 -7
- package/lib/dataflow/propagation/install/querystring/stringify.js +1 -1
- package/lib/dataflow/propagation/install/reg-exp-prototype-exec.js +2 -3
- package/lib/dataflow/propagation/install/string/concat.js +22 -23
- package/lib/dataflow/propagation/install/string/html-methods.js +6 -7
- package/lib/dataflow/propagation/install/string/index.js +3 -3
- package/lib/dataflow/propagation/install/string/match-all.js +10 -15
- package/lib/dataflow/propagation/install/string/match.js +5 -4
- package/lib/dataflow/propagation/install/string/replace.js +22 -16
- package/lib/dataflow/propagation/install/string/slice.js +7 -6
- package/lib/dataflow/propagation/install/string/split.js +17 -16
- package/lib/dataflow/propagation/install/string/substring.js +9 -8
- package/lib/dataflow/propagation/install/string/trim.js +4 -5
- package/lib/dataflow/propagation/install/url/parse.js +1 -1
- package/lib/dataflow/propagation/install/url/searchParams.js +2 -1
- package/lib/dataflow/propagation/install/url/url.js +1 -1
- package/lib/dataflow/sinks/install/child-process.js +1 -1
- package/lib/dataflow/sinks/install/express/reflected-xss.js +7 -5
- package/lib/dataflow/sinks/install/express/unvalidated-redirect.js +1 -2
- package/lib/dataflow/sinks/install/fastify/unvalidated-redirect.js +1 -3
- package/lib/dataflow/sinks/install/fs.js +1 -1
- package/lib/dataflow/sinks/install/function.js +1 -1
- package/lib/dataflow/sinks/install/hapi/unvalidated-redirect.js +1 -2
- package/lib/dataflow/sinks/install/http/request.js +6 -5
- package/lib/dataflow/sinks/install/koa/unvalidated-redirect.js +2 -2
- package/lib/dataflow/sinks/install/libxmljs.js +1 -1
- package/lib/dataflow/sinks/install/marsdb.js +1 -2
- package/lib/dataflow/sinks/install/mongodb.js +46 -9
- package/lib/dataflow/sinks/install/mysql.js +1 -1
- package/lib/dataflow/sinks/install/postgres.js +1 -3
- package/lib/dataflow/sinks/install/sequelize.js +1 -2
- package/lib/dataflow/sinks/install/vm.js +1 -1
- package/lib/dataflow/sources/install/body-parser1.js +12 -5
- package/lib/dataflow/sources/install/cookie-parser1.js +4 -3
- package/lib/dataflow/sources/install/qs6.js +7 -5
- package/lib/dataflow/sources/install/querystring.js +8 -2
- package/lib/dataflow/tag-utils.js +22 -5
- package/lib/get-source-context.js +2 -1
- package/lib/index.js +13 -0
- package/lib/session-configuration/install/express-session.js +1 -3
- package/lib/session-configuration/install/fastify-cookie.js +1 -1
- package/lib/session-configuration/install/hapi.js +1 -3
- package/lib/session-configuration/install/koa.js +1 -1
- package/package.json +2 -2
package/lib/constants.js
CHANGED
|
@@ -15,7 +15,6 @@
|
|
|
15
15
|
|
|
16
16
|
'use strict';
|
|
17
17
|
|
|
18
|
-
const { inspect } = require('util');
|
|
19
18
|
const {
|
|
20
19
|
Rule,
|
|
21
20
|
isString,
|
|
@@ -54,6 +53,7 @@ module.exports = function (core) {
|
|
|
54
53
|
logger,
|
|
55
54
|
patcher,
|
|
56
55
|
assess: {
|
|
56
|
+
inspect, // todo: remove
|
|
57
57
|
eventFactory,
|
|
58
58
|
cryptoAnalysis,
|
|
59
59
|
getSourceContext,
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
|
|
16
16
|
'use strict';
|
|
17
17
|
|
|
18
|
-
const { isString
|
|
18
|
+
const { isString } = require('@contrast/common');
|
|
19
19
|
const { createSubsetTags } = require('../../../tag-utils');
|
|
20
20
|
const { patchType } = require('../../common');
|
|
21
21
|
const { getKeyValueIndices } = require('./parse-fn');
|
|
@@ -75,7 +75,7 @@ module.exports = function (core) {
|
|
|
75
75
|
moduleName: 'JSON',
|
|
76
76
|
methodName: 'parse',
|
|
77
77
|
object: {
|
|
78
|
-
value:
|
|
78
|
+
value: 'JSON',
|
|
79
79
|
tracked: false,
|
|
80
80
|
},
|
|
81
81
|
args: eventArgs,
|
|
@@ -15,12 +15,10 @@
|
|
|
15
15
|
|
|
16
16
|
'use strict';
|
|
17
17
|
|
|
18
|
-
const {
|
|
19
|
-
createMergedTags
|
|
20
|
-
} = require('../../../tag-utils');
|
|
21
|
-
const { isString, inspect, replace, match, matchAll, slice } = require('@contrast/common');
|
|
22
|
-
const { patchType } = require('../../common');
|
|
23
18
|
const crypto = require('crypto');
|
|
19
|
+
const { isString, replace, match, matchAll, slice } = require('@contrast/common');
|
|
20
|
+
const { createMergedTags, getAdjustedUntrackedValue } = require('../../../tag-utils');
|
|
21
|
+
const { patchType } = require('../../common');
|
|
24
22
|
|
|
25
23
|
function makeCanary() {
|
|
26
24
|
return replace(
|
|
@@ -88,7 +86,6 @@ module.exports = function(core) {
|
|
|
88
86
|
return null;
|
|
89
87
|
}
|
|
90
88
|
|
|
91
|
-
|
|
92
89
|
const props = tracker.getData(slice(space, 0, 10));
|
|
93
90
|
if (!props || !Object.keys(props.tags).length) {
|
|
94
91
|
return null;
|
|
@@ -246,21 +243,23 @@ module.exports = function(core) {
|
|
|
246
243
|
methodName: 'stringify',
|
|
247
244
|
history: Array.from(metadata.history),
|
|
248
245
|
object: {
|
|
249
|
-
value:
|
|
246
|
+
value: 'JSON',
|
|
250
247
|
tracked: false
|
|
251
248
|
},
|
|
252
249
|
args: [
|
|
253
250
|
{
|
|
254
|
-
value:
|
|
251
|
+
value: getAdjustedUntrackedValue(metadata.origArgs[0]),
|
|
255
252
|
tracked: false
|
|
256
253
|
},
|
|
257
254
|
(metadata.origArgs[1] && {
|
|
258
|
-
value:
|
|
255
|
+
value: getAdjustedUntrackedValue(metadata.origArgs[1]),
|
|
259
256
|
tracked: false
|
|
260
257
|
}),
|
|
261
258
|
(metadata.origArgs[2] && {
|
|
262
|
-
|
|
263
|
-
|
|
259
|
+
tracked: !!metadata.spaceProps,
|
|
260
|
+
value: metadata.spaceProps ?
|
|
261
|
+
`'${metadata.origArgs[2]}'` :
|
|
262
|
+
getAdjustedUntrackedValue(metadata.origArgs[2]),
|
|
264
263
|
})
|
|
265
264
|
].filter(Boolean),
|
|
266
265
|
result: {
|
|
@@ -15,17 +15,16 @@
|
|
|
15
15
|
|
|
16
16
|
'use strict';
|
|
17
17
|
|
|
18
|
-
const {
|
|
19
|
-
|
|
20
|
-
} = require('../../tag-utils');
|
|
18
|
+
const { isString } = require('@contrast/common');
|
|
19
|
+
const { InstrumentationType: { PROPAGATOR } } = require('../../../constants');
|
|
20
|
+
const { createAppendTags } = require('../../tag-utils');
|
|
21
21
|
const { patchType } = require('../common');
|
|
22
|
-
const { isString, join, inspect } = require('@contrast/common');
|
|
23
22
|
|
|
24
23
|
module.exports = function(core) {
|
|
25
24
|
const {
|
|
26
|
-
scopes: { sources, instrumentation },
|
|
27
25
|
patcher,
|
|
28
26
|
assess: {
|
|
27
|
+
getSourceContext,
|
|
29
28
|
eventFactory: { createPropagationEvent },
|
|
30
29
|
dataflow: { tracker }
|
|
31
30
|
}
|
|
@@ -71,7 +70,7 @@ module.exports = function(core) {
|
|
|
71
70
|
patchType,
|
|
72
71
|
post(data) {
|
|
73
72
|
const { args: origArgs, obj, result, hooked, orig } = data;
|
|
74
|
-
if (!result || !
|
|
73
|
+
if (!result || !(getSourceContext(PROPAGATOR))) return;
|
|
75
74
|
|
|
76
75
|
const resultInfo = tracker.getData(result);
|
|
77
76
|
const delimiter = origArgs[0] === undefined ? ',' : origArgs[0];
|
|
@@ -79,10 +78,6 @@ module.exports = function(core) {
|
|
|
79
78
|
const delimiterInfo = tracker.getData(delimiter);
|
|
80
79
|
const initHistory = delimiterInfo ? new Set([delimiterInfo]) : new Set();
|
|
81
80
|
const { newTags, newHistory: history } = accumulateTags(obj, {}, 0, initHistory, delimiterLength, delimiterInfo?.tags);
|
|
82
|
-
const object = {
|
|
83
|
-
value: obj && join(obj),
|
|
84
|
-
tracked: false
|
|
85
|
-
};
|
|
86
81
|
|
|
87
82
|
const args = [{
|
|
88
83
|
value: delimiterInfo ? delimiterInfo.value : delimiter,
|
|
@@ -94,8 +89,11 @@ module.exports = function(core) {
|
|
|
94
89
|
name,
|
|
95
90
|
moduleName: 'Array',
|
|
96
91
|
methodName: 'prototype.join',
|
|
97
|
-
context:
|
|
98
|
-
object
|
|
92
|
+
context: `[...].join('${args[0].value || ''}')`,
|
|
93
|
+
object: {
|
|
94
|
+
value: 'Array',
|
|
95
|
+
tracked: false
|
|
96
|
+
},
|
|
99
97
|
result: {
|
|
100
98
|
value: resultInfo ? resultInfo.value : result,
|
|
101
99
|
tracked: true
|
|
@@ -14,11 +14,13 @@
|
|
|
14
14
|
*/
|
|
15
15
|
'use strict';
|
|
16
16
|
|
|
17
|
+
const { InstrumentationType: { PROPAGATOR } } = require('../../../constants');
|
|
17
18
|
const { patchType } = require('../common');
|
|
18
19
|
|
|
19
20
|
module.exports = function(core) {
|
|
20
21
|
const {
|
|
21
22
|
assess: {
|
|
23
|
+
getSourceContext,
|
|
22
24
|
eventFactory,
|
|
23
25
|
dataflow: { tracker }
|
|
24
26
|
},
|
|
@@ -35,7 +37,7 @@ module.exports = function(core) {
|
|
|
35
37
|
post(data) {
|
|
36
38
|
const { hooked, obj, orig, result } = data;
|
|
37
39
|
|
|
38
|
-
if (!result) return;
|
|
40
|
+
if (!result || !getSourceContext(PROPAGATOR)) return;
|
|
39
41
|
|
|
40
42
|
const bufferInfo = tracker.getData(obj);
|
|
41
43
|
if (!bufferInfo) {
|
|
@@ -15,103 +15,104 @@
|
|
|
15
15
|
|
|
16
16
|
'use strict';
|
|
17
17
|
|
|
18
|
-
const
|
|
19
|
-
const {
|
|
20
|
-
createAppendTags
|
|
21
|
-
} = require('../../../tag-utils');
|
|
22
|
-
const { patchType } = require('../../common');
|
|
18
|
+
const { InstrumentationType: { PROPAGATOR } } = require('../../../../constants');
|
|
19
|
+
const { createAppendTags } = require('../../../tag-utils');
|
|
23
20
|
|
|
24
21
|
module.exports = function(core) {
|
|
25
22
|
const {
|
|
26
|
-
scopes: { instrumentation, sources },
|
|
27
|
-
patcher,
|
|
28
23
|
assess: {
|
|
24
|
+
inspect,
|
|
25
|
+
getSourceContext,
|
|
29
26
|
eventFactory: { createPropagationEvent },
|
|
30
27
|
dataflow: { tracker }
|
|
31
28
|
}
|
|
32
29
|
} = core;
|
|
33
30
|
|
|
34
|
-
const
|
|
31
|
+
const origSym = Symbol('ContrastMethods.add.orig');
|
|
35
32
|
|
|
36
33
|
return core.assess.dataflow.propagation.contrastMethodsInstrumentation.add = {
|
|
37
34
|
install() {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
35
|
+
// + is fast and typically called often. therefore we patch ContrastMethods.add
|
|
36
|
+
// manually instead of using patcher. this propagator is the only
|
|
37
|
+
// patch for it, so we don't have to worry about managing patch execution order
|
|
38
|
+
// (which patcher would do).
|
|
39
|
+
const { add } = global.ContrastMethods;
|
|
40
|
+
global.ContrastMethods.add = function(...args) {
|
|
41
|
+
// first get result, then following logic acts as post-hook in patcher speak
|
|
42
|
+
const result = add(...args);
|
|
44
43
|
|
|
45
|
-
|
|
46
|
-
if (rInfo) {
|
|
47
|
-
// this may happen w/ '' + 'tracked' => 'tracked'
|
|
48
|
-
return;
|
|
49
|
-
}
|
|
44
|
+
if (!result || !getSourceContext(PROPAGATOR)) return result;
|
|
50
45
|
|
|
51
|
-
|
|
52
|
-
|
|
46
|
+
const rInfo = tracker.getData(result);
|
|
47
|
+
if (rInfo) {
|
|
48
|
+
// this may happen w/ '' + 'tracked' => 'tracked'
|
|
49
|
+
return result;
|
|
50
|
+
}
|
|
53
51
|
|
|
54
|
-
|
|
55
|
-
|
|
52
|
+
const leftStringInfo = tracker.getData(args[0]);
|
|
53
|
+
const rightStringInfo = tracker.getData(args[1]);
|
|
56
54
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
newTags = leftStringInfo.tags || {};
|
|
60
|
-
}
|
|
55
|
+
let newTags = {};
|
|
56
|
+
const history = [];
|
|
61
57
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
58
|
+
if (leftStringInfo) {
|
|
59
|
+
history.push(leftStringInfo);
|
|
60
|
+
newTags = leftStringInfo.tags || {};
|
|
61
|
+
}
|
|
66
62
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
args: [
|
|
72
|
-
{
|
|
73
|
-
tracked: !!leftStringInfo,
|
|
74
|
-
value: leftArg
|
|
75
|
-
},
|
|
76
|
-
{
|
|
77
|
-
tracked: !!rightStringInfo,
|
|
78
|
-
value: rightArg,
|
|
79
|
-
}
|
|
80
|
-
],
|
|
81
|
-
context: `${inspect(leftArg)} + ${inspect(rightArg)}`,
|
|
82
|
-
moduleName: 'global',
|
|
83
|
-
methodName: 'ContrastMethods.add',
|
|
84
|
-
history,
|
|
85
|
-
object: {
|
|
86
|
-
value: 'String Addition',
|
|
87
|
-
tracked: false
|
|
88
|
-
},
|
|
89
|
-
name: 'ContrastMethods.add',
|
|
90
|
-
result: {
|
|
91
|
-
value: result,
|
|
92
|
-
tracked: true
|
|
93
|
-
},
|
|
94
|
-
source: 'P',
|
|
95
|
-
stacktraceOpts: {
|
|
96
|
-
constructorOpt: hooked,
|
|
97
|
-
},
|
|
98
|
-
tags: newTags,
|
|
99
|
-
target: 'R',
|
|
100
|
-
});
|
|
63
|
+
if (rightStringInfo) {
|
|
64
|
+
history.push(rightStringInfo);
|
|
65
|
+
newTags = createAppendTags(newTags, rightStringInfo.tags, args[0].length);
|
|
66
|
+
}
|
|
101
67
|
|
|
102
|
-
|
|
68
|
+
if (history.length) {
|
|
69
|
+
const leftArg = leftStringInfo ? leftStringInfo.value : args[0];
|
|
70
|
+
const rightArg = rightStringInfo ? rightStringInfo.value : args[1];
|
|
71
|
+
const event = createPropagationEvent({
|
|
72
|
+
args: [
|
|
73
|
+
{
|
|
74
|
+
tracked: !!leftStringInfo,
|
|
75
|
+
value: leftArg
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
tracked: !!rightStringInfo,
|
|
79
|
+
value: rightArg,
|
|
80
|
+
}
|
|
81
|
+
],
|
|
82
|
+
context: `${inspect(leftArg)} + ${inspect(rightArg)}`,
|
|
83
|
+
moduleName: 'global',
|
|
84
|
+
methodName: 'ContrastMethods.add',
|
|
85
|
+
history,
|
|
86
|
+
object: {
|
|
87
|
+
value: 'String Addition',
|
|
88
|
+
tracked: false
|
|
89
|
+
},
|
|
90
|
+
name: 'ContrastMethods.add',
|
|
91
|
+
result: {
|
|
92
|
+
value: result,
|
|
93
|
+
tracked: true
|
|
94
|
+
},
|
|
95
|
+
source: 'P',
|
|
96
|
+
stacktraceOpts: {
|
|
97
|
+
constructorOpt: add,
|
|
98
|
+
},
|
|
99
|
+
tags: newTags,
|
|
100
|
+
target: 'R',
|
|
101
|
+
});
|
|
103
102
|
|
|
103
|
+
if (event) {
|
|
104
104
|
const { extern } = tracker.track(result, event);
|
|
105
|
-
|
|
106
|
-
if (extern) {
|
|
107
|
-
data.result = extern;
|
|
108
|
-
}
|
|
105
|
+
if (extern) return extern;
|
|
109
106
|
}
|
|
110
107
|
}
|
|
111
|
-
|
|
108
|
+
|
|
109
|
+
return result;
|
|
110
|
+
};
|
|
111
|
+
global.ContrastMethods.add[origSym] = add;
|
|
112
112
|
},
|
|
113
113
|
uninstall() {
|
|
114
|
-
|
|
114
|
+
const orig = global.ContrastMethods.add[origSym];
|
|
115
|
+
if (orig) global.ContrastMethods.add = orig;
|
|
115
116
|
},
|
|
116
117
|
};
|
|
117
118
|
};
|
|
@@ -16,14 +16,15 @@
|
|
|
16
16
|
'use strict';
|
|
17
17
|
|
|
18
18
|
const { isString } = require('@contrast/common');
|
|
19
|
+
const { InstrumentationType: { PROPAGATOR } } = require('../../../../constants');
|
|
19
20
|
const { patchType } = require('../../common');
|
|
20
21
|
|
|
21
22
|
module.exports = function (core) {
|
|
22
23
|
const {
|
|
23
24
|
logger,
|
|
24
|
-
scopes: { instrumentation, sources },
|
|
25
25
|
patcher,
|
|
26
26
|
assess: {
|
|
27
|
+
getSourceContext,
|
|
27
28
|
dataflow: { tracker }
|
|
28
29
|
}
|
|
29
30
|
} = core;
|
|
@@ -38,13 +39,11 @@ module.exports = function (core) {
|
|
|
38
39
|
post(data) {
|
|
39
40
|
const { args: [value], result } = data;
|
|
40
41
|
if (
|
|
42
|
+
!tracker.getData(value) ||
|
|
41
43
|
isNaN(result) ||
|
|
42
44
|
!value ||
|
|
43
45
|
!isString(value) ||
|
|
44
|
-
!
|
|
45
|
-
instrumentation.isLocked() ||
|
|
46
|
-
// why not just do this first? won't need check for NaN, !value, !isString, etc.
|
|
47
|
-
!tracker.getData(value)
|
|
46
|
+
!getSourceContext(PROPAGATOR)
|
|
48
47
|
) return;
|
|
49
48
|
|
|
50
49
|
tracker.untrack(value);
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
'use strict';
|
|
17
17
|
|
|
18
18
|
const { DataflowTag } = require('@contrast/common');
|
|
19
|
+
const { InstrumentationType: { PROPAGATOR } } = require('../../../../constants');
|
|
19
20
|
const { patchType } = require('../../common');
|
|
20
21
|
|
|
21
22
|
function metadataUpdate(strInfo, event) {
|
|
@@ -29,9 +30,9 @@ function metadataUpdate(strInfo, event) {
|
|
|
29
30
|
|
|
30
31
|
module.exports = function(core) {
|
|
31
32
|
const {
|
|
32
|
-
scopes: { sources, instrumentation },
|
|
33
33
|
patcher,
|
|
34
34
|
assess: {
|
|
35
|
+
getSourceContext,
|
|
35
36
|
eventFactory: { createPropagationEvent },
|
|
36
37
|
dataflow: { tracker },
|
|
37
38
|
}
|
|
@@ -44,7 +45,7 @@ module.exports = function(core) {
|
|
|
44
45
|
name,
|
|
45
46
|
patchType,
|
|
46
47
|
post(data) {
|
|
47
|
-
if (!data.result || !
|
|
48
|
+
if (!data.result || !getSourceContext(PROPAGATOR)) return;
|
|
48
49
|
|
|
49
50
|
const arg = data.args[0];
|
|
50
51
|
let argInfo = tracker.getData(arg);
|
|
@@ -15,16 +15,17 @@
|
|
|
15
15
|
|
|
16
16
|
'use strict';
|
|
17
17
|
|
|
18
|
+
const { InstrumentationType: { PROPAGATOR } } = require('../../../../constants');
|
|
18
19
|
const { patchType } = require('../../common');
|
|
19
20
|
|
|
20
21
|
module.exports = function(core) {
|
|
21
22
|
const {
|
|
22
23
|
assess: {
|
|
24
|
+
getSourceContext,
|
|
23
25
|
eventFactory: { createPropagationEvent },
|
|
24
26
|
dataflow: { tracker },
|
|
25
27
|
},
|
|
26
28
|
patcher,
|
|
27
|
-
scopes: { sources, instrumentation },
|
|
28
29
|
} = core;
|
|
29
30
|
|
|
30
31
|
const tag = {
|
|
@@ -33,11 +34,7 @@ module.exports = function(core) {
|
|
|
33
34
|
name: 'ContrastMethods.tag',
|
|
34
35
|
patchType,
|
|
35
36
|
post(data) {
|
|
36
|
-
if (
|
|
37
|
-
!data.result ||
|
|
38
|
-
!sources.getStore()?.assess ||
|
|
39
|
-
instrumentation.isLocked()
|
|
40
|
-
) {
|
|
37
|
+
if (!data.result || !getSourceContext(PROPAGATOR)) {
|
|
41
38
|
return;
|
|
42
39
|
}
|
|
43
40
|
|
|
@@ -15,10 +15,7 @@
|
|
|
15
15
|
|
|
16
16
|
'use strict';
|
|
17
17
|
|
|
18
|
-
const {
|
|
19
|
-
DataflowTag: { ALPHANUM_SPACE_HYPHEN },
|
|
20
|
-
inspect,
|
|
21
|
-
} = require('@contrast/common');
|
|
18
|
+
const { DataflowTag: { ALPHANUM_SPACE_HYPHEN } } = require('@contrast/common');
|
|
22
19
|
const { patchType } = require('../../common');
|
|
23
20
|
|
|
24
21
|
module.exports = function(core) {
|
|
@@ -27,6 +24,7 @@ module.exports = function(core) {
|
|
|
27
24
|
scopes: { sources, instrumentation },
|
|
28
25
|
patcher,
|
|
29
26
|
assess: {
|
|
27
|
+
inspect, // todo: remove
|
|
30
28
|
eventFactory: { createPropagationEvent },
|
|
31
29
|
dataflow: { tracker },
|
|
32
30
|
},
|
|
@@ -15,10 +15,7 @@
|
|
|
15
15
|
|
|
16
16
|
'use strict';
|
|
17
17
|
|
|
18
|
-
const {
|
|
19
|
-
DataflowTag: { HTML_ENCODED },
|
|
20
|
-
inspect,
|
|
21
|
-
} = require('@contrast/common');
|
|
18
|
+
const { DataflowTag: { HTML_ENCODED } } = require('@contrast/common');
|
|
22
19
|
const { patchType } = require('../../common');
|
|
23
20
|
|
|
24
21
|
module.exports = function(core) {
|
|
@@ -27,6 +24,7 @@ module.exports = function(core) {
|
|
|
27
24
|
scopes: { sources, instrumentation },
|
|
28
25
|
patcher,
|
|
29
26
|
assess: {
|
|
27
|
+
inspect, // todo: remove
|
|
30
28
|
eventFactory: { createPropagationEvent },
|
|
31
29
|
dataflow: { tracker },
|
|
32
30
|
},
|
|
@@ -20,7 +20,6 @@ const {
|
|
|
20
20
|
isString,
|
|
21
21
|
isNonEmptyObject,
|
|
22
22
|
traverseValues,
|
|
23
|
-
inspect,
|
|
24
23
|
} = require('@contrast/common');
|
|
25
24
|
const { patchType } = require('../../common');
|
|
26
25
|
const { tagCustomValidatedString, handleReferences } = require('./utils');
|
|
@@ -30,6 +29,7 @@ module.exports = function(core) {
|
|
|
30
29
|
patcher,
|
|
31
30
|
scopes: { sources, instrumentation },
|
|
32
31
|
assess: {
|
|
32
|
+
inspect, // todo: remove
|
|
33
33
|
eventFactory: { createPropagationEvent },
|
|
34
34
|
dataflow: { tracker },
|
|
35
35
|
},
|
|
@@ -15,10 +15,7 @@
|
|
|
15
15
|
|
|
16
16
|
'use strict';
|
|
17
17
|
|
|
18
|
-
const {
|
|
19
|
-
DataflowTag: { LIMITED_CHARS },
|
|
20
|
-
inspect,
|
|
21
|
-
} = require('@contrast/common');
|
|
18
|
+
const { DataflowTag: { LIMITED_CHARS } } = require('@contrast/common');
|
|
22
19
|
const { patchType } = require('../../common');
|
|
23
20
|
|
|
24
21
|
module.exports = function(core) {
|
|
@@ -27,6 +24,7 @@ module.exports = function(core) {
|
|
|
27
24
|
scopes: { sources, instrumentation },
|
|
28
25
|
patcher,
|
|
29
26
|
assess: {
|
|
27
|
+
inspect, // todo: remove
|
|
30
28
|
eventFactory: { createPropagationEvent },
|
|
31
29
|
dataflow: { tracker },
|
|
32
30
|
},
|
|
@@ -16,12 +16,16 @@
|
|
|
16
16
|
'use strict';
|
|
17
17
|
|
|
18
18
|
const {
|
|
19
|
-
DataflowTag: {
|
|
20
|
-
|
|
19
|
+
DataflowTag: {
|
|
20
|
+
ALPHANUM_SPACE_HYPHEN,
|
|
21
|
+
LIMITED_CHARS,
|
|
22
|
+
STRING_TYPE_CHECKED
|
|
23
|
+
},
|
|
21
24
|
} = require('@contrast/common');
|
|
22
|
-
const { handleReferences } = require('./utils');
|
|
23
25
|
const { createFullLengthCopyTags } = require('../../../tag-utils');
|
|
24
26
|
const { patchType } = require('../../common');
|
|
27
|
+
const { handleReferences } = require('./utils');
|
|
28
|
+
|
|
25
29
|
const VALIDATORS = {
|
|
26
30
|
base64: ALPHANUM_SPACE_HYPHEN,
|
|
27
31
|
guid: ALPHANUM_SPACE_HYPHEN,
|
|
@@ -42,6 +46,7 @@ module.exports = function(core) {
|
|
|
42
46
|
scopes: { sources, instrumentation },
|
|
43
47
|
patcher,
|
|
44
48
|
assess: {
|
|
49
|
+
inspect, // todo: remove
|
|
45
50
|
eventFactory: { createPropagationEvent },
|
|
46
51
|
dataflow: {
|
|
47
52
|
tracker, propagation: {
|
|
@@ -16,7 +16,10 @@
|
|
|
16
16
|
'use strict';
|
|
17
17
|
|
|
18
18
|
const {
|
|
19
|
-
isNonEmptyObject,
|
|
19
|
+
isNonEmptyObject,
|
|
20
|
+
isString,
|
|
21
|
+
join,
|
|
22
|
+
traverseValues,
|
|
20
23
|
} = require('@contrast/common');
|
|
21
24
|
const { createMergedTags } = require('../../../tag-utils');
|
|
22
25
|
const { patchType } = require('../../common');
|
|
@@ -27,6 +30,7 @@ module.exports = function(core) {
|
|
|
27
30
|
scopes: { sources, instrumentation },
|
|
28
31
|
patcher,
|
|
29
32
|
assess: {
|
|
33
|
+
inspect, // todo: remove
|
|
30
34
|
eventFactory: { createPropagationEvent },
|
|
31
35
|
dataflow: { tracker },
|
|
32
36
|
},
|
|
@@ -14,9 +14,9 @@
|
|
|
14
14
|
*/
|
|
15
15
|
|
|
16
16
|
'use strict';
|
|
17
|
+
const { join, isString } = require('@contrast/common');
|
|
17
18
|
const { patchType } = require('../../common');
|
|
18
|
-
const {
|
|
19
|
-
const { createMergedTags } = require('../../../tag-utils');
|
|
19
|
+
const { createMergedTags, getAdjustedUntrackedValue } = require('../../../tag-utils');
|
|
20
20
|
const {
|
|
21
21
|
createArgTagsInResult,
|
|
22
22
|
excludeExtensionDotFromTags
|
|
@@ -65,7 +65,10 @@ module.exports = function(core) {
|
|
|
65
65
|
let newTags = {};
|
|
66
66
|
const propInfo = isString(prop) && tracker.getData(prop);
|
|
67
67
|
if (!propInfo) {
|
|
68
|
-
eventArgs.unshift({
|
|
68
|
+
eventArgs.unshift({
|
|
69
|
+
value: getAdjustedUntrackedValue(prop),
|
|
70
|
+
tracked: false
|
|
71
|
+
});
|
|
69
72
|
continue;
|
|
70
73
|
}
|
|
71
74
|
|
|
@@ -95,7 +98,7 @@ module.exports = function(core) {
|
|
|
95
98
|
name: patchName,
|
|
96
99
|
moduleName: 'path',
|
|
97
100
|
methodName: 'format',
|
|
98
|
-
context: `path.format(
|
|
101
|
+
context: `path.format(${join(eventArgs.map((a) => a.value))})`,
|
|
99
102
|
history,
|
|
100
103
|
object: {
|
|
101
104
|
value: 'path',
|
|
@@ -14,12 +14,10 @@
|
|
|
14
14
|
*/
|
|
15
15
|
|
|
16
16
|
'use strict';
|
|
17
|
-
const {
|
|
18
|
-
const { isString, inspect } = require('@contrast/common');
|
|
17
|
+
const { isString } = require('@contrast/common');
|
|
19
18
|
const { createSubsetTags } = require('../../../tag-utils');
|
|
20
|
-
const {
|
|
21
|
-
|
|
22
|
-
} = require('./common');
|
|
19
|
+
const { patchType } = require('../../common');
|
|
20
|
+
const { excludeExtensionDotFromTags } = require('./common');
|
|
23
21
|
|
|
24
22
|
module.exports = function(core) {
|
|
25
23
|
const {
|
|
@@ -27,6 +25,7 @@ module.exports = function(core) {
|
|
|
27
25
|
patcher,
|
|
28
26
|
scopes: { sources, instrumentation },
|
|
29
27
|
assess: {
|
|
28
|
+
inspect, // todo: remove
|
|
30
29
|
eventFactory: { createPropagationEvent },
|
|
31
30
|
dataflow: { tracker },
|
|
32
31
|
},
|
|
@@ -14,7 +14,6 @@
|
|
|
14
14
|
*/
|
|
15
15
|
'use strict';
|
|
16
16
|
|
|
17
|
-
const { inspect } = require('util');
|
|
18
17
|
const { DataflowTag: { URL_ENCODED } } = require('@contrast/common');
|
|
19
18
|
const { createFullLengthCopyTags } = require('../../../tag-utils');
|
|
20
19
|
const { patchType } = require('../../common');
|
|
@@ -22,6 +21,7 @@ const { patchType } = require('../../common');
|
|
|
22
21
|
module.exports = function(core) {
|
|
23
22
|
const {
|
|
24
23
|
assess: {
|
|
24
|
+
inspect, // todo: remove
|
|
25
25
|
eventFactory: { createPropagationEvent },
|
|
26
26
|
dataflow: { tracker }
|
|
27
27
|
},
|