@contrast/protect 1.56.0 → 1.58.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/error-handlers/install/express.js +3 -0
- package/lib/get-source-context.js +2 -0
- package/lib/index.js +12 -2
- package/lib/input-analysis/handlers.js +581 -578
- package/lib/input-analysis/index.js +1 -1
- package/lib/input-tracing/handlers/index.js +1 -1
- package/lib/input-tracing/install/fs.js +1 -1
- package/lib/make-source-context.js +7 -1
- package/package.json +11 -11
|
@@ -21,7 +21,7 @@ module.exports = function(core) {
|
|
|
21
21
|
const inputAnalysis = core.protect.inputAnalysis = {};
|
|
22
22
|
|
|
23
23
|
// inputAnalysis handlers
|
|
24
|
-
require('./handlers')
|
|
24
|
+
core.initComponentSync(require('./handlers'));
|
|
25
25
|
|
|
26
26
|
// http(s) modules instrumentation
|
|
27
27
|
require('./install/http')(core);
|
|
@@ -328,7 +328,7 @@ module.exports = function(core) {
|
|
|
328
328
|
* @returns {AnalysisResult[]}
|
|
329
329
|
*/
|
|
330
330
|
function getResultsByRuleId(ruleId, context) {
|
|
331
|
-
if (context.policy[ruleId] === OFF) {
|
|
331
|
+
if (!context.policy || context.policy[ruleId] === OFF) {
|
|
332
332
|
return;
|
|
333
333
|
}
|
|
334
334
|
// because agent-lib stores all nosql-injection results under nosql-injection-mongo
|
|
@@ -36,7 +36,7 @@ module.exports = function init(core) {
|
|
|
36
36
|
// obtain the Protect sourceContext
|
|
37
37
|
const sourceContext = core.protect.getSourceContext();
|
|
38
38
|
|
|
39
|
-
if (!sourceContext) return;
|
|
39
|
+
if (!sourceContext || sourceContext.allowed) return;
|
|
40
40
|
|
|
41
41
|
// build list of values on which to perform INPUT TRACING
|
|
42
42
|
const values = getValues(indices, args);
|
|
@@ -22,7 +22,13 @@ module.exports = function(core) {
|
|
|
22
22
|
protect: { getPolicy }
|
|
23
23
|
} = core;
|
|
24
24
|
|
|
25
|
+
const disabledPolicy = { allowed: true };
|
|
26
|
+
|
|
25
27
|
function makeSourceContext(req, res) {
|
|
28
|
+
if (!core.config.getEffectiveValue('protect.enable')) {
|
|
29
|
+
return disabledPolicy;
|
|
30
|
+
}
|
|
31
|
+
|
|
26
32
|
// make the abstract request. it is an abstraction of a request that
|
|
27
33
|
// contains only the pieces of the request required by handlers. this
|
|
28
34
|
// is done to make an explicit contract for data that is required by
|
|
@@ -47,7 +53,7 @@ module.exports = function(core) {
|
|
|
47
53
|
|
|
48
54
|
// URL exclusions can disable all rules
|
|
49
55
|
if (!policy || policy.rulesMask === 0) {
|
|
50
|
-
return
|
|
56
|
+
return disabledPolicy;
|
|
51
57
|
}
|
|
52
58
|
|
|
53
59
|
// lowercase header keys and capture content-type
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contrast/protect",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.58.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)",
|
|
@@ -21,16 +21,16 @@
|
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"@contrast/agent-lib": "^9.1.0",
|
|
24
|
-
"@contrast/common": "1.
|
|
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.
|
|
24
|
+
"@contrast/common": "1.32.0",
|
|
25
|
+
"@contrast/config": "1.44.0",
|
|
26
|
+
"@contrast/core": "1.49.0",
|
|
27
|
+
"@contrast/dep-hooks": "1.18.0",
|
|
28
|
+
"@contrast/esm-hooks": "2.23.0",
|
|
29
|
+
"@contrast/instrumentation": "1.28.0",
|
|
30
|
+
"@contrast/logger": "1.22.0",
|
|
31
|
+
"@contrast/patcher": "1.21.0",
|
|
32
|
+
"@contrast/rewriter": "1.25.0",
|
|
33
|
+
"@contrast/scopes": "1.19.0",
|
|
34
34
|
"async-hook-domain": "^4.0.1",
|
|
35
35
|
"ipaddr.js": "^2.0.1",
|
|
36
36
|
"on-finished": "^2.4.1",
|