@contrast/agent 4.22.1 → 4.23.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.
@@ -331,7 +331,9 @@ module.exports.handle = function() {
331
331
  // always exist, even if an empty array, for production code.
332
332
  if (metadata.sourceEvents && !metadata.sourceEvents.length) {
333
333
  const { sourceEvents, braned } = data.metadata;
334
- if (braned) {
334
+ // If it is a source membrane (could be deserialization membrane), then
335
+ // we need to get a source event.
336
+ if (braned && braned.membrane && braned.membrane.makeReqSourceEvent) {
335
337
  sourceEvents.push(
336
338
  braned.membrane.makeReqSourceEvent(data.result.length)
337
339
  );
@@ -44,7 +44,7 @@ const KEYS = {
44
44
  REQUEST: 'request',
45
45
  REQ: 'req',
46
46
  RES: 'res',
47
- RESPONSE_CONTENT_TYPE: 'res.contentType',
47
+ RESPONSE_CONTENT_TYPE: 'response.contentType',
48
48
  ROUTE: 'route',
49
49
  RULES: 'defend.rules',
50
50
  SAMPLES: 'defend.samples',
@@ -29,15 +29,19 @@ module.exports = function Finding(details = {}) {
29
29
  }
30
30
 
31
31
  const routes = RoutesListWithObservations(details.routes);
32
+ const properties = objToMap(details.properties).map(
33
+ // ensure string values
34
+ ([key, value]) => [key, String(value)]
35
+ );
32
36
 
33
37
  return new dtm.Finding({
34
- 0: String(details.hash || ''), // 1 hash_code
35
- 2: details.ruleId, // 3 rule_id
36
- 5: objToMap(details.properties), // 6 properties
37
- 6: mapToModelArray(TraceEvent, details.events), // 7 events
38
- 7: preflight, // 8 preflight
39
- 8: details.tags, // 9 tags
40
- 9: details.version, // 10 version
38
+ 0: String(details.hash || ''), // 1 hash_code
39
+ 2: details.ruleId, // 3 rule_id
40
+ 5: properties, // 6 properties
41
+ 6: mapToModelArray(TraceEvent, details.events), // 7 events
42
+ 7: preflight, // 8 preflight
43
+ 8: details.tags, // 9 tags
44
+ 9: details.version, // 10 version
41
45
  10: routes // 11 routes
42
46
  });
43
47
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contrast/agent",
3
- "version": "4.22.1",
3
+ "version": "4.23.0",
4
4
  "description": "Node.js security instrumentation by Contrast Security",
5
5
  "keywords": [
6
6
  "security",
@@ -163,7 +163,7 @@
163
163
  "mock-fs": "^5.1.2",
164
164
  "mongodb": "file:test/mock/mongodb",
165
165
  "mongodb-npm": "npm:mongodb@^3.6.5",
166
- "mongoose": "^6.1.1",
166
+ "mongoose": "^6.4.6",
167
167
  "mustache": "^3.0.1",
168
168
  "mysql": "file:test/mock/mysql",
169
169
  "mysql2": "file:test/mock/mysql2",