@contrast/assess 1.52.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.
Files changed (84) hide show
  1. package/lib/crypto-analysis/install/math.js +0 -1
  2. package/lib/dataflow/propagation/common.js +6 -6
  3. package/lib/dataflow/propagation/install/JSON/parse.js +7 -3
  4. package/lib/dataflow/propagation/install/JSON/stringify.js +7 -6
  5. package/lib/dataflow/propagation/install/array-prototype-join.js +5 -8
  6. package/lib/dataflow/propagation/install/buffer.js +4 -4
  7. package/lib/dataflow/propagation/install/contrast-methods/add.js +42 -38
  8. package/lib/dataflow/propagation/install/contrast-methods/string.js +4 -2
  9. package/lib/dataflow/propagation/install/contrast-methods/tag.js +3 -1
  10. package/lib/dataflow/propagation/install/decode-uri-component.js +5 -7
  11. package/lib/dataflow/propagation/install/ejs/escape-xml.js +4 -3
  12. package/lib/dataflow/propagation/install/ejs/template.js +1 -1
  13. package/lib/dataflow/propagation/install/encode-uri.js +5 -7
  14. package/lib/dataflow/propagation/install/escape-html.js +4 -3
  15. package/lib/dataflow/propagation/install/escape.js +5 -7
  16. package/lib/dataflow/propagation/install/handlebars-utils-escape-expression.js +4 -3
  17. package/lib/dataflow/propagation/install/joi/boolean.js +1 -3
  18. package/lib/dataflow/propagation/install/joi/expression.js +1 -3
  19. package/lib/dataflow/propagation/install/joi/number.js +1 -3
  20. package/lib/dataflow/propagation/install/joi/string-schema.js +2 -6
  21. package/lib/dataflow/propagation/install/joi/utils.js +2 -4
  22. package/lib/dataflow/propagation/install/joi/values.js +1 -3
  23. package/lib/dataflow/propagation/install/mongoose/schema-map.js +1 -3
  24. package/lib/dataflow/propagation/install/mongoose/schema-mixed.js +1 -3
  25. package/lib/dataflow/propagation/install/mongoose/schema-string.js +4 -5
  26. package/lib/dataflow/propagation/install/mustache-escape.js +4 -3
  27. package/lib/dataflow/propagation/install/mysql-connection-escape.js +9 -8
  28. package/lib/dataflow/propagation/install/path/basename.js +6 -7
  29. package/lib/dataflow/propagation/install/path/common.js +1 -0
  30. package/lib/dataflow/propagation/install/path/dirname.js +6 -8
  31. package/lib/dataflow/propagation/install/path/extname.js +8 -22
  32. package/lib/dataflow/propagation/install/path/format.js +6 -10
  33. package/lib/dataflow/propagation/install/path/join-and-resolve.js +7 -13
  34. package/lib/dataflow/propagation/install/path/normalize.js +8 -18
  35. package/lib/dataflow/propagation/install/path/parse.js +8 -18
  36. package/lib/dataflow/propagation/install/path/relative.js +8 -15
  37. package/lib/dataflow/propagation/install/path/toNamespacedPath.js +7 -18
  38. package/lib/dataflow/propagation/install/pug/index.js +1 -1
  39. package/lib/dataflow/propagation/install/pug-runtime-escape.js +6 -5
  40. package/lib/dataflow/propagation/install/querystring/escape.js +3 -1
  41. package/lib/dataflow/propagation/install/querystring/parse.js +3 -2
  42. package/lib/dataflow/propagation/install/querystring/stringify.js +4 -4
  43. package/lib/dataflow/propagation/install/reg-exp-prototype-exec.js +4 -3
  44. package/lib/dataflow/propagation/install/sequelize/query-generator.js +0 -1
  45. package/lib/dataflow/propagation/install/sequelize/sql-string.js +16 -17
  46. package/lib/dataflow/propagation/install/sql-template-strings.js +6 -10
  47. package/lib/dataflow/propagation/install/string/concat.js +4 -4
  48. package/lib/dataflow/propagation/install/string/format-methods.js +4 -4
  49. package/lib/dataflow/propagation/install/string/html-methods.js +5 -6
  50. package/lib/dataflow/propagation/install/string/index.js +4 -3
  51. package/lib/dataflow/propagation/install/string/match-all.js +7 -6
  52. package/lib/dataflow/propagation/install/string/match.js +10 -9
  53. package/lib/dataflow/propagation/install/string/replace.js +5 -6
  54. package/lib/dataflow/propagation/install/string/slice.js +4 -3
  55. package/lib/dataflow/propagation/install/string/split.js +11 -11
  56. package/lib/dataflow/propagation/install/string/substring.js +4 -3
  57. package/lib/dataflow/propagation/install/string/trim.js +4 -3
  58. package/lib/dataflow/propagation/install/unescape.js +6 -14
  59. package/lib/dataflow/propagation/install/url/domain-parsers.js +6 -5
  60. package/lib/dataflow/propagation/install/url/parse.js +17 -17
  61. package/lib/dataflow/propagation/install/url/searchParams.js +36 -25
  62. package/lib/dataflow/propagation/install/url/url.js +3 -2
  63. package/lib/dataflow/propagation/install/util-format.js +4 -3
  64. package/lib/dataflow/propagation/install/validator/hooks.js +0 -1
  65. package/lib/dataflow/sinks/install/eval.js +3 -1
  66. package/lib/dataflow/sinks/install/fastify/unvalidated-redirect.js +1 -1
  67. package/lib/dataflow/sinks/install/function.js +3 -4
  68. package/lib/dataflow/sinks/install/marsdb.js +3 -1
  69. package/lib/dataflow/sinks/install/mongodb.js +3 -1
  70. package/lib/dataflow/sinks/install/mssql.js +4 -3
  71. package/lib/dataflow/sinks/install/mysql.js +3 -1
  72. package/lib/dataflow/sinks/install/restify.js +3 -1
  73. package/lib/dataflow/sinks/install/sqlite3.js +4 -2
  74. package/lib/dataflow/sinks/install/vm.js +6 -4
  75. package/lib/dataflow/sources/handler.js +2 -3
  76. package/lib/dataflow/sources/install/fastify/fastify.js +5 -5
  77. package/lib/dataflow/tag-utils.js +15 -1
  78. package/lib/dataflow/tracker.js +0 -5
  79. package/lib/event-factory.js +1 -1
  80. package/lib/session-configuration/install/express-session.js +0 -1
  81. package/lib/session-configuration/install/fastify-cookie.js +0 -3
  82. package/lib/session-configuration/install/hapi.js +0 -1
  83. package/lib/session-configuration/install/koa.js +0 -3
  84. package/package.json +10 -10
@@ -67,7 +67,7 @@ module.exports = function (core) {
67
67
  },
68
68
  target: 'R',
69
69
  stacktraceOpts: {
70
- prependFrames: [data.orig],
70
+ constructorOpt: data.hooked
71
71
  },
72
72
  });
73
73
 
@@ -110,7 +110,7 @@ module.exports = function (core) {
110
110
  },
111
111
  target: 'R',
112
112
  stacktraceOpts: {
113
- prependFrames: [data.orig],
113
+ constructorOpt: data.hooked
114
114
  },
115
115
  });
116
116
 
@@ -269,9 +269,8 @@ module.exports = function (core) {
269
269
  : {}),
270
270
  },
271
271
  target: 'P0',
272
- stacktraceOpts: {
273
- prependFrames: [orig],
274
- },
272
+ // todo
273
+ // stacktraceOpts:
275
274
  });
276
275
 
277
276
  if (!event) {
@@ -40,7 +40,7 @@ module.exports = function(core) {
40
40
  patchType,
41
41
  usePerf: 'sync',
42
42
  post(data) {
43
- const { args, result, hooked, orig } = data;
43
+ const { args, result, hooked } = data;
44
44
  if (!result || !args[0] || !getPropagatorContext()) return;
45
45
 
46
46
  const argInfo = tracker.getData(args[0]);
@@ -57,7 +57,9 @@ module.exports = function(core) {
57
57
  name,
58
58
  moduleName: 'mustache',
59
59
  methodName: 'escape',
60
- context: `mustache.escape(${argInfo.value})`,
60
+ get context() {
61
+ return `mustache.escape(${argInfo.value})`;
62
+ },
61
63
  object: {
62
64
  value: 'mustache',
63
65
  tracked: false
@@ -74,7 +76,6 @@ module.exports = function(core) {
74
76
  addedTags: [HTML_ENCODED],
75
77
  stacktraceOpts: {
76
78
  constructorOpt: hooked,
77
- prependFrames: [orig]
78
79
  },
79
80
  });
80
81
 
@@ -17,7 +17,7 @@
17
17
 
18
18
  const { DataflowTag: { SQL_ENCODED } } = require('@contrast/common');
19
19
  const { createFullLengthCopyTags } = require('../../tag-utils');
20
- const { patchType, createModuleLabel } = require('../common');
20
+ const { patchType } = require('../common');
21
21
 
22
22
  module.exports = function(core) {
23
23
  const {
@@ -32,7 +32,7 @@ module.exports = function(core) {
32
32
 
33
33
  function createPostHook(eventName, objectValue) {
34
34
  return function(data) {
35
- const { args, result, hooked, orig } = data;
35
+ const { args, result, hooked } = data;
36
36
  if (!result || !args[0] || !getPropagatorContext()) return;
37
37
 
38
38
  const argInfo = tracker.getData(args[0]);
@@ -49,7 +49,9 @@ module.exports = function(core) {
49
49
  name: eventName,
50
50
  moduleName: 'mysql',
51
51
  methodName: 'escape',
52
- context: `mysql.escape('${argInfo.value}')`,
52
+ get context() {
53
+ return `mysql.escape('${argInfo.value}')`;
54
+ },
53
55
  object: {
54
56
  value: objectValue,
55
57
  tracked: false
@@ -66,7 +68,6 @@ module.exports = function(core) {
66
68
  target: 'R',
67
69
  stacktraceOpts: {
68
70
  constructorOpt: hooked,
69
- prependFrames: [orig]
70
71
  },
71
72
  });
72
73
 
@@ -92,7 +93,7 @@ module.exports = function(core) {
92
93
  name: 'mysql.escape',
93
94
  patchType,
94
95
  usePerf: 'sync',
95
- post: createPostHook('mysql.escape', `${createModuleLabel('mysql', version)}`)
96
+ post: createPostHook('mysql.escape', 'mysql')
96
97
  });
97
98
  });
98
99
 
@@ -101,7 +102,7 @@ module.exports = function(core) {
101
102
  name: 'mysql.Connection.prototype.escape',
102
103
  patchType,
103
104
  usePerf: 'sync',
104
- post: createPostHook('mysql/lib/Connection.escape', `[${createModuleLabel('mysql', version)}].Connection`)
105
+ post: createPostHook('mysql/lib/Connection.escape', 'mysql.Connection')
105
106
  });
106
107
  });
107
108
 
@@ -111,7 +112,7 @@ module.exports = function(core) {
111
112
  name: 'mysql2.escape',
112
113
  patchType,
113
114
  usePerf: 'sync',
114
- post: createPostHook('mysql2.escape', `${createModuleLabel('mysql2', version)}`)
115
+ post: createPostHook('mysql2.escape', 'mysql2')
115
116
  });
116
117
  });
117
118
 
@@ -120,7 +121,7 @@ module.exports = function(core) {
120
121
  name: 'mysql2.Connection.prototype.escape',
121
122
  patchType,
122
123
  usePerf: 'sync',
123
- post: createPostHook('mysql2/lib/connection.Connection.escape', `[${createModuleLabel('mysql2', version)}].Connection`)
124
+ post: createPostHook('mysql2/lib/connection.Connection.escape', 'mysql2.Connection')
124
125
  });
125
126
  });
126
127
  },
@@ -17,6 +17,7 @@
17
17
 
18
18
  const { isString, primordials: { ArrayPrototypeJoin } } = require('@contrast/common');
19
19
  const { patchType } = require('../../common');
20
+ const { pathObject: object } = require('./common');
20
21
  const { excludeExtensionDotFromTags, createBasenameTagsInResult } = require('./common');
21
22
 
22
23
  module.exports = function(core) {
@@ -41,7 +42,7 @@ module.exports = function(core) {
41
42
  patchType,
42
43
  usePerf: 'sync',
43
44
  post(data) {
44
- const { args: origArgs, result, name, hooked, orig } = data;
45
+ const { args: origArgs, result, name, hooked } = data;
45
46
 
46
47
  if (!result || !getPropagatorContext()) return;
47
48
 
@@ -77,12 +78,11 @@ module.exports = function(core) {
77
78
  name,
78
79
  moduleName: 'path',
79
80
  methodName: 'basename',
80
- context: `path.basename(${ArrayPrototypeJoin.call(args.map(a => `'${a.value}'`))})`,
81
- history: [strInfo],
82
- object: {
83
- value: 'path',
84
- isTracked: false,
81
+ get context() {
82
+ return `path.basename(${ArrayPrototypeJoin.call(args.map(a => `'${a.value}'`))})`;
85
83
  },
84
+ history: [strInfo],
85
+ object,
86
86
  args,
87
87
  result: {
88
88
  value: result,
@@ -93,7 +93,6 @@ module.exports = function(core) {
93
93
  target: 'R',
94
94
  stacktraceOpts: {
95
95
  constructorOpt: hooked,
96
- prependFrames: [orig],
97
96
  },
98
97
  });
99
98
 
@@ -170,6 +170,7 @@ function excludeExtensionDotFromTags({ result, tags, isWin32 }) {
170
170
  }
171
171
 
172
172
  module.exports = {
173
+ pathObject: Object.freeze({ value: 'path', tracked: false }),
173
174
  createBasenameTagsInResult,
174
175
  createArgTagsInResult,
175
176
  excludeExtensionDotFromTags,
@@ -16,7 +16,7 @@
16
16
  'use strict';
17
17
  const { isString } = require('@contrast/common');
18
18
  const { patchType } = require('../../common');
19
- const { createArgTagsInResult } = require('./common');
19
+ const { createArgTagsInResult, pathObject: object } = require('./common');
20
20
 
21
21
  module.exports = function(core) {
22
22
  const {
@@ -40,7 +40,7 @@ module.exports = function(core) {
40
40
  patchType,
41
41
  usePerf: 'sync',
42
42
  post(data) {
43
- const { args, result, name, hooked, orig } = data;
43
+ const { args, result, name, hooked } = data;
44
44
 
45
45
  if (!result || !getPropagatorContext()) return;
46
46
 
@@ -64,12 +64,11 @@ module.exports = function(core) {
64
64
  name,
65
65
  moduleName: 'path',
66
66
  methodName: 'dirname',
67
- context: `path.dirname('${strInfo.value}')`,
68
- history: [strInfo],
69
- object: {
70
- value: 'path',
71
- isTracked: false,
67
+ get context() {
68
+ return `path.dirname('${strInfo.value}')`;
72
69
  },
70
+ history: [strInfo],
71
+ object,
73
72
  args: [
74
73
  {
75
74
  value: strInfo.value,
@@ -85,7 +84,6 @@ module.exports = function(core) {
85
84
  target: 'R',
86
85
  stacktraceOpts: {
87
86
  constructorOpt: hooked,
88
- prependFrames: [orig],
89
87
  },
90
88
  });
91
89
 
@@ -18,7 +18,7 @@
18
18
  const { isString } = require('@contrast/common');
19
19
  const { createSubsetTags } = require('../../../tag-utils');
20
20
  const { patchType } = require('../../common');
21
- const { excludeExtensionDotFromTags } = require('./common');
21
+ const { excludeExtensionDotFromTags, pathObject: object } = require('./common');
22
22
 
23
23
  module.exports = function(core) {
24
24
  const {
@@ -42,15 +42,13 @@ module.exports = function(core) {
42
42
  patchType,
43
43
  usePerf: 'sync',
44
44
  post(data) {
45
- const { args, result, name, hooked, orig } = data;
45
+ const { args, result, name, hooked } = data;
46
46
  if (!result || !getPropagatorContext()) return;
47
47
 
48
48
  const pathStr = args[0];
49
-
50
49
  if (!pathStr || !isString(pathStr)) return;
51
50
 
52
51
  const strInfo = tracker.getData(pathStr);
53
-
54
52
  if (!strInfo) return;
55
53
 
56
54
  let newTags = createSubsetTags(strInfo.tags, pathStr.indexOf(result), result.length);
@@ -65,35 +63,23 @@ module.exports = function(core) {
65
63
  name,
66
64
  moduleName: 'path',
67
65
  methodName: 'extname',
68
- context: `path.extname('${strInfo.value}')`,
69
- history: [strInfo],
70
- object: {
71
- value: 'path',
72
- isTracked: false,
73
- },
74
- args: [
75
- {
76
- value: strInfo.value,
77
- tracked: true,
78
- },
79
- ],
80
- result: {
81
- value: result,
82
- tracked: true,
66
+ get context() {
67
+ return `path.extname('${strInfo.value}')`;
83
68
  },
69
+ history: [strInfo],
70
+ object,
71
+ args: [{ value: strInfo.value, tracked: true }],
72
+ result: { value: result, tracked: true },
84
73
  tags: newTags,
85
74
  source: 'P',
86
75
  target: 'R',
87
76
  stacktraceOpts: {
88
77
  constructorOpt: hooked,
89
- prependFrames: [orig],
90
78
  },
91
79
  });
92
-
93
80
  if (!event) return;
94
81
 
95
82
  const { extern } = tracker.track(result, event);
96
-
97
83
  if (extern) {
98
84
  data.result = extern;
99
85
  }
@@ -18,7 +18,7 @@
18
18
  const { primordials: { ArrayPrototypeJoin }, isString } = require('@contrast/common');
19
19
  const { createMergedTags, getAdjustedUntrackedValue } = require('../../../tag-utils');
20
20
  const { patchType } = require('../../common');
21
- const { createArgTagsInResult, excludeExtensionDotFromTags } = require('./common');
21
+ const { createArgTagsInResult, excludeExtensionDotFromTags, pathObject: object } = require('./common');
22
22
 
23
23
  module.exports = function(core) {
24
24
  const {
@@ -42,7 +42,7 @@ module.exports = function(core) {
42
42
  patchType,
43
43
  usePerf: 'sync',
44
44
  post(data) {
45
- const { args, result, name: patchName, hooked, orig } = data;
45
+ const { args, result, name: patchName, hooked } = data;
46
46
  if (!result || !getPropagatorContext()) return;
47
47
 
48
48
  const pathProps = [];
@@ -92,12 +92,11 @@ module.exports = function(core) {
92
92
  name: patchName,
93
93
  moduleName: 'path',
94
94
  methodName: 'format',
95
- context: `path.format(${ArrayPrototypeJoin.call(eventArgs.map((a) => a.value))})`,
96
- history,
97
- object: {
98
- value: 'path',
99
- isTracked: false,
95
+ get context() {
96
+ return `path.format(${ArrayPrototypeJoin.call(eventArgs.map((a) => a.value))})`;
100
97
  },
98
+ history,
99
+ object,
101
100
  args: eventArgs,
102
101
  result: {
103
102
  value: result,
@@ -108,14 +107,11 @@ module.exports = function(core) {
108
107
  target: 'R',
109
108
  stacktraceOpts: {
110
109
  constructorOpt: hooked,
111
- prependFrames: [orig],
112
110
  },
113
111
  });
114
-
115
112
  if (!event) return;
116
113
 
117
114
  const { extern } = tracker.track(result, event);
118
-
119
115
  if (extern) {
120
116
  data.result = extern;
121
117
  }
@@ -18,7 +18,7 @@
18
18
  const { isString, primordials: { ArrayPrototypeJoin } } = require('@contrast/common');
19
19
  const { createMergedTags } = require('../../../tag-utils');
20
20
  const { patchType } = require('../../common');
21
- const { createArgTagsInResult, excludeExtensionDotFromTags } = require('./common');
21
+ const { createArgTagsInResult, excludeExtensionDotFromTags, pathObject: object } = require('./common');
22
22
 
23
23
  module.exports = function(core) {
24
24
  const {
@@ -44,7 +44,7 @@ module.exports = function(core) {
44
44
  patchType,
45
45
  usePerf: 'sync',
46
46
  post(data) {
47
- const { args: origArgs, result, hooked, orig } = data;
47
+ const { args: origArgs, result, hooked } = data;
48
48
 
49
49
  if (!result || !getPropagatorContext()) return;
50
50
 
@@ -92,24 +92,18 @@ module.exports = function(core) {
92
92
  name,
93
93
  moduleName: 'path',
94
94
  methodName: method,
95
- context: `path.${method}(${ArrayPrototypeJoin.call(args
96
- .map((a) => `'${a.value}'`), ',')})`,
97
- history,
98
- object: {
99
- value: 'path',
100
- isTracked: false,
95
+ get context() {
96
+ return `path.${method}(${ArrayPrototypeJoin.call(args.map((a) => `'${a.value}'`), ',')})`;
101
97
  },
98
+ history,
99
+ object,
102
100
  args,
103
- result: {
104
- value: result,
105
- tracked: true,
106
- },
101
+ result: { value: result, tracked: true },
107
102
  tags: fullTags,
108
103
  source: 'P',
109
104
  target: 'R',
110
105
  stacktraceOpts: {
111
106
  constructorOpt: hooked,
112
- prependFrames: [orig],
113
107
  },
114
108
  });
115
109
 
@@ -16,7 +16,7 @@
16
16
  'use strict';
17
17
  const { isString } = require('@contrast/common');
18
18
  const { patchType } = require('../../common');
19
- const { createArgTagsInResult, excludeExtensionDotFromTags } = require('./common');
19
+ const { createArgTagsInResult, excludeExtensionDotFromTags, pathObject: object } = require('./common');
20
20
 
21
21
  module.exports = function(core) {
22
22
  const {
@@ -40,7 +40,7 @@ module.exports = function(core) {
40
40
  patchType,
41
41
  usePerf: 'sync',
42
42
  post(data) {
43
- const { args, result, name, hooked, orig } = data;
43
+ const { args, result, name, hooked } = data;
44
44
  if (!result || !getPropagatorContext()) return;
45
45
 
46
46
  const pathStr = args[0];
@@ -69,28 +69,18 @@ module.exports = function(core) {
69
69
  name,
70
70
  moduleName: 'path',
71
71
  methodName: 'normalize',
72
- context: `path.normalize('${strInfo.value}')`,
73
- history: [strInfo],
74
- object: {
75
- value: 'path',
76
- isTracked: false,
77
- },
78
- args: [
79
- {
80
- value: strInfo.value,
81
- tracked: true,
82
- },
83
- ],
84
- result: {
85
- value: result,
86
- tracked: true,
72
+ get context() {
73
+ return `path.normalize('${strInfo.value}')`;
87
74
  },
75
+ history: [strInfo],
76
+ object,
77
+ args: [{ value: strInfo.value, tracked: true }],
78
+ result: { value: result, tracked: true },
88
79
  tags: newTags,
89
80
  source: 'P',
90
81
  target: 'R',
91
82
  stacktraceOpts: {
92
83
  constructorOpt: hooked,
93
- prependFrames: [orig],
94
84
  },
95
85
  });
96
86
 
@@ -17,7 +17,7 @@
17
17
  const { isString } = require('@contrast/common');
18
18
  const { createSubsetTags } = require('../../../tag-utils');
19
19
  const { patchType } = require('../../common');
20
- const { excludeExtensionDotFromTags } = require('./common');
20
+ const { excludeExtensionDotFromTags, pathObject: object } = require('./common');
21
21
 
22
22
  module.exports = function(core) {
23
23
  const {
@@ -42,7 +42,7 @@ module.exports = function(core) {
42
42
  patchType,
43
43
  usePerf: 'sync',
44
44
  post(data) {
45
- const { args, result, name: patchName, hooked, orig } = data;
45
+ const { args, result, name: patchName, hooked } = data;
46
46
  if (!result || !getPropagatorContext()) return;
47
47
 
48
48
  const [path] = args;
@@ -67,28 +67,18 @@ module.exports = function(core) {
67
67
  name: patchName,
68
68
  moduleName: 'path',
69
69
  methodName: 'parse',
70
- context: `path.parse('${strInfo.value}')`,
71
- history: [strInfo],
72
- object: {
73
- value: 'path',
74
- isTracked: false,
75
- },
76
- args: [
77
- {
78
- value: strInfo.value,
79
- tracked: true
80
- }
81
- ],
82
- result: {
83
- value: inspect(result),
84
- tracked: true,
70
+ get context() {
71
+ return `path.parse('${strInfo.value}')`;
85
72
  },
73
+ history: [strInfo],
74
+ object,
75
+ args: [{ value: strInfo.value, tracked: true }],
76
+ result: { value: inspect(result), tracked: true },
86
77
  tags: newTags,
87
78
  source: 'P',
88
79
  target: 'R',
89
80
  stacktraceOpts: {
90
81
  constructorOpt: hooked,
91
- prependFrames: [orig],
92
82
  },
93
83
  });
94
84
 
@@ -17,7 +17,7 @@
17
17
 
18
18
  const { isString } = require('@contrast/common');
19
19
  const { patchType } = require('../../common');
20
- const { createArgTagsInResult, excludeExtensionDotFromTags } = require('./common');
20
+ const { createArgTagsInResult, excludeExtensionDotFromTags, pathObject: object } = require('./common');
21
21
 
22
22
  module.exports = function(core) {
23
23
  const {
@@ -41,15 +41,15 @@ module.exports = function(core) {
41
41
  patchType,
42
42
  usePerf: 'sync',
43
43
  post(data) {
44
- const { args, result, name, hooked, orig } = data;
44
+ const { args, result, name, hooked } = data;
45
45
  if (!result || !getPropagatorContext()) return;
46
46
 
47
47
  const [fromStr, toStr] = args;
48
48
 
49
49
  if (!toStr || !isString(toStr)) return;
50
+
50
51
  const fromStrInfo = tracker.getData(fromStr);
51
52
  const toStrInfo = tracker.getData(toStr);
52
-
53
53
  if (!toStrInfo) return;
54
54
 
55
55
  let { newTags } = createArgTagsInResult({
@@ -70,12 +70,11 @@ module.exports = function(core) {
70
70
  name,
71
71
  moduleName: 'path',
72
72
  methodName: 'relative',
73
- context: `path.relative('${fromStr}', '${toStr}')`,
74
- history: [toStrInfo],
75
- object: {
76
- value: 'path',
77
- isTracked: false,
73
+ get context() {
74
+ return `path.relative('${fromStr}', '${toStr}')`;
78
75
  },
76
+ history: [toStrInfo],
77
+ object,
79
78
  args: [
80
79
  {
81
80
  value: fromStrInfo?.value || fromStr,
@@ -86,23 +85,17 @@ module.exports = function(core) {
86
85
  tracked: !!toStrInfo,
87
86
  }
88
87
  ],
89
- result: {
90
- value: result,
91
- tracked: true,
92
- },
88
+ result: { value: result, tracked: true },
93
89
  tags: newTags,
94
90
  source: 'P',
95
91
  target: 'R',
96
92
  stacktraceOpts: {
97
93
  constructorOpt: hooked,
98
- prependFrames: [orig],
99
94
  },
100
95
  });
101
-
102
96
  if (!event) return;
103
97
 
104
98
  const { extern } = tracker.track(result, event);
105
-
106
99
  if (extern) {
107
100
  data.result = extern;
108
101
  }
@@ -17,7 +17,7 @@
17
17
 
18
18
  const { isString } = require('@contrast/common');
19
19
  const { patchType } = require('../../common');
20
- const { createArgTagsInResult, excludeExtensionDotFromTags } = require('./common');
20
+ const { createArgTagsInResult, excludeExtensionDotFromTags, pathObject: object } = require('./common');
21
21
 
22
22
  module.exports = function(core) {
23
23
  const {
@@ -40,16 +40,14 @@ module.exports = function(core) {
40
40
  patchType,
41
41
  usePerf: 'sync',
42
42
  post(data) {
43
- const { args, result, name, hooked, orig } = data;
43
+ const { args, result, name, hooked } = data;
44
44
  if (!result || !getPropagatorContext()) return;
45
45
 
46
46
  const pathStr = args[0];
47
-
48
47
  if (!pathStr || !isString(pathStr)) return;
49
48
 
50
49
  const strInfo = tracker.getData(pathStr);
51
50
  const resultInfo = tracker.getData(result);
52
-
53
51
  if (!strInfo) return;
54
52
 
55
53
  let { tags } = strInfo;
@@ -75,18 +73,12 @@ module.exports = function(core) {
75
73
  name,
76
74
  moduleName: 'path',
77
75
  methodName: 'toNamespacedPath',
78
- context: `path.toNamespacedPath('${strInfo.value}')`,
79
- history: [{ ...strInfo }],
80
- object: {
81
- value: 'path',
82
- isTracked: false,
76
+ get context() {
77
+ return `path.toNamespacedPath('${strInfo.value}')`;
83
78
  },
84
- args: [
85
- {
86
- value: strInfo.value,
87
- tracked: true,
88
- },
89
- ],
79
+ history: [{ ...strInfo }],
80
+ object,
81
+ args: [{ value: strInfo.value, tracked: true }],
90
82
  result: {
91
83
  value: resultInfo ? resultInfo.value : result,
92
84
  tracked: true,
@@ -96,10 +88,8 @@ module.exports = function(core) {
96
88
  target: 'R',
97
89
  stacktraceOpts: {
98
90
  constructorOpt: hooked,
99
- prependFrames: [orig],
100
91
  },
101
92
  });
102
-
103
93
  if (!event) return;
104
94
 
105
95
  if (resultInfo) {
@@ -107,7 +97,6 @@ module.exports = function(core) {
107
97
  }
108
98
 
109
99
  const { extern } = resultInfo || tracker.track(result, event);
110
-
111
100
  if (extern) {
112
101
  data.result = extern;
113
102
  }
@@ -17,7 +17,7 @@
17
17
  const { patchType } = require('../../common');
18
18
 
19
19
  /** @type {import('@contrast/rewriter').RewriteOpts} */
20
- const REWRITE_OPTS = { isModule: false, inject: false, wrap: false };
20
+ const REWRITE_OPTS = { isModule: false, inject: false, wrap: false, minify: false };
21
21
 
22
22
  module.exports = function (core) {
23
23
  const store = { lock: true, name: 'assess:propagators:pug-compile' };