@contrast/assess 1.1.0 → 1.2.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.
- package/lib/dataflow/propagation/index.js +6 -7
- package/lib/dataflow/propagation/install/contrast-methods/index.js +1 -0
- package/lib/dataflow/propagation/install/contrast-methods/string.js +56 -0
- package/lib/dataflow/propagation/install/string/index.js +1 -0
- package/lib/dataflow/propagation/install/string/split.js +108 -0
- package/lib/dataflow/sources/index.js +0 -1
- package/lib/dataflow/sources/install/http.js +9 -6
- package/lib/index.js +7 -2
- package/lib/response-scanning/handlers/index.js +274 -0
- package/lib/response-scanning/handlers/utils.js +394 -0
- package/lib/response-scanning/index.js +36 -0
- package/lib/response-scanning/install/http.js +119 -0
- package/package.json +3 -3
- package/coverage/lcov-report/base.css +0 -224
- package/coverage/lcov-report/block-navigation.js +0 -87
- package/coverage/lcov-report/favicon.png +0 -0
- package/coverage/lcov-report/index.html +0 -266
- package/coverage/lcov-report/lib/dataflow/common.js.html +0 -154
- package/coverage/lcov-report/lib/dataflow/event-factory.js.html +0 -598
- package/coverage/lcov-report/lib/dataflow/index.html +0 -191
- package/coverage/lcov-report/lib/dataflow/index.js.html +0 -190
- package/coverage/lcov-report/lib/dataflow/propagation/common.js.html +0 -145
- package/coverage/lcov-report/lib/dataflow/propagation/index.html +0 -131
- package/coverage/lcov-report/lib/dataflow/propagation/index.js.html +0 -190
- package/coverage/lcov-report/lib/dataflow/propagation/install/contrast-methods/index.html +0 -131
- package/coverage/lcov-report/lib/dataflow/propagation/install/contrast-methods/index.js.html +0 -184
- package/coverage/lcov-report/lib/dataflow/propagation/install/contrast-methods/plus.js.html +0 -397
- package/coverage/lcov-report/lib/dataflow/propagation/install/string/concat.js.html +0 -478
- package/coverage/lcov-report/lib/dataflow/propagation/install/string/index.html +0 -176
- package/coverage/lcov-report/lib/dataflow/propagation/install/string/index.js.html +0 -202
- package/coverage/lcov-report/lib/dataflow/propagation/install/string/replace.js.html +0 -496
- package/coverage/lcov-report/lib/dataflow/propagation/install/string/substring.js.html +0 -415
- package/coverage/lcov-report/lib/dataflow/propagation/install/string/trim.js.html +0 -403
- package/coverage/lcov-report/lib/dataflow/signatures.js.html +0 -5923
- package/coverage/lcov-report/lib/dataflow/sinks/common.js.html +0 -145
- package/coverage/lcov-report/lib/dataflow/sinks/index.html +0 -131
- package/coverage/lcov-report/lib/dataflow/sinks/index.js.html +0 -211
- package/coverage/lcov-report/lib/dataflow/sinks/install/fastify/index.html +0 -146
- package/coverage/lcov-report/lib/dataflow/sinks/install/fastify/index.js.html +0 -172
- package/coverage/lcov-report/lib/dataflow/sinks/install/fastify/unvalidated-redirect.js.html +0 -319
- package/coverage/lcov-report/lib/dataflow/sinks/install/fastify/xss.js.html +0 -721
- package/coverage/lcov-report/lib/dataflow/sinks/install/http.js.html +0 -340
- package/coverage/lcov-report/lib/dataflow/sinks/install/index.html +0 -116
- package/coverage/lcov-report/lib/dataflow/sources/common.js.html +0 -145
- package/coverage/lcov-report/lib/dataflow/sources/index.html +0 -131
- package/coverage/lcov-report/lib/dataflow/sources/index.js.html +0 -226
- package/coverage/lcov-report/lib/dataflow/sources/install/fastify.js.html +0 -379
- package/coverage/lcov-report/lib/dataflow/sources/install/http.js.html +0 -502
- package/coverage/lcov-report/lib/dataflow/sources/install/index.html +0 -146
- package/coverage/lcov-report/lib/dataflow/sources/install/qs.js.html +0 -322
- package/coverage/lcov-report/lib/dataflow/tag-utils.js.html +0 -418
- package/coverage/lcov-report/lib/dataflow/tracker.js.html +0 -466
- package/coverage/lcov-report/lib/dataflow/utils/index.html +0 -116
- package/coverage/lcov-report/lib/dataflow/utils/is-vulnerable.js.html +0 -424
- package/coverage/lcov-report/lib/index.html +0 -116
- package/coverage/lcov-report/lib/index.js.html +0 -193
- package/coverage/lcov-report/prettify.css +0 -1
- package/coverage/lcov-report/prettify.js +0 -2
- package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/coverage/lcov-report/sorter.js +0 -196
- package/coverage/lcov.info +0 -4856
- package/coverage/tmp/coverage-9548-1675168551025-0.json +0 -1
- package/coverage/tmp/coverage-9551-1675168550963-0.json +0 -1
- package/coverage/tmp/coverage-9552-1675168550969-0.json +0 -1
- package/coverage/tmp/coverage-9553-1675168550970-0.json +0 -1
- package/coverage/tmp/coverage-9554-1675168550962-0.json +0 -1
- package/coverage/tmp/coverage-9555-1675168550965-0.json +0 -1
- package/coverage/tmp/coverage-9556-1675168550964-0.json +0 -1
- package/coverage/tmp/coverage-9557-1675168550969-0.json +0 -1
- package/coverage/tmp/coverage-9558-1675168550964-0.json +0 -1
- package/coverage/tmp/coverage-9559-1675168550971-0.json +0 -1
- package/lib/dataflow/sources/install/qs.js +0 -88
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright: 2022 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
|
-
|
|
16
|
-
'use strict';
|
|
17
|
-
|
|
18
|
-
const { patchType } = require('../common');
|
|
19
|
-
|
|
20
|
-
module.exports = function(core) {
|
|
21
|
-
const {
|
|
22
|
-
createSnapshot,
|
|
23
|
-
patcher,
|
|
24
|
-
depHooks,
|
|
25
|
-
scopes,
|
|
26
|
-
assess: {
|
|
27
|
-
dataflow: { tracker, sources },
|
|
28
|
-
},
|
|
29
|
-
logger
|
|
30
|
-
} = core;
|
|
31
|
-
|
|
32
|
-
function makeCapturer(opts) {
|
|
33
|
-
const snapshot = createSnapshot(opts);
|
|
34
|
-
return function(obj) {
|
|
35
|
-
obj.stack = snapshot();
|
|
36
|
-
return obj;
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
const qsSourcesInstr = sources.qsSourcesInstr = {
|
|
41
|
-
install() {
|
|
42
|
-
depHooks.resolve({ name: 'qs' }, (qs) => {
|
|
43
|
-
patcher.patch(qs, 'parse', {
|
|
44
|
-
name: 'qs',
|
|
45
|
-
patchType,
|
|
46
|
-
post({ args, orig, hooked, result }) {
|
|
47
|
-
if (result && Object.keys(result).length) {
|
|
48
|
-
const assessStore = scopes.sources.getStore().assess;
|
|
49
|
-
|
|
50
|
-
if (!assessStore) {
|
|
51
|
-
logger.debug('assessStore not available in `qs` hook');
|
|
52
|
-
} else {
|
|
53
|
-
const captureStack = makeCapturer({ constructorOpt: hooked, prependFrames: [orig] });
|
|
54
|
-
|
|
55
|
-
// We need to track `qs` result only when it's used as a query parser.
|
|
56
|
-
// `qs` is used also for parsing bodies, but these cases we handle individually with
|
|
57
|
-
// the respective library that's using it (e.g. `formidable`, `co-body`) because in
|
|
58
|
-
// some cases its use is optional and we cannot rely on it.
|
|
59
|
-
if (assessStore.reqData.queries === args[0]) {
|
|
60
|
-
for (const [key, value] of Object.entries(result)) {
|
|
61
|
-
// TODO Same as fastify - do we need a try-catch
|
|
62
|
-
// and checks for already tracked strings
|
|
63
|
-
const { extern } = tracker.track(
|
|
64
|
-
value,
|
|
65
|
-
captureStack({
|
|
66
|
-
inputType: 'query',
|
|
67
|
-
name: key,
|
|
68
|
-
tags: {
|
|
69
|
-
untrusted: [0, value.length - 1],
|
|
70
|
-
}
|
|
71
|
-
})
|
|
72
|
-
);
|
|
73
|
-
|
|
74
|
-
if (extern) {
|
|
75
|
-
result[key] = extern;
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
});
|
|
83
|
-
});
|
|
84
|
-
},
|
|
85
|
-
};
|
|
86
|
-
|
|
87
|
-
return qsSourcesInstr;
|
|
88
|
-
};
|