loadwise 0.6.2 → 0.8.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 (278) hide show
  1. package/README.md +175 -115
  2. package/dist/bin/loadwise.js +132 -67
  3. package/dist/lib/accessibility/analyze.js +5 -3
  4. package/dist/lib/accessibility/angular-inline.js +9 -11
  5. package/dist/lib/accessibility/angular-literal.js +39 -0
  6. package/dist/lib/accessibility/form-context.js +36 -0
  7. package/dist/lib/accessibility/frame-head.js +92 -0
  8. package/dist/lib/accessibility/frame-viewport.js +149 -0
  9. package/dist/lib/accessibility/frontend-detect.js +6 -5
  10. package/dist/lib/accessibility/jsx-elements.js +13 -3
  11. package/dist/lib/accessibility/markup-files.js +7 -2
  12. package/dist/lib/accessibility/rule-ids.js +3 -0
  13. package/dist/lib/accessibility/rules.js +128 -41
  14. package/dist/lib/accessibility/site-fixes/buttons.js +5 -1
  15. package/dist/lib/accessibility/template-attributes.js +5 -3
  16. package/dist/lib/accessibility/template-elements.js +25 -6
  17. package/dist/lib/accessibility/template-file.js +40 -25
  18. package/dist/lib/accessibility/usage.js +10 -2
  19. package/dist/lib/editor/accessibility-examples.js +6 -1
  20. package/dist/lib/editor/actions.js +46 -7
  21. package/dist/lib/editor/apply-fix.js +69 -4
  22. package/dist/lib/editor/configured-setup.js +63 -0
  23. package/dist/lib/editor/diagnostics.js +206 -17
  24. package/dist/lib/editor/dismissals.js +85 -26
  25. package/dist/lib/editor/editor-document.js +5 -2
  26. package/dist/lib/editor/editor-launcher.js +170 -0
  27. package/dist/lib/editor/fix-edits.js +19 -0
  28. package/dist/lib/editor/jetbrains-setup.js +53 -0
  29. package/dist/lib/editor/language-server.js +80 -24
  30. package/dist/lib/editor/managed-config.js +37 -0
  31. package/dist/lib/editor/native-setup.js +86 -0
  32. package/dist/lib/editor/perf-watch.js +8 -6
  33. package/dist/lib/editor/release-vsix.js +61 -0
  34. package/dist/lib/editor/reliability-examples.js +15 -0
  35. package/dist/lib/editor/scan-session.js +29 -8
  36. package/dist/lib/editor/server-commands.js +38 -9
  37. package/dist/lib/editor/setup-server.js +87 -0
  38. package/dist/lib/editor/setup-vim.js +63 -0
  39. package/dist/lib/editor/setup.js +131 -0
  40. package/dist/lib/editor/stdio-setup.js +6 -0
  41. package/dist/lib/editor/workspace-files.js +61 -7
  42. package/dist/lib/editor/workspace-paths.js +41 -1
  43. package/dist/lib/maintainability/analysis/analyze-source.js +1 -1
  44. package/dist/lib/maintainability/architecture/architecture.js +4 -4
  45. package/dist/lib/maintainability/cli/changed-lines.js +20 -2
  46. package/dist/lib/maintainability/cli/inputs.js +12 -3
  47. package/dist/lib/maintainability/cli.js +18 -5
  48. package/dist/lib/maintainability/entry-points/entry-points.js +44 -15
  49. package/dist/lib/maintainability/entry-points/html-entry-points.js +5 -1
  50. package/dist/lib/maintainability/examples.js +4 -0
  51. package/dist/lib/maintainability/quality/functions.js +9 -6
  52. package/dist/lib/maintainability/quality/limits.js +19 -0
  53. package/dist/lib/maintainability/quality/size-limits.js +8 -2
  54. package/dist/lib/maintainability/quality/stray-console.js +62 -1
  55. package/dist/lib/maintainability/quality/tsconfig-strict.js +2 -0
  56. package/dist/lib/maintainability/rule-ids.js +3 -0
  57. package/dist/lib/maintainability/scan-changed.js +4 -1
  58. package/dist/lib/maintainability/scan-worker.js +6 -2
  59. package/dist/lib/maintainability/scan.js +21 -8
  60. package/dist/lib/maintainability/site-fixes/unused-bindings.js +138 -3
  61. package/dist/lib/maintainability/unused/module-usage.js +43 -21
  62. package/dist/lib/maintainability/unused/unused-bindings.js +39 -4
  63. package/dist/lib/maintainability/unused/unused-modules.js +5 -10
  64. package/dist/lib/performance/analysis/source-inputs.js +7 -2
  65. package/dist/lib/performance/analysis/source-options.js +7 -6
  66. package/dist/lib/performance/analyze.js +16 -3
  67. package/dist/lib/performance/cli/changed-lines.js +8 -1
  68. package/dist/lib/performance/cli/cli-arguments.js +19 -8
  69. package/dist/lib/performance/cli/cli-output.js +4 -0
  70. package/dist/lib/performance/cli/cli-scan.js +21 -2
  71. package/dist/lib/performance/cli.js +16 -7
  72. package/dist/lib/performance/collections/memory-growth.js +55 -12
  73. package/dist/lib/performance/contracts/openapi.js +13 -4
  74. package/dist/lib/performance/datastores/pg-integrity.js +68 -22
  75. package/dist/lib/performance/datastores/pg-session-release.js +114 -0
  76. package/dist/lib/performance/datastores/pg-session-sql.js +144 -0
  77. package/dist/lib/performance/datastores/pooling.js +62 -3
  78. package/dist/lib/performance/datastores/redis.js +94 -18
  79. package/dist/lib/performance/datastores/session-store.js +2 -1
  80. package/dist/lib/performance/db/checks.js +19 -8
  81. package/dist/lib/performance/db/gateway.js +3 -1
  82. package/dist/lib/performance/db/plan-estimates.js +4 -4
  83. package/dist/lib/performance/engine/native-syntax.js +3 -0
  84. package/dist/lib/performance/engine/native.js +11 -7
  85. package/dist/lib/performance/evidence/plans.js +7 -5
  86. package/dist/lib/performance/evidence/traces.js +21 -1
  87. package/dist/lib/performance/frontend/angular-teardown.js +96 -0
  88. package/dist/lib/performance/frontend/effect-cleanup.js +148 -0
  89. package/dist/lib/performance/frontend/frontend-dom-perf.js +14 -2
  90. package/dist/lib/performance/frontend/frontend-helpers.js +1 -9
  91. package/dist/lib/performance/frontend/frontend-perf.js +149 -74
  92. package/dist/lib/performance/migrations/extract-code-sql.js +16 -4
  93. package/dist/lib/performance/migrations/extract-code.js +13 -5
  94. package/dist/lib/performance/migrations/extract-sql.js +82 -38
  95. package/dist/lib/performance/migrations/operations.js +56 -13
  96. package/dist/lib/performance/migrations/postgres-lock-timeout.js +52 -0
  97. package/dist/lib/performance/migrations/postgres-registry.js +127 -26
  98. package/dist/lib/performance/migrations/postgres-settings.js +78 -0
  99. package/dist/lib/performance/migrations/rules-postgres-add-column.js +3 -3
  100. package/dist/lib/performance/migrations/rules-postgres-shared.js +9 -0
  101. package/dist/lib/performance/migrations/rules-postgres.js +88 -39
  102. package/dist/lib/performance/orm/offset-pagination.js +6 -4
  103. package/dist/lib/performance/orm/prisma-aggregates.js +69 -18
  104. package/dist/lib/performance/orm/unbounded-list-chain.js +29 -0
  105. package/dist/lib/performance/orm/unbounded-list-queries.js +18 -13
  106. package/dist/lib/performance/polyglot.js +111 -14
  107. package/dist/lib/performance/projects.js +3 -3
  108. package/dist/lib/performance/query-loops/sequential-loops.js +1 -0
  109. package/dist/lib/performance/request/backend-mastery.js +151 -42
  110. package/dist/lib/performance/request/bulk-listener-registration.js +111 -0
  111. package/dist/lib/performance/request/fastify-receivers.js +93 -0
  112. package/dist/lib/performance/request/fresh-loop-socket.js +103 -0
  113. package/dist/lib/performance/request/mongoose-lean.js +298 -46
  114. package/dist/lib/performance/request/node-event-listener-leak.js +99 -5
  115. package/dist/lib/performance/request/phase5-ast.js +6 -7
  116. package/dist/lib/performance/request/phase5-rules.js +204 -23
  117. package/dist/lib/performance/request/request-handlers.js +120 -23
  118. package/dist/lib/performance/request/sql-select-star.js +150 -0
  119. package/dist/lib/performance/request/unbounded-promise-all.js +54 -29
  120. package/dist/lib/performance/request/upload-limits.js +5 -1
  121. package/dist/lib/performance/site-fix.js +4 -4
  122. package/dist/lib/performance/site-fixes/backend-mastery-fixes.js +298 -16
  123. package/dist/lib/performance/site-fixes/collection-existence.js +2 -1
  124. package/dist/lib/performance/site-fixes/collections.js +1 -2
  125. package/dist/lib/performance/site-fixes/frontend-fixes.js +358 -14
  126. package/dist/lib/performance/site-fixes/helpers.js +3 -4
  127. package/dist/lib/performance/site-fixes/integrity.js +2 -4
  128. package/dist/lib/performance/site-fixes/migration-context.js +8 -1
  129. package/dist/lib/performance/site-fixes/migration-lock-rules.js +66 -30
  130. package/dist/lib/performance/site-fixes/prisma-aggregates.js +29 -9
  131. package/dist/lib/performance/site-fixes/small-rewrites.js +168 -10
  132. package/dist/lib/performance/site-fixes/sync-calls.js +14 -12
  133. package/dist/lib/performance/site-fixes/upload-limits.js +13 -7
  134. package/dist/lib/performance/sql/mysql-tokens.js +38 -12
  135. package/dist/lib/reliability/boundary-access.js +114 -57
  136. package/dist/lib/reliability/react-bugs.js +29 -7
  137. package/dist/lib/reliability/resource-leak-intervals.js +258 -0
  138. package/dist/lib/reliability/resource-leaks.js +209 -195
  139. package/dist/lib/reliability/rule-ids.js +10 -1
  140. package/dist/lib/reliability/site-fixes/resource-leaks.js +16 -1
  141. package/dist/lib/reliability/swallowed-errors.js +107 -21
  142. package/dist/lib/reliability/test-cleanup-after-await.js +92 -18
  143. package/dist/lib/reliability/usage.js +16 -5
  144. package/dist/lib/reliability/walk.js +3 -2
  145. package/dist/lib/security/auth-crypto/hashing.js +24 -8
  146. package/dist/lib/security/auth-crypto/jwt.js +21 -6
  147. package/dist/lib/security/auth-crypto/secrets.js +44 -1
  148. package/dist/lib/security/auth-crypto/shared.js +3 -1
  149. package/dist/lib/security/auth-crypto/signing-algorithm.js +79 -0
  150. package/dist/lib/security/auth-crypto/transport-and-ciphers.js +85 -1
  151. package/dist/lib/security/cli.js +21 -6
  152. package/dist/lib/security/cookie-credentials.js +115 -0
  153. package/dist/lib/security/cookie-csrf.js +241 -0
  154. package/dist/lib/security/deps/advisory.js +50 -109
  155. package/dist/lib/security/deps/cli.js +1 -1
  156. package/dist/lib/security/deps/cvss-score.js +14 -0
  157. package/dist/lib/security/deps/fixed-version.js +97 -0
  158. package/dist/lib/security/deps/lockfiles.js +135 -74
  159. package/dist/lib/security/deps/osv.js +11 -3
  160. package/dist/lib/security/deps/scan.js +47 -20
  161. package/dist/lib/security/deps/yarn-lock.js +158 -0
  162. package/dist/lib/security/examples/injection.cjs +4 -0
  163. package/dist/lib/security/exposure/cookies.js +17 -2
  164. package/dist/lib/security/exposure/cors-origin-regex.js +2 -3
  165. package/dist/lib/security/exposure/frontend-security.js +21 -14
  166. package/dist/lib/security/exposure/jsx-url.js +18 -33
  167. package/dist/lib/security/exposure/logging.js +49 -10
  168. package/dist/lib/security/exposure/prototype-pollution.js +126 -56
  169. package/dist/lib/security/exposure/react-html.js +26 -0
  170. package/dist/lib/security/exposure/reflected-xss.js +34 -5
  171. package/dist/lib/security/files/compose.js +126 -1
  172. package/dist/lib/security/files/dockerfile.js +62 -4
  173. package/dist/lib/security/files/index.js +1 -1
  174. package/dist/lib/security/injection/command.js +46 -18
  175. package/dist/lib/security/injection/index.js +2 -0
  176. package/dist/lib/security/injection/ldap.js +86 -0
  177. package/dist/lib/security/injection/nosql.js +28 -4
  178. package/dist/lib/security/injection/redos.js +1 -1
  179. package/dist/lib/security/injection/rule-ids.js +1 -0
  180. package/dist/lib/security/injection/shared.js +5 -1
  181. package/dist/lib/security/injection/sql.js +28 -13
  182. package/dist/lib/security/lexical-declaration.js +113 -0
  183. package/dist/lib/security/pg-dynamic-query.js +28 -1
  184. package/dist/lib/security/pg-identifier-guards.js +107 -3
  185. package/dist/lib/security/phase5-rules.js +26 -135
  186. package/dist/lib/security/polyglot.js +2 -2
  187. package/dist/lib/security/redirect-settings.js +98 -0
  188. package/dist/lib/security/request-forgery/open-redirect.js +18 -5
  189. package/dist/lib/security/request-forgery/path-traversal.js +84 -6
  190. package/dist/lib/security/request-forgery/shared.js +1 -7
  191. package/dist/lib/security/request-forgery/ssrf.js +176 -14
  192. package/dist/lib/security/rule-descriptions.js +5 -1
  193. package/dist/lib/security/rule-ids.js +7 -0
  194. package/dist/lib/security/site-fixes/auth-crypto.js +5 -78
  195. package/dist/lib/security/site-fixes/exposure.js +21 -3
  196. package/dist/lib/security/site-fixes/files.js +11 -13
  197. package/dist/lib/security/site-fixes/frontend-security-fixes.js +2 -2
  198. package/dist/lib/security/site-fixes/injection.js +17 -4
  199. package/dist/lib/security/site-fixes/jwt.js +1 -20
  200. package/dist/lib/security/site-fixes/request-forgery.js +37 -29
  201. package/dist/lib/security/taint/binding-inputs.js +236 -0
  202. package/dist/lib/security/taint/filename-guard.js +45 -45
  203. package/dist/lib/security/taint/guards.js +14 -8
  204. package/dist/lib/security/taint/index.js +126 -154
  205. package/dist/lib/security/taint/propagate.js +43 -9
  206. package/dist/lib/security/taint/record-writes.js +161 -0
  207. package/dist/lib/security/taint/resolution-cache.js +13 -7
  208. package/dist/lib/security/taint/sanitizers.js +89 -5
  209. package/dist/lib/security/taint/trace-nodes.js +61 -0
  210. package/dist/lib/security/taint/validators.js +89 -9
  211. package/dist/lib/shared/agent/agent-init.js +28 -5
  212. package/dist/lib/shared/agent/agent-prompt.js +74 -0
  213. package/dist/lib/shared/agent/agent-session.js +6 -1
  214. package/dist/lib/shared/agent/agent-verify.js +58 -11
  215. package/dist/lib/shared/agent/git-hook.js +17 -6
  216. package/dist/lib/shared/agent/review-delivery.js +1 -1
  217. package/dist/lib/shared/agent/review-mcp.js +8 -2
  218. package/dist/lib/shared/analysis/ast-semantics.js +2 -2
  219. package/dist/lib/shared/analysis/scan-cache.js +99 -14
  220. package/dist/lib/shared/check.js +172 -20
  221. package/dist/lib/shared/cli-dispatch.js +17 -0
  222. package/dist/lib/shared/config.js +27 -10
  223. package/dist/lib/shared/explain.js +1 -1
  224. package/dist/lib/shared/fix/fix-convergence.js +19 -31
  225. package/dist/lib/shared/fix/fix-handoff.js +16 -11
  226. package/dist/lib/shared/fix/fix-imports.js +4 -162
  227. package/dist/lib/shared/fix/fix-presentation-comments.js +23 -9
  228. package/dist/lib/shared/fix/fix-presentation-prettier.js +1 -46
  229. package/dist/lib/shared/fix/fix-presentation-rows.js +45 -1
  230. package/dist/lib/shared/fix/fix-presentation.js +9 -6
  231. package/dist/lib/shared/fix/fix-safety.js +32 -1
  232. package/dist/lib/shared/fix/fix-scope.js +82 -0
  233. package/dist/lib/shared/fix/fix-terminal.js +28 -1
  234. package/dist/lib/shared/fix/fix-typecheck.js +8 -4
  235. package/dist/lib/shared/fix/import-text-edits.js +148 -0
  236. package/dist/lib/shared/fix/project-file-access.js +17 -26
  237. package/dist/lib/shared/fix/read-fix-text.js +20 -0
  238. package/dist/lib/shared/fix.js +241 -104
  239. package/dist/lib/shared/formats/finding-location.js +4 -1
  240. package/dist/lib/shared/formats/github.js +3 -3
  241. package/dist/lib/shared/formats/sarif.js +9 -3
  242. package/dist/lib/shared/report-fp.js +97 -0
  243. package/dist/lib/shared/reporting/automatic-fix-signal.js +10 -0
  244. package/dist/lib/shared/reporting/baseline.js +7 -5
  245. package/dist/lib/shared/reporting/check-text.js +50 -0
  246. package/dist/lib/shared/reporting/pillars.js +54 -19
  247. package/dist/lib/shared/reporting/source-report.js +3 -0
  248. package/dist/lib/shared/system/atomic-write.js +5 -2
  249. package/dist/lib/shared/system/glob.js +34 -8
  250. package/dist/lib/shared/system/sentry.js +222 -0
  251. package/dist/lib/shared/system/shell-argument.js +5 -1
  252. package/dist/lib/shared/system/terminal-safe.js +3 -2
  253. package/dist/lib/shared/system/terminal-style.js +131 -0
  254. package/dist/lib/shared/workspaces.js +15 -3
  255. package/docs/assets/cli-workflow.gif +0 -0
  256. package/integrations/sublime/plugin.py +22 -0
  257. package/integrations/zed/Cargo.lock +845 -0
  258. package/integrations/zed/Cargo.toml +11 -0
  259. package/integrations/zed/extension.toml +11 -0
  260. package/integrations/zed/src/lib.rs +25 -0
  261. package/package.json +15 -3
  262. package/plugin/.claude-plugin/plugin.json +1 -1
  263. package/plugin/commands/loadwise.md +11 -6
  264. package/plugin/hooks/check-edited-file.mjs +27 -5
  265. package/polyglot/performance/rules/csharp.yml +34 -5
  266. package/polyglot/performance/rules/java.yml +24 -1
  267. package/polyglot/performance/rules/python.yml +74 -2
  268. package/polyglot/performance/sgconfig.yml +1 -0
  269. package/polyglot/reliability/rules/csharp.yml +12 -6
  270. package/polyglot/reliability/rules/go.yml +86 -6
  271. package/polyglot/reliability/rules/java.yml +22 -1
  272. package/polyglot/reliability/sgconfig.yml +1 -0
  273. package/polyglot/security/rules/go.yml +100 -22
  274. package/polyglot/security/rules/python.yml +74 -6
  275. package/polyglot/security/rules/rust.yml +65 -0
  276. package/polyglot/security/sgconfig.yml +1 -0
  277. package/schema/loadwise.config.schema.json +556 -76
  278. /package/polyglot/{performance/rules → shared-rules}/input.yml +0 -0
@@ -2,23 +2,27 @@
2
2
  // request data. The interface is frozen (security design section 2.1); rule groups depend on
3
3
  // exactly these three functions.
4
4
  import { stripExpression as strip } from '../bindings.js';
5
- import path from 'node:path';
5
+ import { oneLine, eitherField, step, propertyName, declarationOf, promiseOfThenCallback, partOf, } from './trace-nodes.js';
6
6
  import { ts } from '../../performance/engine/compiler.js';
7
7
  import { parameterSource, h3SourceCall } from './sources.js';
8
8
  import { archiveParameter, archiveLoopEntry } from './archive-sources.js';
9
9
  import { propagation } from './propagate.js';
10
- import { isNumericCall, isPrunedType, isGuarded, stringIsSafe, isRegexEscape } from './sanitizers.js';
10
+ import { isNumericCall, isPrunedType, isGuarded, stringIsSafe, isRegexEscape, isLdapFilterEscape, isLdapFilterTag, } from './sanitizers.js';
11
11
  import { validatedField, schemaCall, schemaShape } from './validators.js';
12
12
  import { createSummaries, argumentValidations } from './summaries.js';
13
13
  import { assignmentsTo, fieldWritesTo, alwaysOverwrites } from './guards.js';
14
14
  import { createUrlControl, isUrlConstructor } from './url-parts.js';
15
+ import { argumentsRecord, bindingPath, bindingWritesBefore, collectRestArguments, restProjection, selectedBindingDefault, parameterInput, writesAfter, } from './binding-inputs.js';
15
16
  import { createResolutionCache } from './resolution-cache.js';
17
+ import { enclosesWithoutCallback, escapedBefore, isNullRecordCall, loopCarriedBeforeInitializer, objectLiteralResult, overwrittenBeforeReadInLoop, updateField, } from './record-writes.js';
16
18
  const sinkKinds = new Set([
17
19
  'sql',
18
20
  'nosql',
21
+ 'ldap',
19
22
  'shell',
20
23
  'code',
21
24
  'regex',
25
+ 'regex-subject',
22
26
  'url',
23
27
  'redirect',
24
28
  'path',
@@ -38,7 +42,6 @@ const sanitizedKinds = new Map([
38
42
  // Caller-direction hops tracked; a fourth is not followed.
39
43
  const maxHops = 3;
40
44
  const maxLabelLength = 60;
41
- const maxStepTextLength = 80;
42
45
  const summariesByProgram = new WeakMap();
43
46
  function summariesOf(program) {
44
47
  let summaries = summariesByProgram.get(program);
@@ -49,52 +52,6 @@ function summariesOf(program) {
49
52
  function isTraced(result) {
50
53
  return !!result?.taint && result.label !== undefined && result.sourceNode !== undefined;
51
54
  }
52
- function oneLine(text, limit) {
53
- const line = text.replaceAll(/\s+/g, ' ').trim();
54
- return line.length > limit ? line.slice(0, limit - 3) + '...' : line;
55
- }
56
- // The taint of a field that holds either its earlier value or the written one.
57
- function eitherField(earlier, written) {
58
- if (!earlier?.objectFields)
59
- return earlier ?? written;
60
- if (!written.objectFields)
61
- return written;
62
- const fields = new Map(earlier.objectFields);
63
- for (const [name, field] of written.objectFields)
64
- fields.set(name, eitherField(fields.get(name), field));
65
- return { ...written, objectFields: fields };
66
- }
67
- function step(node) {
68
- const sourceFile = node.getSourceFile();
69
- const { line } = sourceFile.getLineAndCharacterOfPosition(node.getStart(sourceFile));
70
- const file = path.relative(process.cwd(), sourceFile.fileName).split(path.sep).join('/');
71
- return { file, line: line + 1, text: oneLine(node.getText(sourceFile), maxStepTextLength) };
72
- }
73
- function propertyName(access) {
74
- if (ts.isPropertyAccessExpression(access))
75
- return access.name.text;
76
- const argument = strip(access.argumentExpression);
77
- return argument && ts.isStringLiteralLike(argument) ? argument.text : undefined;
78
- }
79
- function declarationOf(identifier, checker) {
80
- const symbol = ts.isShorthandPropertyAssignment(identifier.parent)
81
- ? checker.getShorthandAssignmentValueSymbol(identifier.parent)
82
- : checker.getSymbolAtLocation(identifier);
83
- if (!symbol || symbol.flags & ts.SymbolFlags.Alias)
84
- return;
85
- return symbol.valueDeclaration ?? symbol.declarations?.[0];
86
- }
87
- // `promise.then((value) => ...)`: the promise whose settled value the callback's first parameter
88
- // receives.
89
- function promiseOfThenCallback(fn) {
90
- if (!ts.isArrowFunction(fn) && !ts.isFunctionExpression(fn))
91
- return;
92
- const call = fn.parent;
93
- if (!ts.isCallExpression(call) || call.arguments[0] !== fn)
94
- return;
95
- const callee = strip(call.expression);
96
- return ts.isPropertyAccessExpression(callee) && callee.name.text === 'then' ? callee.expression : undefined;
97
- }
98
55
  // Internal results: { taint } for a tainted value, { container } for a request object whose listed
99
56
  // fields are tainted, or { parameter: index } for the symbolic parameter of a return summary. Each
100
57
  // carries steps and hops.
@@ -117,13 +74,6 @@ function createTaint(program) {
117
74
  function withStep(result, node) {
118
75
  return result && { ...result, steps: [...result.steps, step(node)] };
119
76
  }
120
- function partOf(result, keepWhole) {
121
- if (!result || result.container)
122
- return result?.container ? undefined : result;
123
- return keepWhole || result.parameter !== undefined
124
- ? result
125
- : { ...result, taint: 'scalar', objectFields: undefined };
126
- }
127
77
  function first(nodes, resolveNode, keepWhole) {
128
78
  for (const node of nodes) {
129
79
  const result = partOf(resolveNode(node), keepWhole);
@@ -142,6 +92,11 @@ function createTaint(program) {
142
92
  return;
143
93
  return first(expression.templateSpans.map((span) => span.expression), next);
144
94
  }
95
+ if (ts.isTaggedTemplateExpression(expression)) {
96
+ if (state.sinkKind !== 'ldap' || isLdapFilterTag(expression.tag, checker))
97
+ return;
98
+ return next(expression.template);
99
+ }
145
100
  if (ts.isBinaryExpression(expression))
146
101
  return resolveBinary(expression, next);
147
102
  if (ts.isConditionalExpression(expression))
@@ -161,7 +116,7 @@ function createTaint(program) {
161
116
  return;
162
117
  }
163
118
  if (ts.isObjectLiteralExpression(expression))
164
- return resolveObject(expression, next);
119
+ return objectLiteralResult(expression, next);
165
120
  if (ts.isArrayLiteralExpression(expression))
166
121
  return first(expression.elements, next);
167
122
  if (ts.isSpreadElement(expression))
@@ -191,6 +146,8 @@ function createTaint(program) {
191
146
  const receiver = next(expression.expression);
192
147
  if (!receiver)
193
148
  return;
149
+ if (receiver.wrapper)
150
+ return withStep(fieldOf(receiver, name, state.sinkKind), expression);
194
151
  if (receiver.objectFields)
195
152
  return withStep(objectField(receiver, name), expression);
196
153
  if (receiver.container) {
@@ -235,59 +192,20 @@ function createTaint(program) {
235
192
  if (receiver.schema?.kind === 'object') {
236
193
  const fieldSchema = name === undefined ? undefined : receiver.schema.fields?.get(name);
237
194
  schema = fieldSchema && schemaShape(fieldSchema, checker);
238
- if (!schema || schema.kind === 'closed')
195
+ if ((!fieldSchema && !receiver.schema.keepsUnknownFields) || schema?.kind === 'closed')
239
196
  return;
240
197
  }
241
198
  const part = partOf(receiver);
242
199
  return part && { ...part, schema, dto: undefined };
243
200
  }
244
- // The object is tainted as a whole (for sinks that take it), and each named field keeps its own
245
- // taint, so
246
- // `{ filename: tainted, sourcePath }` read back as `.sourcePath` is clean. A tainted spread or
247
- // computed key taints every field.
248
- function resolveObject(expression, next) {
249
- const fields = new Map();
250
- let whole;
251
- for (const property of expression.properties) {
252
- if (ts.isSpreadAssignment(property)) {
253
- const spread = partOf(next(property.expression), true);
254
- if (!spread)
255
- continue;
256
- // A spread with unknown fields taints every field, so later properties add nothing.
257
- if (!spread.objectFields)
258
- return spread;
259
- whole ??= { ...spread, objectFields: undefined };
260
- for (const [name, field] of spread.objectFields)
261
- fields.set(name, field);
262
- continue;
263
- }
264
- const value = ts.isPropertyAssignment(property)
265
- ? property.initializer
266
- : ts.isShorthandPropertyAssignment(property)
267
- ? property.name
268
- : undefined;
269
- const result = value && partOf(next(value), true);
270
- const name = propertyKey(property.name);
271
- if (!result) {
272
- // A clean later property overrides the same field of an earlier spread. A getter or method
273
- // is not modelled, so the spread's taint for that field stays.
274
- if (value && name !== undefined)
275
- fields.delete(name);
276
- continue;
277
- }
278
- whole ??= partOf(result);
279
- if (name === undefined)
280
- return whole;
281
- fields.set(name, result);
282
- }
283
- return whole && { ...whole, objectFields: fields, objectSteps: whole.steps.length };
284
- }
285
201
  // A field of an object literal result, with the steps taken since the literal (call, parameter)
286
202
  // appended.
287
203
  function objectField(receiver, name) {
288
204
  if (name === undefined)
289
205
  return partOf(receiver);
290
- const field = receiver.objectFields?.get(name);
206
+ if (receiver.cleanObjectFields?.has(name) && !receiver.objectFields?.has(name))
207
+ return;
208
+ const field = receiver.objectFields?.get(name) ?? receiver.unknownObjectField;
291
209
  return field && { ...field, steps: [...field.steps, ...receiver.steps.slice(receiver.objectSteps)] };
292
210
  }
293
211
  function resolveIdentifier(identifier, state) {
@@ -300,11 +218,45 @@ function createTaint(program) {
300
218
  return;
301
219
  if (ts.isParameter(declaration))
302
220
  return resolveParameter(declaration, state);
221
+ if (ts.isBindingElement(declaration) ||
222
+ (ts.isVariableDeclaration(declaration) && !(declaration.parent.flags & ts.NodeFlags.Const))) {
223
+ const writes = bindingWritesBefore(declaration, identifier, checker);
224
+ if (writes) {
225
+ const bound = resolveBindingWrites(writes.inputs, state);
226
+ if (ts.isBindingElement(declaration))
227
+ return bound;
228
+ return withFieldWrites(bound, declaration, identifier, state, (write) => writesAfter(write, writes.last, identifier));
229
+ }
230
+ }
303
231
  if (ts.isBindingElement(declaration))
304
232
  return resolveBinding(declaration, state);
305
233
  if (ts.isVariableDeclaration(declaration))
306
234
  return resolveVariable(declaration, identifier, state);
307
235
  }
236
+ function resolveBindingWrites(writes, state) {
237
+ let reachable;
238
+ for (const write of writes) {
239
+ const traced = 'kind' in write ? traceDeclaration(write) : traceWrite(write);
240
+ if (traced)
241
+ reachable = eitherField(reachable, traced);
242
+ }
243
+ return reachable;
244
+ function traceDeclaration(declaration) {
245
+ if (ts.isBindingElement(declaration))
246
+ return resolveBinding(declaration, state);
247
+ const { initializer } = declaration;
248
+ return withStep(initializer ? resolve(initializer, state) : resolveLoopVariable(declaration, state), declaration);
249
+ }
250
+ function traceWrite(write) {
251
+ const value = resolve(write.assignment.right, state);
252
+ const projected = value && write.field !== undefined
253
+ ? value.objectFields
254
+ ? objectField(value, write.field)
255
+ : boundField(value, write.field, state.sinkKind)
256
+ : value;
257
+ return withStep(projected, write.assignment);
258
+ }
259
+ }
308
260
  function resolveParameter(parameter, state) {
309
261
  const fn = parameter.parent;
310
262
  const index = fn.parameters.indexOf(parameter);
@@ -329,24 +281,33 @@ function createTaint(program) {
329
281
  // on access.
330
282
  if (found)
331
283
  return { ...source(found.taint, found.label, parameter, state.hops), dto: parameter };
332
- if (state.hops >= maxHops || parameter.dotDotDotToken)
284
+ return parameterFromCalls(parameter, index, state);
285
+ }
286
+ function parameterFromCalls(parameter, index, state) {
287
+ const fn = parameter.parent;
288
+ if (state.hops >= maxHops)
333
289
  return;
334
- for (const call of summaries.callSites(fn)) {
335
- const argument = call.arguments[index];
336
- const result = argument && resolve(argument, { ...state, hops: state.hops + 1 });
290
+ const nextState = { ...state, hops: state.hops + 1 };
291
+ const restFields = new Map();
292
+ const calls = state.defaultCall?.fn === fn ? [state.defaultCall.call] : summaries.callSites(fn);
293
+ for (const call of calls) {
294
+ if (parameter.dotDotDotToken) {
295
+ collectRestArguments(call, index, restFields, (item) => withStep(partOf(resolve(item, nextState), true), call));
296
+ continue;
297
+ }
298
+ const input = parameterInput(parameter, call.arguments[index], call, checker);
299
+ const result = resolve(input, input && input === parameter.initializer ? { ...nextState, defaultCall: { fn, call } } : nextState);
337
300
  if (result?.taint || result?.container || result?.sourceKind === 'archive-entry')
338
301
  return { ...result, steps: [...result.steps, step(call), step(parameter)] };
339
302
  }
303
+ return withStep(argumentsRecord(restFields), parameter);
340
304
  }
341
305
  // `const { body: { name } } = req`: the property path below the bound value, outermost first.
342
306
  function resolveBinding(element, state) {
343
- const names = [];
344
- let current = element;
345
- while (ts.isBindingElement(current)) {
346
- const pattern = current.parent;
347
- prependBindingPathSegment(current, names, pattern);
348
- current = pattern.parent;
349
- }
307
+ const fallback = selectedBindingDefault(element, checker);
308
+ if (fallback)
309
+ return withStep(resolve(fallback, state), element);
310
+ const { current, names } = bindingPath(element);
350
311
  let result;
351
312
  if (ts.isParameter(current))
352
313
  result = resolveParameter(current, state);
@@ -357,11 +318,12 @@ function createTaint(program) {
357
318
  for (const name of names) {
358
319
  if (!result)
359
320
  return;
360
- // A rest element keeps every remaining field.
361
- if (name === null)
321
+ if (typeof name === 'number' || name instanceof Set) {
322
+ result = restProjection(result, name);
362
323
  continue;
324
+ }
363
325
  if (result.container) {
364
- const field = name === undefined ? result.container.element : result.container.fields?.[name];
326
+ const field = name === undefined || /^\d+$/.test(name) ? result.container.element : result.container.fields?.[name];
365
327
  if (!field)
366
328
  return;
367
329
  result = field.taint
@@ -372,8 +334,8 @@ function createTaint(program) {
372
334
  }
373
335
  : { ...result, container: field };
374
336
  }
375
- else if (result.objectFields)
376
- result = name === null ? result : objectField(result, name);
337
+ else if (result.objectFields && !result.wrapper)
338
+ result = objectField(result, name);
377
339
  else
378
340
  result = boundField(result, name, state.sinkKind);
379
341
  }
@@ -413,7 +375,7 @@ function createTaint(program) {
413
375
  return withStep(loop, declaration);
414
376
  }
415
377
  else {
416
- const initial = withFieldWrites(resolve(declaration.initializer, state), declaration, state);
378
+ const initial = withFieldWrites(resolve(declaration.initializer, state), declaration, identifier, state);
417
379
  if (declaration.parent.flags & ts.NodeFlags.Const)
418
380
  return withStep(initial, declaration);
419
381
  if (initial?.objectFields)
@@ -439,44 +401,55 @@ function createTaint(program) {
439
401
  const scope = ts.findAncestor(declaration, (node) => ts.isFunctionLike(node) || ts.isSourceFile(node));
440
402
  if (!scope || !initial.objectFields)
441
403
  return initial;
442
- const fields = new Map(initial.objectFields);
404
+ let result = initial;
443
405
  for (const assignment of assignmentsTo(declaration, scope, checker)) {
444
406
  if (assignment.left === identifier)
445
407
  continue;
446
408
  const assigned = partOf(resolve(assignment.right, state), true);
447
- // `record = req.body`: a value with unknown fields taints every field.
448
409
  if (assigned && !assigned.objectFields)
449
410
  return withStep(assigned, assignment);
450
- for (const [name, field] of assigned?.objectFields ?? [])
451
- fields.set(name, eitherField(fields.get(name), field));
411
+ if (assigned)
412
+ result = eitherField(result, assigned);
452
413
  }
453
- return { ...initial, objectFields: fields };
414
+ return result;
454
415
  }
455
416
  // `const record = {}; record.name = req.body.name`: the literal is not the whole value once a field
456
417
  // is written, so each tainted write adds its field. A tainted computed-key write taints every
457
418
  // field. A value tainted as a whole already covers every field.
458
- function withFieldWrites(initial, declaration, state) {
419
+ function withFieldWrites(initial, declaration, use, state, reaches) {
459
420
  if (initial && !initial.objectFields)
460
421
  return initial;
461
422
  const initializer = strip(declaration.initializer);
462
- if (!initializer || !ts.isObjectLiteralExpression(initializer))
423
+ if (!initializer || (!ts.isObjectLiteralExpression(initializer) && !isNullRecordCall(initializer, checker)))
463
424
  return initial;
464
425
  const scope = ts.findAncestor(declaration, (node) => ts.isFunctionLike(node) || ts.isSourceFile(node));
465
426
  if (!scope)
466
427
  return initial;
428
+ let escaped;
429
+ const mayEscape = () => (escaped ??= escapedBefore(declaration, scope, use, checker));
467
430
  let result = initial;
468
- for (const { name, assignment } of fieldWritesTo(declaration, scope, checker)) {
469
- const written = withStep(partOf(resolve(assignment.right, state), true), assignment);
470
- if (!written)
431
+ if (result?.unknownObjectField && result.cleanObjectFields?.size && mayEscape())
432
+ result = { ...result, cleanObjectFields: undefined };
433
+ const writes = fieldWritesTo(declaration, scope, checker);
434
+ for (const { path, assignment } of writes) {
435
+ if (reaches && !reaches(assignment))
471
436
  continue;
472
- if (name === undefined)
473
- return partOf(written);
474
- const base = result ?? partOf(written);
475
- if (!base)
437
+ const sequential = alwaysOverwrites(assignment, declaration);
438
+ const loopCarried = loopCarriedBeforeInitializer(declaration, assignment, use);
439
+ if (loopCarried && overwrittenBeforeReadInLoop(writes, { path, assignment }, declaration, use))
476
440
  continue;
477
- const fields = new Map(result?.objectFields);
478
- fields.set(name, alwaysOverwrites(assignment, declaration) ? written : eitherField(fields.get(name), written));
479
- result = { ...base, objectFields: fields, objectSteps: result?.objectSteps ?? base.steps.length };
441
+ if (sequential &&
442
+ assignment.pos >= use.end &&
443
+ enclosesWithoutCallback(assignment.parent.parent, use) &&
444
+ !loopCarried)
445
+ continue;
446
+ const written = withStep(partOf(resolve(assignment.right, state), true), assignment);
447
+ // A loop-carried write after the read still runs before the next iteration's read, so a later
448
+ // unconditional overwrite replaces it.
449
+ const replace = sequential && (assignment.end <= use.pos || loopCarried) && (written !== undefined || !mayEscape());
450
+ if (!written && !replace)
451
+ continue;
452
+ result = updateField(result, path, written, replace);
480
453
  }
481
454
  return result;
482
455
  }
@@ -485,6 +458,8 @@ function createTaint(program) {
485
458
  return;
486
459
  if (state.sinkKind === 'regex' && isRegexEscape(call, checker))
487
460
  return;
461
+ if (state.sinkKind === 'ldap' && isLdapFilterEscape(call, checker))
462
+ return;
488
463
  const callee = strip(call.expression);
489
464
  if (ts.isPropertyAccessExpression(callee)) {
490
465
  const receiver = resolve(callee.expression, state);
@@ -532,20 +507,31 @@ function createTaint(program) {
532
507
  return Boolean(kinds && argumentValidations(call, program).some(({ kind, mode }) => mode === 'returns' && kinds.includes(kind)));
533
508
  }
534
509
  // A schema that only admits numbers, booleans, dates, fixed values or a closed alphabet returns
535
- // clean data; an open schema (`z.string()`) returns its input. A schema that cannot be read is an
536
- // unknown call, so clean.
510
+ // clean data. A recognized parser with an open or unknown output retains its input provenance.
537
511
  function resolveValidated(call, { input, schema, wrapper }, state) {
538
512
  const shape = schema && schemaShape(schema, checker);
539
- if (!shape || shape.kind === 'closed' || !input)
513
+ if (shape?.kind === 'closed' || !input)
540
514
  return;
541
515
  const result = partOf(resolve(input, state), true);
542
516
  return result && withStep({ ...result, schema: shape, wrapper, dto: undefined }, call);
543
517
  }
544
- function resolvePropagation(call, callee, { from, name, stringResult }, state) {
518
+ function resolvePropagation(call, callee, { from, name, stringResult, argumentSources }, state) {
545
519
  if (stringIsSafe(state.sinkKind) && (name === 'String' || stringResult))
546
520
  return;
547
- if (from === 'receiver')
548
- return ts.isPropertyAccessExpression(callee) ? partOf(resolve(callee.expression, state)) : undefined;
521
+ if (from === 'receiver') {
522
+ if (!ts.isPropertyAccessExpression(callee))
523
+ return;
524
+ const receiverResult = partOf(resolve(callee.expression, state));
525
+ if (receiverResult)
526
+ return receiverResult;
527
+ if (argumentSources === 'all')
528
+ return first(call.arguments, (node) => resolve(node, state));
529
+ if (typeof argumentSources === 'number') {
530
+ const argument = call.arguments[argumentSources];
531
+ return argument ? partOf(resolve(argument, state)) : undefined;
532
+ }
533
+ return;
534
+ }
549
535
  const keepWhole = from === 'keep' || from === 'keep-any';
550
536
  const inputs = from === 'any' || from === 'keep-any' ? call.arguments : call.arguments.slice(0, 1);
551
537
  return first(inputs, (node) => resolve(node, state), keepWhole);
@@ -598,18 +584,4 @@ function createTaint(program) {
598
584
  taintByProgram.set(program, api);
599
585
  return api;
600
586
  }
601
- function propertyKey(name) {
602
- if (ts.isIdentifier(name) || ts.isStringLiteralLike(name) || ts.isNumericLiteral(name))
603
- return name.text;
604
- }
605
- function prependBindingPathSegment(current, names, pattern) {
606
- if (current.dotDotDotToken)
607
- names.unshift(null);
608
- else if (ts.isArrayBindingPattern(pattern))
609
- names.unshift(undefined);
610
- else {
611
- const property = current.propertyName ?? current.name;
612
- names.unshift(ts.isIdentifier(property) || ts.isStringLiteralLike(property) ? property.text : undefined);
613
- }
614
- }
615
587
  export { createTaint };
@@ -1,7 +1,7 @@
1
1
  // Calls that carry taint from an input to their result (design section 2.3). Any call not listed
2
2
  // here, and not a project-local function with a return summary, returns a clean value:
3
3
  // under-tainting is the precision lever.
4
- import { ts } from '../../performance/engine/compiler.js';
4
+ import { isDefaultLibrary, ts } from '../../performance/engine/compiler.js';
5
5
  import { importedFrom } from '../bindings.js';
6
6
  import { couldBeString } from './sanitizers.js';
7
7
  // For a string receiver these operations return a string or split it into an array of strings.
@@ -40,11 +40,18 @@ const receiverMethods = new Set([
40
40
  const stringResultMethodNames = new Set(stringResultMethods);
41
41
  // Global functions whose result carries their first argument's taint. `String` is a sanitizer for
42
42
  // NoSQL filters.
43
- const globalFunctions = new Set(['String', 'decodeURI', 'decodeURIComponent', 'encodeURI', 'structuredClone']);
43
+ const globalFunctions = new Map([
44
+ ['String', 'first'],
45
+ ['decodeURI', 'first'],
46
+ ['decodeURIComponent', 'first'],
47
+ ['encodeURI', 'first'],
48
+ ['structuredClone', 'keep'],
49
+ ]);
44
50
  // Module or global namespaces: exported function -> 'first' (argument 0), 'any' (any argument), or
45
51
  // 'keep' (argument 0 with its `whole` flag kept, for copies of the whole object).
46
52
  const namespaceFunctions = {
47
53
  // Parsing a whole body yields a whole object, which a Mongo filter can take as operators.
54
+ globalThis: { structuredClone: 'keep' },
48
55
  JSON: { parse: 'keep', stringify: 'first' },
49
56
  Buffer: { from: 'first' },
50
57
  Promise: { resolve: 'keep', all: 'first', allSettled: 'first', race: 'first' },
@@ -56,7 +63,7 @@ const namespaceFunctions = {
56
63
  qs: { parse: 'first' },
57
64
  lodash: { get: 'first', pick: 'first', omit: 'keep', clone: 'keep', cloneDeep: 'keep' },
58
65
  };
59
- const globalNamespaces = new Set(['JSON', 'Buffer', 'Object', 'Promise', 'Array']);
66
+ const globalNamespaces = new Set(['JSON', 'Buffer', 'Object', 'Promise', 'Array', 'globalThis']);
60
67
  function isGlobal(identifier, checker) {
61
68
  const declaration = checker.getSymbolAtLocation(identifier)?.declarations?.[0];
62
69
  return !declaration || declaration.getSourceFile().isDeclarationFile;
@@ -80,16 +87,40 @@ function ignoresElement(callback) {
80
87
  return (ts.isIdentifier(node) && names.has(node.text)) || ts.forEachChild(node, reads);
81
88
  })(fn.body);
82
89
  }
90
+ // Own-property lookup so inherited Object.prototype members (e.g. toString) never act as propagators.
91
+ function ownLookup(record, key) {
92
+ return record && Object.prototype.hasOwnProperty.call(record, key) ? record[key] : undefined;
93
+ }
94
+ const builtinStringOwners = new Set(['String']);
95
+ const builtinConcatOwners = new Set(['String', 'Array', 'ReadonlyArray']);
96
+ function isBuiltinReceiverMethod(callee, owners, checker) {
97
+ const declarations = checker.getSymbolAtLocation(callee.name)?.declarations;
98
+ if (!declarations?.length)
99
+ return false;
100
+ return declarations.every((declaration) => isDefaultLibrary(checker, declaration.getSourceFile()) &&
101
+ ts.isInterfaceDeclaration(declaration.parent) &&
102
+ owners.has(declaration.parent.name.text));
103
+ }
104
+ function argumentSourcesOf(callee, method, checker) {
105
+ if (method === 'concat')
106
+ return isBuiltinReceiverMethod(callee, builtinConcatOwners, checker) ? 'all' : undefined;
107
+ if (method === 'replace' || method === 'replaceAll')
108
+ return isBuiltinReceiverMethod(callee, builtinStringOwners, checker) ? 1 : undefined;
109
+ return undefined;
110
+ }
83
111
  // How a call propagates: { from: 'receiver' } or { from: 'first' | 'any' | 'keep' | 'keep-any',
84
112
  // name }, or undefined when it does not.
85
113
  function propagation(call, checker) {
86
114
  const callee = ts.skipOuterExpressions(call.expression);
87
115
  if (ts.isIdentifier(callee)) {
88
- if (globalFunctions.has(callee.text) && isGlobal(callee, checker))
89
- return { from: 'first', name: callee.text };
116
+ const from = globalFunctions.get(callee.text);
117
+ if (from && isGlobal(callee, checker))
118
+ return { from, name: callee.text };
90
119
  const binding = importedFrom(callee, checker);
91
120
  const exported = binding?.exported;
92
- const mode = binding && exported !== undefined ? namespaceFunctions[binding.module]?.[exported] : undefined;
121
+ const mode = binding && exported !== undefined
122
+ ? ownLookup(ownLookup(namespaceFunctions, binding.module), exported)
123
+ : undefined;
93
124
  return mode ? { from: mode, name: exported } : undefined;
94
125
  }
95
126
  if (!ts.isPropertyAccessExpression(callee))
@@ -101,19 +132,22 @@ function propagation(call, checker) {
101
132
  const namespace = binding
102
133
  ? (binding.exported === '*' || binding.exported === 'default') && binding.module
103
134
  : globalNamespaces.has(receiver.text) && isGlobal(receiver, checker) && receiver.text;
104
- const functions = namespace ? namespaceFunctions[namespace] : undefined;
135
+ const functions = namespace ? ownLookup(namespaceFunctions, namespace) : undefined;
105
136
  if (functions) {
106
- const mode = functions[method];
137
+ const mode = ownLookup(functions, method);
107
138
  return mode ? { from: mode, name: method } : undefined;
108
139
  }
109
140
  }
110
141
  if ((method === 'map' || method === 'flatMap') && ignoresElement(call.arguments[0]))
111
142
  return;
112
143
  if (receiverMethods.has(method)) {
144
+ const argumentSources = argumentSourcesOf(callee, method, checker);
113
145
  return {
114
146
  from: 'receiver',
115
147
  name: method,
116
- stringResult: stringResultMethodNames.has(method) && couldBeString(callee.expression, checker),
148
+ stringResult: (stringResultMethodNames.has(method) || (method === 'concat' && argumentSources === 'all')) &&
149
+ (couldBeString(callee.expression, checker) || isBuiltinReceiverMethod(callee, builtinStringOwners, checker)),
150
+ ...(argumentSources !== undefined ? { argumentSources } : {}),
117
151
  };
118
152
  }
119
153
  }