@contrast/assess 1.53.0 → 1.54.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/crypto-analysis/install/math.js +0 -1
- package/lib/dataflow/propagation/common.js +6 -6
- package/lib/dataflow/propagation/install/JSON/parse.js +7 -3
- package/lib/dataflow/propagation/install/JSON/stringify.js +7 -6
- package/lib/dataflow/propagation/install/array-prototype-join.js +5 -8
- package/lib/dataflow/propagation/install/buffer.js +4 -4
- package/lib/dataflow/propagation/install/contrast-methods/add.js +42 -38
- package/lib/dataflow/propagation/install/contrast-methods/string.js +4 -2
- package/lib/dataflow/propagation/install/contrast-methods/tag.js +3 -1
- package/lib/dataflow/propagation/install/decode-uri-component.js +5 -7
- package/lib/dataflow/propagation/install/ejs/escape-xml.js +4 -3
- package/lib/dataflow/propagation/install/ejs/template.js +1 -1
- package/lib/dataflow/propagation/install/encode-uri.js +5 -7
- package/lib/dataflow/propagation/install/escape-html.js +4 -3
- package/lib/dataflow/propagation/install/escape.js +5 -7
- package/lib/dataflow/propagation/install/handlebars-utils-escape-expression.js +4 -3
- package/lib/dataflow/propagation/install/joi/boolean.js +1 -3
- package/lib/dataflow/propagation/install/joi/expression.js +1 -3
- package/lib/dataflow/propagation/install/joi/number.js +1 -3
- package/lib/dataflow/propagation/install/joi/string-schema.js +2 -6
- package/lib/dataflow/propagation/install/joi/utils.js +2 -4
- package/lib/dataflow/propagation/install/joi/values.js +1 -3
- package/lib/dataflow/propagation/install/mongoose/schema-map.js +1 -3
- package/lib/dataflow/propagation/install/mongoose/schema-mixed.js +1 -3
- package/lib/dataflow/propagation/install/mongoose/schema-string.js +4 -5
- package/lib/dataflow/propagation/install/mustache-escape.js +4 -3
- package/lib/dataflow/propagation/install/mysql-connection-escape.js +9 -8
- package/lib/dataflow/propagation/install/path/basename.js +6 -7
- package/lib/dataflow/propagation/install/path/common.js +1 -0
- package/lib/dataflow/propagation/install/path/dirname.js +6 -8
- package/lib/dataflow/propagation/install/path/extname.js +8 -22
- package/lib/dataflow/propagation/install/path/format.js +6 -10
- package/lib/dataflow/propagation/install/path/join-and-resolve.js +7 -13
- package/lib/dataflow/propagation/install/path/normalize.js +8 -18
- package/lib/dataflow/propagation/install/path/parse.js +8 -18
- package/lib/dataflow/propagation/install/path/relative.js +8 -15
- package/lib/dataflow/propagation/install/path/toNamespacedPath.js +7 -18
- package/lib/dataflow/propagation/install/pug/index.js +1 -1
- package/lib/dataflow/propagation/install/pug-runtime-escape.js +6 -5
- package/lib/dataflow/propagation/install/querystring/escape.js +3 -1
- package/lib/dataflow/propagation/install/querystring/parse.js +3 -2
- package/lib/dataflow/propagation/install/querystring/stringify.js +4 -4
- package/lib/dataflow/propagation/install/reg-exp-prototype-exec.js +4 -3
- package/lib/dataflow/propagation/install/sequelize/query-generator.js +0 -1
- package/lib/dataflow/propagation/install/sequelize/sql-string.js +16 -17
- package/lib/dataflow/propagation/install/sql-template-strings.js +6 -10
- package/lib/dataflow/propagation/install/string/concat.js +4 -4
- package/lib/dataflow/propagation/install/string/format-methods.js +4 -4
- package/lib/dataflow/propagation/install/string/html-methods.js +5 -6
- package/lib/dataflow/propagation/install/string/index.js +4 -3
- package/lib/dataflow/propagation/install/string/match-all.js +7 -6
- package/lib/dataflow/propagation/install/string/match.js +10 -9
- package/lib/dataflow/propagation/install/string/replace.js +5 -6
- package/lib/dataflow/propagation/install/string/slice.js +4 -3
- package/lib/dataflow/propagation/install/string/split.js +11 -11
- package/lib/dataflow/propagation/install/string/substring.js +4 -3
- package/lib/dataflow/propagation/install/string/trim.js +4 -3
- package/lib/dataflow/propagation/install/unescape.js +6 -14
- package/lib/dataflow/propagation/install/url/domain-parsers.js +6 -5
- package/lib/dataflow/propagation/install/url/parse.js +17 -17
- package/lib/dataflow/propagation/install/url/searchParams.js +36 -25
- package/lib/dataflow/propagation/install/url/url.js +3 -2
- package/lib/dataflow/propagation/install/util-format.js +4 -3
- package/lib/dataflow/propagation/install/validator/hooks.js +0 -1
- package/lib/dataflow/sinks/install/eval.js +3 -1
- package/lib/dataflow/sinks/install/function.js +3 -4
- package/lib/dataflow/sinks/install/marsdb.js +3 -1
- package/lib/dataflow/sinks/install/mongodb.js +3 -1
- package/lib/dataflow/sinks/install/mssql.js +4 -3
- package/lib/dataflow/sinks/install/mysql.js +3 -1
- package/lib/dataflow/sinks/install/restify.js +3 -1
- package/lib/dataflow/sinks/install/sqlite3.js +4 -2
- package/lib/dataflow/sinks/install/vm.js +6 -4
- package/lib/dataflow/sources/handler.js +2 -3
- package/lib/dataflow/sources/install/fastify/fastify.js +4 -4
- package/lib/dataflow/tag-utils.js +15 -1
- package/lib/dataflow/tracker.js +0 -5
- package/lib/event-factory.js +1 -1
- package/lib/session-configuration/install/express-session.js +0 -1
- package/lib/session-configuration/install/fastify-cookie.js +0 -3
- package/lib/session-configuration/install/hapi.js +0 -1
- package/lib/session-configuration/install/koa.js +0 -3
- package/package.json +10 -10
|
@@ -36,14 +36,14 @@ module.exports = function (core) {
|
|
|
36
36
|
patchType,
|
|
37
37
|
post({ result: server, funcKey }) {
|
|
38
38
|
server.addHook('preValidation', function preValidationHandler(request, reply, done) {
|
|
39
|
+
const sourceContext = getSourceContext();
|
|
40
|
+
if (!sourceContext) return done();
|
|
41
|
+
|
|
39
42
|
const bodyType = request?.headers?.['content-type']?.includes('/json')
|
|
40
43
|
? InputType.JSON_VALUE
|
|
41
44
|
: typeof request.body == 'object'
|
|
42
45
|
? InputType.PARAMETER_VALUE
|
|
43
46
|
: InputType.BODY;
|
|
44
|
-
const sourceContext = getSourceContext();
|
|
45
|
-
|
|
46
|
-
if (!sourceContext) return;
|
|
47
47
|
|
|
48
48
|
[
|
|
49
49
|
{ key: 'query', inputType: InputType.QUERYSTRING, alreadyTrackedFlag: 'parsedQuery' },
|
|
@@ -71,7 +71,7 @@ module.exports = function (core) {
|
|
|
71
71
|
}
|
|
72
72
|
});
|
|
73
73
|
|
|
74
|
-
done();
|
|
74
|
+
return done();
|
|
75
75
|
});
|
|
76
76
|
},
|
|
77
77
|
}));
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
*/
|
|
15
15
|
'use strict';
|
|
16
16
|
|
|
17
|
-
const { empties, primordials: { StringPrototypeSplit } } = require('@contrast/common');
|
|
17
|
+
const { empties, primordials: { StringPrototypeSplit, StringPrototypeSubstr } } = require('@contrast/common');
|
|
18
18
|
|
|
19
19
|
//
|
|
20
20
|
// This module implements tag range manipulation functions. There are generally
|
|
@@ -536,6 +536,19 @@ function getAdjustedUntrackedValue(origValue) {
|
|
|
536
536
|
return origValue?.constructor?.name ?? (origValue === null ? 'null' : typeof origValue);
|
|
537
537
|
}
|
|
538
538
|
|
|
539
|
+
/**
|
|
540
|
+
* Truncation spec: https://github.com/Contrast-Security-Inc/assess-specifications/blob/master/vulnerability/truncate-event-snapshots.md
|
|
541
|
+
* While the spec calls to truncate the middle of strings, we're going to just chop off the end.
|
|
542
|
+
* This way we don't have to recalculate all of the tag ranges to adjust for truncating.
|
|
543
|
+
* @param {string} str input string to be truncated
|
|
544
|
+
* @param {number} len
|
|
545
|
+
* @returns {string}
|
|
546
|
+
*/
|
|
547
|
+
function truncateStringValue(str, len = 103) {
|
|
548
|
+
if (str.length <= len) return str;
|
|
549
|
+
return `${StringPrototypeSubstr.call(str, 0, len)}...`;
|
|
550
|
+
}
|
|
551
|
+
|
|
539
552
|
module.exports = {
|
|
540
553
|
createSubsetTags,
|
|
541
554
|
createAppendTags,
|
|
@@ -546,4 +559,5 @@ module.exports = {
|
|
|
546
559
|
createOverlappingTags,
|
|
547
560
|
createEscapeTagRanges,
|
|
548
561
|
getAdjustedUntrackedValue,
|
|
562
|
+
truncateStringValue,
|
|
549
563
|
};
|
package/lib/dataflow/tracker.js
CHANGED
|
@@ -37,10 +37,6 @@ module.exports = function tracker(core) {
|
|
|
37
37
|
return objMap.get(value) || null;
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
function isTracked(value) {
|
|
41
|
-
return distringuish.isExternal(value);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
40
|
function track(value, metadata) {
|
|
45
41
|
let ret = Object.create(null);
|
|
46
42
|
|
|
@@ -152,6 +148,5 @@ module.exports = function tracker(core) {
|
|
|
152
148
|
untrack,
|
|
153
149
|
getData,
|
|
154
150
|
getInfo: getData,
|
|
155
|
-
isTracked,
|
|
156
151
|
};
|
|
157
152
|
};
|
package/lib/event-factory.js
CHANGED
|
@@ -45,7 +45,7 @@ module.exports = Core.makeComponent({
|
|
|
45
45
|
|
|
46
46
|
eventFactory.createdEvents = new WeakSet();
|
|
47
47
|
|
|
48
|
-
eventFactory.createSourceEvent = function(data
|
|
48
|
+
eventFactory.createSourceEvent = function(data) {
|
|
49
49
|
if (!data.result?.value) {
|
|
50
50
|
logger.debug(SOURCE_EVENT_MSG, `invalid result: ${data.name}`);
|
|
51
51
|
return null;
|
|
@@ -59,7 +59,6 @@ module.exports = function (core) {
|
|
|
59
59
|
value: displayArg
|
|
60
60
|
}],
|
|
61
61
|
context: `fastifyCookie(${displayArg})`,
|
|
62
|
-
history: [],
|
|
63
62
|
name: 'fastifyCookie',
|
|
64
63
|
moduleName: '@fastify/cookie',
|
|
65
64
|
methodName: '',
|
|
@@ -71,8 +70,6 @@ module.exports = function (core) {
|
|
|
71
70
|
tracked: false,
|
|
72
71
|
},
|
|
73
72
|
source: 'P0',
|
|
74
|
-
stack: [],
|
|
75
|
-
tags: {},
|
|
76
73
|
framework: '@fastify/cookie',
|
|
77
74
|
});
|
|
78
75
|
|
|
@@ -72,7 +72,6 @@ module.exports = function (core) {
|
|
|
72
72
|
value: displayArg
|
|
73
73
|
}],
|
|
74
74
|
context: `ctx.cookies.set(${displayArg})`,
|
|
75
|
-
history: [],
|
|
76
75
|
name: 'koaCookie',
|
|
77
76
|
moduleName: 'koa',
|
|
78
77
|
methodName: '',
|
|
@@ -84,8 +83,6 @@ module.exports = function (core) {
|
|
|
84
83
|
tracked: false,
|
|
85
84
|
},
|
|
86
85
|
source: 'P',
|
|
87
|
-
stack: [],
|
|
88
|
-
tags: {},
|
|
89
86
|
framework: 'koa',
|
|
90
87
|
});
|
|
91
88
|
if (!httpOnly) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contrast/assess",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.54.0",
|
|
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)",
|
|
@@ -21,16 +21,16 @@
|
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"@contrast/common": "1.32.0",
|
|
24
|
-
"@contrast/config": "1.
|
|
25
|
-
"@contrast/core": "1.
|
|
26
|
-
"@contrast/dep-hooks": "1.
|
|
24
|
+
"@contrast/config": "1.46.0",
|
|
25
|
+
"@contrast/core": "1.51.0",
|
|
26
|
+
"@contrast/dep-hooks": "1.20.0",
|
|
27
27
|
"@contrast/distringuish": "^5.1.0",
|
|
28
|
-
"@contrast/instrumentation": "1.
|
|
29
|
-
"@contrast/logger": "1.
|
|
30
|
-
"@contrast/patcher": "1.
|
|
31
|
-
"@contrast/rewriter": "1.
|
|
32
|
-
"@contrast/route-coverage": "1.
|
|
33
|
-
"@contrast/scopes": "1.
|
|
28
|
+
"@contrast/instrumentation": "1.30.0",
|
|
29
|
+
"@contrast/logger": "1.24.0",
|
|
30
|
+
"@contrast/patcher": "1.23.0",
|
|
31
|
+
"@contrast/rewriter": "1.27.0",
|
|
32
|
+
"@contrast/route-coverage": "1.42.0",
|
|
33
|
+
"@contrast/scopes": "1.21.0",
|
|
34
34
|
"semver": "^7.6.0"
|
|
35
35
|
}
|
|
36
36
|
}
|