@contrast/agent 4.5.1 → 4.7.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.
Files changed (209) hide show
  1. package/bin/VERSION +1 -1
  2. package/bin/linux/contrast-service +0 -0
  3. package/bin/mac/contrast-service +0 -0
  4. package/bin/windows/contrast-service.exe +0 -0
  5. package/lib/assess/membrane/deserialization-membrane.js +4 -5
  6. package/lib/assess/membrane/source-membrane.js +16 -33
  7. package/lib/assess/models/call-context.js +1 -1
  8. package/lib/assess/policy/propagators.json +19 -21
  9. package/lib/assess/policy/rules.json +7 -2
  10. package/lib/assess/policy/signatures.json +42 -0
  11. package/lib/assess/policy/util.js +2 -1
  12. package/lib/assess/propagators/JSON/parse.js +1 -1
  13. package/lib/assess/propagators/JSON/stringify.js +3 -3
  14. package/lib/assess/propagators/array-prototype-join.js +7 -8
  15. package/lib/assess/propagators/common.js +7 -5
  16. package/lib/assess/propagators/dustjs/escape-html.js +22 -0
  17. package/lib/assess/propagators/dustjs/escape-js.js +22 -0
  18. package/lib/assess/propagators/encode-uri/encode-uri-component.js +22 -0
  19. package/lib/assess/propagators/encode-uri/encode-uri.js +22 -0
  20. package/lib/assess/propagators/handlebars-escape-expresssion.js +1 -1
  21. package/lib/assess/propagators/index.js +0 -2
  22. package/lib/assess/propagators/joi/boolean.js +1 -1
  23. package/lib/assess/propagators/joi/expression.js +1 -1
  24. package/lib/assess/propagators/joi/number.js +1 -1
  25. package/lib/assess/propagators/joi/string-base.js +1 -1
  26. package/lib/assess/propagators/joi/string-schema.js +12 -13
  27. package/lib/assess/propagators/joi/values.js +37 -22
  28. package/lib/assess/propagators/manager.js +12 -10
  29. package/lib/assess/propagators/mongoose/helpers.js +20 -0
  30. package/lib/assess/propagators/mongoose/index.js +18 -0
  31. package/lib/assess/propagators/mongoose/map.js +74 -0
  32. package/lib/assess/propagators/mongoose/string.js +104 -0
  33. package/lib/assess/propagators/mustache/escape.js +22 -0
  34. package/lib/assess/propagators/number.js +54 -0
  35. package/lib/assess/propagators/object.js +6 -7
  36. package/lib/assess/propagators/path/basename.js +14 -13
  37. package/lib/assess/propagators/path/common.js +156 -47
  38. package/lib/assess/propagators/path/dirname.js +14 -13
  39. package/lib/assess/propagators/path/extname.js +14 -13
  40. package/lib/assess/propagators/path/join.js +5 -1
  41. package/lib/assess/propagators/path/normalize.js +1 -2
  42. package/lib/assess/propagators/path/parse.js +1 -1
  43. package/lib/assess/propagators/path/relative.js +7 -5
  44. package/lib/assess/propagators/path/resolve.js +11 -2
  45. package/lib/assess/propagators/querystring/escape.js +20 -18
  46. package/lib/assess/propagators/querystring/parse.js +7 -5
  47. package/lib/assess/propagators/querystring/stringify.js +25 -24
  48. package/lib/assess/propagators/querystring/unescape.js +20 -18
  49. package/lib/assess/propagators/sequelize/sql-string-escape.js +1 -1
  50. package/lib/assess/propagators/sequelize/sql-string-format-named-parameters.js +1 -1
  51. package/lib/assess/propagators/sequelize/sql-string-format.js +3 -3
  52. package/lib/assess/propagators/sequelize/utils.js +2 -2
  53. package/lib/assess/propagators/string-prototype-replace.js +30 -28
  54. package/lib/assess/propagators/string-prototype-split.js +36 -36
  55. package/lib/assess/propagators/string-prototype-trim.js +15 -17
  56. package/lib/assess/propagators/string.js +12 -16
  57. package/lib/assess/propagators/template-escape.js +87 -0
  58. package/lib/assess/propagators/templates.js +10 -11
  59. package/lib/assess/propagators/url/url-prototype-parse.js +5 -6
  60. package/lib/assess/propagators/url/url-url.js +51 -43
  61. package/lib/assess/propagators/util/format.js +1 -1
  62. package/lib/assess/propagators/v8/init-hooks.js +3 -3
  63. package/lib/assess/propagators/validator/init-hooks.js +22 -22
  64. package/lib/assess/sinks/common.js +10 -5
  65. package/lib/assess/sinks/dustjs-linkedin-xss.js +131 -0
  66. package/lib/assess/sinks/libxmljs-xxe.js +1 -1
  67. package/lib/assess/sinks/mongodb.js +2 -1
  68. package/lib/assess/sinks/ssrf-url.js +1 -1
  69. package/lib/constants.js +4 -1
  70. package/lib/core/arch-components/dynamodb.js +1 -2
  71. package/lib/core/arch-components/dynamodbv3.js +44 -0
  72. package/lib/core/arch-components/index.js +1 -0
  73. package/lib/core/arch-components/rethinkdb.js +53 -0
  74. package/lib/core/config/options.js +3 -2
  75. package/lib/core/rewrite/injections.js +8 -0
  76. package/lib/core/stacktrace.js +2 -1
  77. package/lib/feature-set.js +1 -1
  78. package/lib/hooks/frameworks/base.js +8 -2
  79. package/lib/hooks/frameworks/http.js +23 -16
  80. package/lib/hooks/frameworks/http2.js +73 -0
  81. package/lib/hooks/frameworks/index.js +8 -3
  82. package/lib/hooks/http.js +112 -128
  83. package/lib/hooks/object-to-primitive.js +6 -7
  84. package/lib/hooks/patcher.js +75 -44
  85. package/lib/hooks/require.js +16 -22
  86. package/lib/instrumentation.js +0 -3
  87. package/lib/protect/rules/nosqli/nosql-injection-rule.js +228 -0
  88. package/lib/protect/rules/rule-factory.js +2 -2
  89. package/lib/protect/service.js +23 -11
  90. package/lib/protect/sinks/mongodb.js +56 -55
  91. package/lib/reporter/translations/to-protobuf/dtm/index.js +1 -1
  92. package/lib/reporter/translations/to-protobuf/dtm/ip-denylist-details.js +1 -1
  93. package/lib/reporter/translations/to-protobuf/dtm/rasp-rule-sample.js +1 -1
  94. package/lib/reporter/translations/to-protobuf/settings/defend-features.js +8 -6
  95. package/lib/reporter/translations/to-protobuf/settings/exclusions.js +5 -4
  96. package/lib/tracker.js +13 -65
  97. package/lib/util/some.js +27 -0
  98. package/lib/util/source-map.js +1 -1
  99. package/package.json +15 -16
  100. package/lib/hooks/frameworks/https.js +0 -42
  101. package/lib/protect/rules/nosqli/no-sql-injection-rule.js +0 -109
  102. package/node_modules/bindings/LICENSE.md +0 -22
  103. package/node_modules/bindings/README.md +0 -98
  104. package/node_modules/bindings/bindings.js +0 -221
  105. package/node_modules/bindings/package.json +0 -32
  106. package/node_modules/file-uri-to-path/.npmignore +0 -1
  107. package/node_modules/file-uri-to-path/.travis.yml +0 -30
  108. package/node_modules/file-uri-to-path/History.md +0 -21
  109. package/node_modules/file-uri-to-path/LICENSE +0 -20
  110. package/node_modules/file-uri-to-path/README.md +0 -74
  111. package/node_modules/file-uri-to-path/index.d.ts +0 -2
  112. package/node_modules/file-uri-to-path/index.js +0 -66
  113. package/node_modules/file-uri-to-path/package.json +0 -36
  114. package/node_modules/file-uri-to-path/test/test.js +0 -24
  115. package/node_modules/file-uri-to-path/test/tests.json +0 -13
  116. package/node_modules/glossy/LICENSE +0 -19
  117. package/node_modules/glossy/README.md +0 -129
  118. package/node_modules/glossy/index.js +0 -12
  119. package/node_modules/glossy/lib/glossy/parse.js +0 -520
  120. package/node_modules/glossy/lib/glossy/produce.js +0 -459
  121. package/node_modules/glossy/package.json +0 -47
  122. package/node_modules/glossy/test/decide.js +0 -7
  123. package/node_modules/glossy/test/decode_pri.js +0 -24
  124. package/node_modules/glossy/test/parse_3164.js +0 -104
  125. package/node_modules/glossy/test/parse_5424.js +0 -106
  126. package/node_modules/glossy/test/parse_5848.js +0 -40
  127. package/node_modules/glossy/test/parse_8601.js +0 -14
  128. package/node_modules/glossy/test/parse_rfc3339.js +0 -9
  129. package/node_modules/glossy/test/produce.js +0 -162
  130. package/node_modules/glossy/test/runner.js +0 -40
  131. package/node_modules/glossy/test/structure_data.js +0 -24
  132. package/node_modules/nan/CHANGELOG.md +0 -537
  133. package/node_modules/nan/LICENSE.md +0 -13
  134. package/node_modules/nan/README.md +0 -455
  135. package/node_modules/nan/doc/asyncworker.md +0 -146
  136. package/node_modules/nan/doc/buffers.md +0 -54
  137. package/node_modules/nan/doc/callback.md +0 -76
  138. package/node_modules/nan/doc/converters.md +0 -41
  139. package/node_modules/nan/doc/errors.md +0 -226
  140. package/node_modules/nan/doc/json.md +0 -62
  141. package/node_modules/nan/doc/maybe_types.md +0 -583
  142. package/node_modules/nan/doc/methods.md +0 -664
  143. package/node_modules/nan/doc/new.md +0 -147
  144. package/node_modules/nan/doc/node_misc.md +0 -123
  145. package/node_modules/nan/doc/object_wrappers.md +0 -263
  146. package/node_modules/nan/doc/persistent.md +0 -296
  147. package/node_modules/nan/doc/scopes.md +0 -73
  148. package/node_modules/nan/doc/script.md +0 -38
  149. package/node_modules/nan/doc/string_bytes.md +0 -62
  150. package/node_modules/nan/doc/v8_internals.md +0 -199
  151. package/node_modules/nan/doc/v8_misc.md +0 -85
  152. package/node_modules/nan/include_dirs.js +0 -1
  153. package/node_modules/nan/nan.h +0 -2898
  154. package/node_modules/nan/nan_callbacks.h +0 -88
  155. package/node_modules/nan/nan_callbacks_12_inl.h +0 -514
  156. package/node_modules/nan/nan_callbacks_pre_12_inl.h +0 -520
  157. package/node_modules/nan/nan_converters.h +0 -72
  158. package/node_modules/nan/nan_converters_43_inl.h +0 -68
  159. package/node_modules/nan/nan_converters_pre_43_inl.h +0 -42
  160. package/node_modules/nan/nan_define_own_property_helper.h +0 -29
  161. package/node_modules/nan/nan_implementation_12_inl.h +0 -430
  162. package/node_modules/nan/nan_implementation_pre_12_inl.h +0 -263
  163. package/node_modules/nan/nan_json.h +0 -166
  164. package/node_modules/nan/nan_maybe_43_inl.h +0 -356
  165. package/node_modules/nan/nan_maybe_pre_43_inl.h +0 -268
  166. package/node_modules/nan/nan_new.h +0 -340
  167. package/node_modules/nan/nan_object_wrap.h +0 -156
  168. package/node_modules/nan/nan_persistent_12_inl.h +0 -132
  169. package/node_modules/nan/nan_persistent_pre_12_inl.h +0 -242
  170. package/node_modules/nan/nan_private.h +0 -73
  171. package/node_modules/nan/nan_string_bytes.h +0 -305
  172. package/node_modules/nan/nan_typedarray_contents.h +0 -96
  173. package/node_modules/nan/nan_weak.h +0 -437
  174. package/node_modules/nan/package.json +0 -41
  175. package/node_modules/nan/tools/1to2.js +0 -412
  176. package/node_modules/nan/tools/README.md +0 -14
  177. package/node_modules/nan/tools/package.json +0 -19
  178. package/node_modules/unix-dgram/LICENSE +0 -13
  179. package/node_modules/unix-dgram/README.md +0 -107
  180. package/node_modules/unix-dgram/binding.gyp +0 -20
  181. package/node_modules/unix-dgram/build/Makefile +0 -324
  182. package/node_modules/unix-dgram/build/Release/.deps/Release/obj.target/unix_dgram/src/unix_dgram.o.d +0 -58
  183. package/node_modules/unix-dgram/build/Release/.deps/Release/obj.target/unix_dgram.node.d +0 -1
  184. package/node_modules/unix-dgram/build/Release/.deps/Release/unix_dgram.node.d +0 -1
  185. package/node_modules/unix-dgram/build/Release/obj.target/unix_dgram/src/unix_dgram.o +0 -0
  186. package/node_modules/unix-dgram/build/Release/obj.target/unix_dgram.node +0 -0
  187. package/node_modules/unix-dgram/build/Release/unix_dgram.node +0 -0
  188. package/node_modules/unix-dgram/build/binding.Makefile +0 -6
  189. package/node_modules/unix-dgram/build/config.gypi +0 -213
  190. package/node_modules/unix-dgram/build/unix_dgram.target.mk +0 -159
  191. package/node_modules/unix-dgram/lib/unix_dgram.js +0 -168
  192. package/node_modules/unix-dgram/package.json +0 -36
  193. package/node_modules/unix-dgram/src/unix_dgram.cc +0 -404
  194. package/node_modules/unix-dgram/src/win_dummy.cc +0 -7
  195. package/node_modules/unix-dgram/test/test-connect-callback.js +0 -68
  196. package/node_modules/unix-dgram/test/test-connect.js +0 -53
  197. package/node_modules/unix-dgram/test/test-dgram-unix.js +0 -58
  198. package/node_modules/unix-dgram/test/test-send-error.js +0 -26
  199. package/node_modules/winston-syslog/.eslintrc +0 -7
  200. package/node_modules/winston-syslog/.travis.yml +0 -14
  201. package/node_modules/winston-syslog/CHANGELOG.md +0 -9
  202. package/node_modules/winston-syslog/LICENSE +0 -20
  203. package/node_modules/winston-syslog/README.md +0 -135
  204. package/node_modules/winston-syslog/lib/utils.js +0 -26
  205. package/node_modules/winston-syslog/lib/winston-syslog.js +0 -385
  206. package/node_modules/winston-syslog/package.json +0 -56
  207. package/node_modules/winston-syslog/test/format-test.js +0 -122
  208. package/node_modules/winston-syslog/test/syslog-test.js +0 -95
  209. package/node_modules/winston-syslog/test/unix-connect-test.js +0 -133
package/bin/VERSION CHANGED
@@ -1 +1 @@
1
- 2.27.3
1
+ 2.28.5
Binary file
Binary file
Binary file
@@ -58,19 +58,18 @@ class DeserializationMembrane extends Membrane {
58
58
  });
59
59
 
60
60
  const tracked = tracker.track(str);
61
- const strData = tracker.getData(tracked);
62
61
 
63
- if (!strData.tracked) {
62
+ if (!tracked) {
64
63
  return str;
65
64
  }
66
65
 
67
- strData.event = event;
66
+ tracked.props.event = event;
68
67
  event.parents.push(this.event);
69
- strData.tagRanges = this.tagRanges.map(
68
+ tracked.props.tagRanges = this.tagRanges.map(
70
69
  (t) => new TagRange(0, str.length - 1, t.tag)
71
70
  );
72
71
 
73
- return tracked;
72
+ return tracked.str;
74
73
  }
75
74
  }
76
75
 
@@ -13,7 +13,6 @@ Copyright: 2021 Contrast Security, Inc
13
13
  way not consistent with the End User License Agreement.
14
14
  */
15
15
  'use strict';
16
- const _ = require('lodash');
17
16
 
18
17
  const logger = require('../../core/logger')('contrast:source-membrane');
19
18
  const Membrane = require('./index');
@@ -39,14 +38,6 @@ const signature = new Signature({
39
38
  isModule: false
40
39
  });
41
40
 
42
- const numericCheck = /^[0-9]+$/;
43
- function isNumeric(input) {
44
- // regex from validator.js/lib/isNumeric.js:
45
- // https://github.com/validatorjs/validator.js/blob/master/lib/isNumeric.js
46
- // do we want to allow symbols (plus/minus sign, decimal point?)
47
- return numericCheck.test(input);
48
- }
49
-
50
41
  module.exports = class SourceMembrane extends Membrane {
51
42
  /**
52
43
  * @param {object} config agent config to use for array sampling.
@@ -72,9 +63,7 @@ module.exports = class SourceMembrane extends Membrane {
72
63
  if (cfg.array_request_sampling) {
73
64
  this.sample = cfg.array_request_sampling.enable;
74
65
  this.sampleThreshold = cfg.array_request_sampling.threshold;
75
- this.sampleInterval = this.sample
76
- ? cfg.array_request_sampling.interval
77
- : 1;
66
+ this.sampleInterval = cfg.array_request_sampling.interval || 1;
78
67
  }
79
68
  // used when a reqSourceEvent must be created because an entire object
80
69
  // is being stringified but individual properties are not being referenced
@@ -147,7 +136,7 @@ module.exports = class SourceMembrane extends Membrane {
147
136
  if (!this.ensureMetadata(metadata)) {
148
137
  return str;
149
138
  }
150
- const tracked = tracker.track2(str);
139
+ const tracked = tracker.track(str);
151
140
  if (!tracked) {
152
141
  return str;
153
142
  }
@@ -304,8 +293,7 @@ module.exports = class SourceMembrane extends Membrane {
304
293
  /**
305
294
  * The `TagRanges` returned will include the `untrusted` tag. There will be
306
295
  * `exclusion:${ruleId}` tags for input exclusions pertaining to specific
307
- * rules and whose name matches the property name described in metadata. And
308
- * `limited-chars` tags are included if string is numeric.
296
+ * rules and whose name matches the property name described in metadata.
309
297
  * @param {string} str string being tracked by membrane
310
298
  * @param {object} metadata metadata about source type and key name
311
299
  * @returns {TagRange[]}
@@ -342,10 +330,6 @@ module.exports = class SourceMembrane extends Membrane {
342
330
  }
343
331
  }
344
332
 
345
- if (isNumeric(str)) {
346
- tagRanges.push(new TagRange(start, stop, 'limited-chars'));
347
- }
348
-
349
333
  if (metadata.sourceType === 'header') {
350
334
  if (metadata.path.toLocaleLowerCase() !== 'referer') {
351
335
  tagRanges.push(new TagRange(start, stop, 'header'));
@@ -368,11 +352,6 @@ module.exports = class SourceMembrane extends Membrane {
368
352
  wrapArray(arr, metadata) {
369
353
  metadata.isArray = true;
370
354
 
371
- // if not sampling, treat it as any object. not sampling has 100%
372
- // accuracy.
373
- if (!this.sample) {
374
- return super.wrapArray(arr, metadata);
375
- }
376
355
  // don't sample more than once
377
356
  if (this.wrappedArrays.has(arr)) {
378
357
  return arr;
@@ -380,16 +359,20 @@ module.exports = class SourceMembrane extends Membrane {
380
359
 
381
360
  const limit = Math.min(this.sampleThreshold, arr.length);
382
361
 
383
- for (let i = 0; i < limit; i++) {
384
- if (i % this.sampleInterval === 0 && arr[i]) {
385
- const m = _.cloneDeep(metadata);
386
- if (m.path) {
387
- m.path += `[${i}]`;
388
- } else {
389
- m.path = `[${i}]`;
362
+ // if not sampling, treat it as any object. not sampling has 100% accuracy.
363
+ if (!this.sample || (limit === arr.length && this.sampleInterval === 1)) {
364
+ return super.wrapObject(arr, metadata);
365
+ } else if (!this.sampleThreshold) {
366
+ return arr;
367
+ } else {
368
+ const origPath = metadata.path;
369
+ for (let i = 0; i < limit; i += this.sampleInterval) {
370
+ if (arr[i]) {
371
+ const m = Object.assign({}, metadata);
372
+ m.path = origPath ? `${origPath}[${i}]` : `[${i}]`;
373
+ const wrapped = this.wrap(arr[i], m);
374
+ arr[i] = wrapped;
390
375
  }
391
-
392
- arr[i] = this.wrap(arr[i], m);
393
376
  }
394
377
  }
395
378
 
@@ -96,7 +96,7 @@ module.exports = class CallContext {
96
96
  }
97
97
 
98
98
  static isTracked(str) {
99
- if (tracker.getData2(str)) {
99
+ if (tracker.getData(str)) {
100
100
  return true;
101
101
  }
102
102
  return !!(str && typeof str === 'object' && str[PROXY_TARGET]);
@@ -40,10 +40,18 @@
40
40
  "enabled": true,
41
41
  "override": "./propagators/JSON/parse.js"
42
42
  },
43
+ "mongoose": {
44
+ "enabled": true,
45
+ "override": "./propagators/mongoose"
46
+ },
43
47
  "String": {
44
48
  "enabled": true,
45
49
  "override": "./propagators/string.js"
46
50
  },
51
+ "Number": {
52
+ "enabled": true,
53
+ "override": "./propagators/number.js"
54
+ },
47
55
  "Object": {
48
56
  "enabled": true,
49
57
  "override": "./propagators/object.js"
@@ -59,13 +67,15 @@
59
67
  },
60
68
  "mustache.escape": {
61
69
  "enabled": true,
62
- "source": "P",
63
- "target": "R",
64
- "tags": ["html-encoded"],
65
- "type": "overload",
66
- "command": {
67
- "type": "keep"
68
- }
70
+ "provider": "./propagators/mustache/escape.js"
71
+ },
72
+ "dust.escapeHtml": {
73
+ "enabled": true,
74
+ "provider": "./propagators/dustjs/escape-html.js"
75
+ },
76
+ "dust.escapeJs": {
77
+ "enabled": true,
78
+ "provider": "./propagators/dustjs/escape-js.js"
69
79
  },
70
80
  "pug.compile": {
71
81
  "enabled": true,
@@ -329,23 +339,11 @@
329
339
  },
330
340
  "encodeURI": {
331
341
  "enabled": true,
332
- "type": "overload",
333
- "tags": ["weak-url-encoded"],
334
- "source": "P",
335
- "target": "R",
336
- "command": {
337
- "type": "keep"
338
- }
342
+ "provider": "./propagators/encode-uri/encode-uri.js"
339
343
  },
340
344
  "encodeURIComponent": {
341
345
  "enabled": true,
342
- "type": "overload",
343
- "tags": ["url-encoded"],
344
- "source": "P",
345
- "target": "R",
346
- "command": {
347
- "type": "keep"
348
- }
346
+ "provider": "./propagators/encode-uri/encode-uri-component.js"
349
347
  },
350
348
  "process.__add": {
351
349
  "enabled": true,
@@ -1157,7 +1157,7 @@
1157
1157
  "args": [
1158
1158
  {
1159
1159
  "index": 0,
1160
- "disallowedTags": ["limited-chars", "alphanum-space-hyphen"],
1160
+ "disallowedTags": ["limited-chars", "alphanum-space-hyphen", "custom-validated-nosql-injection"],
1161
1161
  "requiredTags": ["untrusted"]
1162
1162
  }
1163
1163
  ]
@@ -1172,7 +1172,7 @@
1172
1172
  "args": [
1173
1173
  {
1174
1174
  "index": 0,
1175
- "disallowedTags": [],
1175
+ "disallowedTags": ["custom-validated-nosql-injection"],
1176
1176
  "requiredTags": ["untrusted"]
1177
1177
  }
1178
1178
  ]
@@ -1371,6 +1371,11 @@
1371
1371
  "type": "http",
1372
1372
  "provider": "./sinks/hapi-16-xss"
1373
1373
  },
1374
+ "reflected-xss_dustjs-linkedin": {
1375
+ "enabled": true,
1376
+ "type": "http",
1377
+ "provider": "./sinks/dustjs-linkedin-xss"
1378
+ },
1374
1379
  "reflected-xss": {
1375
1380
  "enabled": true,
1376
1381
  "type": "hook",
@@ -20,6 +20,11 @@
20
20
  "methodName": "domainToUnicode",
21
21
  "isModule": true
22
22
  },
23
+ "template strings": {
24
+ "moduleName": "global",
25
+ "methodName": "ContrastMethods.__contrastTag",
26
+ "isModule": false
27
+ },
23
28
  "axios": {
24
29
  "moduleName": "axios",
25
30
  "methodName": "",
@@ -233,6 +238,16 @@
233
238
  "methodName": "escape",
234
239
  "isModule": true
235
240
  },
241
+ "dust.escapeHtml": {
242
+ "moduleName": "dustjs-linkedin",
243
+ "methodName": "escapeHtml",
244
+ "isModule": true
245
+ },
246
+ "dust.escapeJs": {
247
+ "moduleName": "dustjs-linkedin",
248
+ "methodName": "escapeJs",
249
+ "isModule": true
250
+ },
236
251
  "express.response.send": {
237
252
  "moduleName": "express",
238
253
  "version": ">=4.0.0",
@@ -632,6 +647,11 @@
632
647
  "methodName": "toNamespacedPath",
633
648
  "isModule": true
634
649
  },
650
+ "path.normalize": {
651
+ "moduleName": "path",
652
+ "methodName": "normalize",
653
+ "isModule": true
654
+ },
635
655
  "util.format": {
636
656
  "moduleName": "util",
637
657
  "methodName": "format",
@@ -1298,6 +1318,18 @@
1298
1318
  "methodName": "string.domain",
1299
1319
  "isModule": true
1300
1320
  },
1321
+ "mongoose.string.doValidateSync": {
1322
+ "moduleName": "mongoose",
1323
+ "version": ">=5.0.0",
1324
+ "methodName": "mongoose.string.doValidateSync",
1325
+ "isModule": true
1326
+ },
1327
+ "mongoose.map.doValidateSync": {
1328
+ "moduleName": "mongoose",
1329
+ "version": ">=5.0.0",
1330
+ "methodName": "mongoose.map.doValidateSync",
1331
+ "isModule": true
1332
+ },
1301
1333
  "v8.deserialize.serialize": {
1302
1334
  "moduleName": "v8",
1303
1335
  "methodName": "deserialize.serialize",
@@ -1307,6 +1339,16 @@
1307
1339
  "moduleName": "node-serialize",
1308
1340
  "methodName": "unserialize",
1309
1341
  "isModule": true
1342
+ },
1343
+ "dustjs-linkedin": {
1344
+ "moduleName": "dustjs-linkedin",
1345
+ "methodName": "pipe",
1346
+ "isModule": true
1347
+ },
1348
+ "Number": {
1349
+ "moduleName": "Number",
1350
+ "methodName": "isNaN",
1351
+ "isModule": false
1310
1352
  }
1311
1353
  }
1312
1354
  }
@@ -89,6 +89,7 @@ utils.isRuleEnabled = function(ruleId) {
89
89
  * @param {boolean} enabled What to set the enabled property to
90
90
  */
91
91
  utils.setEnabled = function(node, enabled) {
92
+ /*eslint no-prototype-builtins: "warn"*/
92
93
  if (node.hasOwnProperty('enabled')) {
93
94
  node.enabled = enabled;
94
95
  return true;
@@ -236,7 +237,7 @@ utils.patchRecursive = function(obj, hookOptions, depth) {
236
237
  }
237
238
  }
238
239
  } catch (e) {
239
- logger.info(`unable to recurisvely patch ${e}`);
240
+ logger.info(`unable to recursively patch ${e}`);
240
241
  }
241
242
 
242
243
  return obj;
@@ -41,7 +41,7 @@ module.exports.handle = function() {
41
41
  name: ContrastJSON.name,
42
42
  patchType: PATCH_TYPES.ASSESS_PROPAGATOR,
43
43
  post(data) {
44
- const props = tracker.getData2(data.args[0]);
44
+ const props = tracker.getData(data.args[0]);
45
45
  const { result } = data;
46
46
  if (props && result) {
47
47
  const membrane = new DeserializationMembrane(data, props);
@@ -64,7 +64,7 @@ function getUntrustedSpaceProps(space) {
64
64
  }
65
65
  // otherwise if the space string is tracked then the entire json output inherits
66
66
  // the tracked string's tags.
67
- const props = tracker.getData2(space);
67
+ const props = tracker.getData(space);
68
68
  if (!props || props.tagRanges.length === 0) {
69
69
  return null;
70
70
  }
@@ -185,7 +185,7 @@ module.exports.handle = function() {
185
185
  */
186
186
  function contrastReplacer(key, val) {
187
187
  let isTracked = false;
188
- const valProperties = tracker.getData2(val);
188
+ const valProperties = tracker.getData(val);
189
189
  if (valProperties && valProperties.tagRanges.length) {
190
190
  data.metadata.propagate = true;
191
191
  isTracked = true;
@@ -256,7 +256,7 @@ module.exports.handle = function() {
256
256
  }
257
257
  }
258
258
 
259
- const tracked = tracker.track2(data.result);
259
+ const tracked = tracker.track(data.result);
260
260
  if (!tracked) {
261
261
  return data.result;
262
262
  }
@@ -27,7 +27,7 @@ module.exports.handle = function handle(data) {
27
27
  return;
28
28
  }
29
29
 
30
- // this handles join() andd join(undefined)
30
+ // this handles join() and join(undefined)
31
31
  const del = data.args[0] === undefined ? ',' : data.args[0];
32
32
 
33
33
  const parentEvents = [];
@@ -38,7 +38,7 @@ module.exports.handle = function handle(data) {
38
38
 
39
39
  let delimiterTracked = false;
40
40
 
41
- if (delimiterProperties.tracked) {
41
+ if (delimiterProperties) {
42
42
  delimiterTracked = true;
43
43
  parentEvents.push(delimiterProperties.event);
44
44
  delimiterTagRanges.push(...delimiterProperties.tagRanges);
@@ -56,21 +56,20 @@ module.exports.handle = function handle(data) {
56
56
 
57
57
  if (delimiterTracked || elementTracked) {
58
58
  const tracked = tracker.track(data.result);
59
- const metadata = tracker.getData(tracked);
60
- if (!metadata.tracked) {
59
+ if (!tracked) {
61
60
  return;
62
61
  }
63
62
 
64
- metadata.event = createEvent(
63
+ tracked.props.event = createEvent(
65
64
  data,
66
65
  resultTagRanges,
67
66
  parentEvents,
68
67
  delimiterTracked,
69
68
  elementTracked
70
69
  );
71
- metadata.tagRanges = resultTagRanges;
70
+ tracked.props.tagRanges = resultTagRanges;
72
71
 
73
- data.result = tracked;
72
+ data.result = tracked.str;
74
73
  }
75
74
  };
76
75
 
@@ -98,7 +97,7 @@ function propagateArrayData(
98
97
  const elem = array[i];
99
98
  const elemProperties = tracker.getData(elem);
100
99
 
101
- if (elem && elemProperties.tracked) {
100
+ if (elem && elemProperties) {
102
101
  parentEvents.push(elemProperties.event);
103
102
 
104
103
  targetData.elementTracked = true;
@@ -62,7 +62,7 @@ const escapeRegExp = (str) => {
62
62
  */
63
63
  const addTagRangesWithOffset = (metadata, arg) => {
64
64
  const argData = tracker.getData(arg);
65
- if (argData.tracked) {
65
+ if (argData) {
66
66
  tagRangeUtil.addAllWithOffsetInPlace(
67
67
  metadata.tagRanges,
68
68
  argData.tagRanges,
@@ -115,10 +115,12 @@ const createEvent = ({ tagRanges, method, parents }, data) => {
115
115
  */
116
116
  const trackResult = (metadata, data) => {
117
117
  if (metadata.tagRanges.length) {
118
- data.result = tracker.track(data.result);
119
- const trackedMeta = tracker.getData(data.result);
120
- trackedMeta.tagRanges = metadata.tagRanges;
121
- trackedMeta.event = createEvent(metadata, data);
118
+ const tracked = tracker.track(data.result);
119
+ if (tracked) {
120
+ tracked.props.tagRanges = metadata.tagRanges;
121
+ tracked.props.event = createEvent(metadata, data);
122
+ data.result = tracked.str;
123
+ }
122
124
  }
123
125
  };
124
126
 
@@ -0,0 +1,22 @@
1
+ /**
2
+ Copyright: 2021 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
+ 'use strict';
16
+ const { propagate } = require('../template-escape');
17
+
18
+ function handler(data) {
19
+ propagate(data, 'html-encoded', 'dustjs-linkedin.escapeHtml');
20
+ }
21
+
22
+ module.exports.handle = handler;
@@ -0,0 +1,22 @@
1
+ /**
2
+ Copyright: 2021 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
+ 'use strict';
16
+ const { propagate } = require('../template-escape');
17
+
18
+ function handler(data) {
19
+ propagate(data, 'javascript-encoded', 'dustjs-linkedin.escapeJs');
20
+ }
21
+
22
+ module.exports.handle = handler;
@@ -0,0 +1,22 @@
1
+ /**
2
+ Copyright: 2021 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
+ 'use strict';
16
+ const { propagate } = require('../template-escape');
17
+
18
+ function handler(data) {
19
+ propagate(data, 'url-encoded', 'global.encodeURIComponent');
20
+ }
21
+
22
+ module.exports.handle = handler;
@@ -0,0 +1,22 @@
1
+ /**
2
+ Copyright: 2021 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
+ 'use strict';
16
+ const { propagate } = require('../template-escape');
17
+
18
+ function handler(data) {
19
+ propagate(data, 'weak-url-encoded', 'global.encodeURI');
20
+ }
21
+
22
+ module.exports.handle = handler;
@@ -48,7 +48,7 @@ function patchUtilsExport(utilsExport) {
48
48
  alwaysRun: true,
49
49
  post(data) {
50
50
  const trackData = tracker.getData(data.result);
51
- if (trackData.tracked) {
51
+ if (trackData) {
52
52
  trackData.tagRanges = tagRangeUtil.add(
53
53
  trackData.tagRanges,
54
54
  new TagRange(0, data.result.length - 1, 'html-encoded')
@@ -128,8 +128,6 @@ const generateHookWrappers = (agent, policyNode, key) => {
128
128
  } else {
129
129
  ({ pre, post } = provider.handle);
130
130
  }
131
-
132
- propagatorDescriptor.provider = provider.handle;
133
131
  } else {
134
132
  // generic propagator
135
133
  post = new Propagator(agent, propagatorDescriptor);
@@ -42,7 +42,7 @@ function instrumentJoiBoolean(boolean) {
42
42
  if (
43
43
  data.result &&
44
44
  typeof data.result.value === 'boolean' &&
45
- trackingData.tracked
45
+ trackingData
46
46
  ) {
47
47
  const { event } = trackingData;
48
48
  trackingData.tagRanges = tagRangeUtil.add(
@@ -32,7 +32,7 @@ function instrumentJoiExpression(expression) {
32
32
  patchType: ASSESS_PROPAGATOR,
33
33
  post(data) {
34
34
  const trackingData = tracker.getData(data.args[0]);
35
- if (trackingData.tracked && data.result._template) {
35
+ if (trackingData && data.result._template) {
36
36
  trackingData.tagRanges = tagRangeUtil.add(
37
37
  trackingData.tagRanges,
38
38
  new TagRange(0, data.args[0].length - 1, 'html-encoded')
@@ -41,7 +41,7 @@ function instrumentJoiNumber(number) {
41
41
  data.result &&
42
42
  data.result.value &&
43
43
  !data.result.errors &&
44
- trackingData.tracked
44
+ trackingData
45
45
  ) {
46
46
  const { event } = trackingData;
47
47
  trackingData.tagRanges = tagRangeUtil.add(
@@ -37,7 +37,7 @@ function instrumentJoiString(string) {
37
37
  patchType: ASSESS_PROPAGATOR,
38
38
  post(data) {
39
39
  const trackingData = tracker.getData(data.args[0]);
40
- if (data.result === undefined && trackingData.tracked) {
40
+ if (data.result === undefined && trackingData) {
41
41
  const { event } = trackingData;
42
42
  trackingData.tagRanges = tagRangeUtil.add(
43
43
  trackingData.tagRanges,