@contrast/protect 1.60.0 → 1.62.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.
|
@@ -41,6 +41,9 @@ module.exports = (core) => {
|
|
|
41
41
|
patchType,
|
|
42
42
|
post({ result: server, funcKey }) {
|
|
43
43
|
server.addHook('preValidation', function (request, reply, done) {
|
|
44
|
+
// todo(NODE-3793): support for @fastify/websocket
|
|
45
|
+
if (request.constructor.name == 'WebSocket') return;
|
|
46
|
+
|
|
44
47
|
let securityException;
|
|
45
48
|
const sourceContext = protect.getSourceContext();
|
|
46
49
|
|
|
@@ -43,21 +43,28 @@ const getRuleResults = function(obj, prop) {
|
|
|
43
43
|
// See files in protect/lib/input-tracing/install/.
|
|
44
44
|
|
|
45
45
|
module.exports = function(core) {
|
|
46
|
-
const {
|
|
46
|
+
const {
|
|
47
|
+
protect: {
|
|
48
|
+
agentLib,
|
|
49
|
+
semanticAnalysis,
|
|
50
|
+
throwSecurityException
|
|
51
|
+
},
|
|
52
|
+
captureStacktrace,
|
|
53
|
+
} = core;
|
|
47
54
|
|
|
48
55
|
function handleResult(sourceContext, sinkContext, ruleId, mode, finding) {
|
|
49
56
|
const { value, stacktraceOpts } = sinkContext;
|
|
50
57
|
captureStacktrace(sinkContext, stacktraceOpts);
|
|
58
|
+
|
|
59
|
+
// shoehorn findings into agent-lib result data model
|
|
51
60
|
const result = {
|
|
52
61
|
blocked: false,
|
|
53
62
|
ruleId,
|
|
54
63
|
value,
|
|
55
64
|
mappedId: ruleId,
|
|
56
|
-
exploitMetadata: [{ command: value }],
|
|
57
|
-
sinkContext,
|
|
65
|
+
exploitMetadata: [{ sinkContext, command: value }],
|
|
58
66
|
...finding
|
|
59
67
|
};
|
|
60
|
-
|
|
61
68
|
getRuleResults(sourceContext.resultsMap, ruleId).push(result);
|
|
62
69
|
|
|
63
70
|
if (BLOCKING_MODES.includes(mode)) {
|
|
@@ -111,7 +118,7 @@ module.exports = function(core) {
|
|
|
111
118
|
|
|
112
119
|
if (agentLib.isDangerousPath(sinkContext.value, true)) {
|
|
113
120
|
handleResult(sourceContext, sinkContext, Rule.PATH_TRAVERSAL_SEMANTIC_FILE_SECURITY_BYPASS, mode, {
|
|
114
|
-
exploitMetadata: [{ path: sinkContext.value }]
|
|
121
|
+
exploitMetadata: [{ sinkContext, path: sinkContext.value }]
|
|
115
122
|
});
|
|
116
123
|
}
|
|
117
124
|
};
|
|
@@ -123,7 +130,7 @@ module.exports = function(core) {
|
|
|
123
130
|
const findings = findExternalEntities(sinkContext.value);
|
|
124
131
|
if (findings.entities.length) {
|
|
125
132
|
handleResult(sourceContext, sinkContext, Rule.XXE, mode, {
|
|
126
|
-
exploitMetadata: [findings],
|
|
133
|
+
exploitMetadata: [{ sinkContext, ...findings }],
|
|
127
134
|
});
|
|
128
135
|
}
|
|
129
136
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contrast/protect",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.62.0",
|
|
4
4
|
"description": "Contrast service providing framework-agnostic Protect support",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE",
|
|
6
6
|
"author": "Contrast Security <nodejs@contrastsecurity.com> (https://www.contrastsecurity.com)",
|
|
@@ -22,15 +22,15 @@
|
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"@contrast/agent-lib": "^9.1.0",
|
|
24
24
|
"@contrast/common": "1.32.0",
|
|
25
|
-
"@contrast/config": "1.
|
|
26
|
-
"@contrast/core": "1.
|
|
27
|
-
"@contrast/dep-hooks": "1.
|
|
28
|
-
"@contrast/esm-hooks": "2.
|
|
29
|
-
"@contrast/instrumentation": "1.
|
|
30
|
-
"@contrast/logger": "1.
|
|
31
|
-
"@contrast/patcher": "1.
|
|
32
|
-
"@contrast/rewriter": "1.
|
|
33
|
-
"@contrast/scopes": "1.
|
|
25
|
+
"@contrast/config": "1.47.0",
|
|
26
|
+
"@contrast/core": "1.52.0",
|
|
27
|
+
"@contrast/dep-hooks": "1.21.0",
|
|
28
|
+
"@contrast/esm-hooks": "2.26.0",
|
|
29
|
+
"@contrast/instrumentation": "1.31.0",
|
|
30
|
+
"@contrast/logger": "1.25.0",
|
|
31
|
+
"@contrast/patcher": "1.24.0",
|
|
32
|
+
"@contrast/rewriter": "1.28.0",
|
|
33
|
+
"@contrast/scopes": "1.22.0",
|
|
34
34
|
"async-hook-domain": "^4.0.1",
|
|
35
35
|
"ipaddr.js": "^2.0.1",
|
|
36
36
|
"on-finished": "^2.4.1",
|