@neurcode-ai/cli 0.9.63 → 0.9.65

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 (308) hide show
  1. package/LICENSE +201 -0
  2. package/dist/commands/brain.d.ts.map +1 -1
  3. package/dist/commands/brain.js +273 -0
  4. package/dist/commands/brain.js.map +1 -1
  5. package/dist/commands/control-plane.js +7 -7
  6. package/dist/commands/control-plane.js.map +1 -1
  7. package/dist/commands/fix.d.ts.map +1 -1
  8. package/dist/commands/fix.js +108 -1
  9. package/dist/commands/fix.js.map +1 -1
  10. package/dist/commands/patch-apply.d.ts +2 -0
  11. package/dist/commands/patch-apply.d.ts.map +1 -1
  12. package/dist/commands/patch-apply.js +331 -19
  13. package/dist/commands/patch-apply.js.map +1 -1
  14. package/dist/commands/pilot-report.d.ts +9 -0
  15. package/dist/commands/pilot-report.d.ts.map +1 -0
  16. package/dist/commands/pilot-report.js +176 -0
  17. package/dist/commands/pilot-report.js.map +1 -0
  18. package/dist/commands/remediate-governance.d.ts +54 -0
  19. package/dist/commands/remediate-governance.d.ts.map +1 -0
  20. package/dist/commands/remediate-governance.js +375 -0
  21. package/dist/commands/remediate-governance.js.map +1 -0
  22. package/dist/commands/remediate.d.ts.map +1 -1
  23. package/dist/commands/remediate.js.map +1 -1
  24. package/dist/commands/replay.d.ts.map +1 -1
  25. package/dist/commands/replay.js +35 -5
  26. package/dist/commands/replay.js.map +1 -1
  27. package/dist/commands/verify.d.ts.map +1 -1
  28. package/dist/commands/verify.js +336 -25
  29. package/dist/commands/verify.js.map +1 -1
  30. package/dist/commands/workspace.js +7 -7
  31. package/dist/commands/workspace.js.map +1 -1
  32. package/dist/daemon/server.d.ts +2 -2
  33. package/dist/daemon/server.d.ts.map +1 -1
  34. package/dist/daemon/server.js +2113 -32
  35. package/dist/daemon/server.js.map +1 -1
  36. package/dist/explainability/DeterminismClassifier.d.ts +34 -0
  37. package/dist/explainability/DeterminismClassifier.d.ts.map +1 -0
  38. package/dist/explainability/DeterminismClassifier.js +104 -0
  39. package/dist/explainability/DeterminismClassifier.js.map +1 -0
  40. package/dist/explainability/ViolationFormatter.d.ts +32 -0
  41. package/dist/explainability/ViolationFormatter.d.ts.map +1 -0
  42. package/dist/explainability/ViolationFormatter.js +252 -0
  43. package/dist/explainability/ViolationFormatter.js.map +1 -0
  44. package/dist/explainability/index.d.ts +15 -0
  45. package/dist/explainability/index.d.ts.map +1 -0
  46. package/dist/explainability/index.js +94 -0
  47. package/dist/explainability/index.js.map +1 -0
  48. package/dist/explainability/types.d.ts +37 -0
  49. package/dist/explainability/types.d.ts.map +1 -0
  50. package/dist/explainability/types.js +3 -0
  51. package/dist/explainability/types.js.map +1 -0
  52. package/dist/governance/canonical-pipeline.d.ts +38 -0
  53. package/dist/governance/canonical-pipeline.d.ts.map +1 -0
  54. package/dist/governance/canonical-pipeline.js +448 -0
  55. package/dist/governance/canonical-pipeline.js.map +1 -0
  56. package/dist/governance/structural-on-diff.d.ts +13 -0
  57. package/dist/governance/structural-on-diff.d.ts.map +1 -0
  58. package/dist/governance/structural-on-diff.js +35 -0
  59. package/dist/governance/structural-on-diff.js.map +1 -0
  60. package/dist/governance/structural-policy-merge.d.ts +14 -0
  61. package/dist/governance/structural-policy-merge.d.ts.map +1 -0
  62. package/dist/governance/structural-policy-merge.js +25 -0
  63. package/dist/governance/structural-policy-merge.js.map +1 -0
  64. package/dist/index.js +86 -4
  65. package/dist/index.js.map +1 -1
  66. package/dist/integrations/review-compression/index.d.ts +50 -0
  67. package/dist/integrations/review-compression/index.d.ts.map +1 -0
  68. package/dist/integrations/review-compression/index.js +158 -0
  69. package/dist/integrations/review-compression/index.js.map +1 -0
  70. package/dist/intent-engine/domain-taxonomy.d.ts +42 -0
  71. package/dist/intent-engine/domain-taxonomy.d.ts.map +1 -0
  72. package/dist/intent-engine/domain-taxonomy.js +534 -0
  73. package/dist/intent-engine/domain-taxonomy.js.map +1 -0
  74. package/dist/intent-engine/index.d.ts +1 -0
  75. package/dist/intent-engine/index.d.ts.map +1 -1
  76. package/dist/intent-engine/index.js +6 -1
  77. package/dist/intent-engine/index.js.map +1 -1
  78. package/dist/intent-engine/matcher.d.ts.map +1 -1
  79. package/dist/intent-engine/matcher.js +2 -0
  80. package/dist/intent-engine/matcher.js.map +1 -1
  81. package/dist/intent-engine/parser.d.ts.map +1 -1
  82. package/dist/intent-engine/parser.js +47 -0
  83. package/dist/intent-engine/parser.js.map +1 -1
  84. package/dist/intent-engine/semantic-expander.d.ts +104 -0
  85. package/dist/intent-engine/semantic-expander.d.ts.map +1 -0
  86. package/dist/intent-engine/semantic-expander.js +480 -0
  87. package/dist/intent-engine/semantic-expander.js.map +1 -0
  88. package/dist/patch-engine/diff.d.ts +1 -1
  89. package/dist/patch-engine/diff.js +1 -1
  90. package/dist/patch-engine/generator.d.ts +9 -0
  91. package/dist/patch-engine/generator.d.ts.map +1 -1
  92. package/dist/patch-engine/generator.js +375 -17
  93. package/dist/patch-engine/generator.js.map +1 -1
  94. package/dist/patch-engine/index.d.ts +25 -25
  95. package/dist/patch-engine/index.d.ts.map +1 -1
  96. package/dist/patch-engine/index.js +134 -87
  97. package/dist/patch-engine/index.js.map +1 -1
  98. package/dist/patch-engine/patterns.d.ts +1 -1
  99. package/dist/patch-engine/patterns.d.ts.map +1 -1
  100. package/dist/patch-engine/patterns.js +282 -41
  101. package/dist/patch-engine/patterns.js.map +1 -1
  102. package/dist/patch-engine/rollback.d.ts +31 -0
  103. package/dist/patch-engine/rollback.d.ts.map +1 -0
  104. package/dist/patch-engine/rollback.js +275 -0
  105. package/dist/patch-engine/rollback.js.map +1 -0
  106. package/dist/patch-engine/safety.d.ts +28 -0
  107. package/dist/patch-engine/safety.d.ts.map +1 -0
  108. package/dist/patch-engine/safety.js +122 -0
  109. package/dist/patch-engine/safety.js.map +1 -0
  110. package/dist/patch-engine/transaction.d.ts +52 -0
  111. package/dist/patch-engine/transaction.d.ts.map +1 -0
  112. package/dist/patch-engine/transaction.js +93 -0
  113. package/dist/patch-engine/transaction.js.map +1 -0
  114. package/dist/semantic/index.d.ts +14 -0
  115. package/dist/semantic/index.d.ts.map +1 -0
  116. package/dist/semantic/index.js +30 -0
  117. package/dist/semantic/index.js.map +1 -0
  118. package/dist/semantic/tfidf-engine.d.ts +81 -0
  119. package/dist/semantic/tfidf-engine.d.ts.map +1 -0
  120. package/dist/semantic/tfidf-engine.js +278 -0
  121. package/dist/semantic/tfidf-engine.js.map +1 -0
  122. package/dist/semantic/vector-store.d.ts +108 -0
  123. package/dist/semantic/vector-store.d.ts.map +1 -0
  124. package/dist/semantic/vector-store.js +321 -0
  125. package/dist/semantic/vector-store.js.map +1 -0
  126. package/dist/structural-rules/context-severity.d.ts +46 -0
  127. package/dist/structural-rules/context-severity.d.ts.map +1 -0
  128. package/dist/structural-rules/context-severity.js +115 -0
  129. package/dist/structural-rules/context-severity.js.map +1 -0
  130. package/dist/structural-rules/distributed/DS001-saga-rollback-absence.d.ts +11 -0
  131. package/dist/structural-rules/distributed/DS001-saga-rollback-absence.d.ts.map +1 -0
  132. package/dist/structural-rules/distributed/DS001-saga-rollback-absence.js +212 -0
  133. package/dist/structural-rules/distributed/DS001-saga-rollback-absence.js.map +1 -0
  134. package/dist/structural-rules/distributed/DS002-missing-correlation-id.d.ts +11 -0
  135. package/dist/structural-rules/distributed/DS002-missing-correlation-id.d.ts.map +1 -0
  136. package/dist/structural-rules/distributed/DS002-missing-correlation-id.js +213 -0
  137. package/dist/structural-rules/distributed/DS002-missing-correlation-id.js.map +1 -0
  138. package/dist/structural-rules/distributed/index.d.ts +3 -0
  139. package/dist/structural-rules/distributed/index.d.ts.map +1 -0
  140. package/dist/structural-rules/distributed/index.js +8 -0
  141. package/dist/structural-rules/distributed/index.js.map +1 -0
  142. package/dist/structural-rules/engine.d.ts +25 -0
  143. package/dist/structural-rules/engine.d.ts.map +1 -0
  144. package/dist/structural-rules/engine.js +90 -0
  145. package/dist/structural-rules/engine.js.map +1 -0
  146. package/dist/structural-rules/index.d.ts +41 -0
  147. package/dist/structural-rules/index.d.ts.map +1 -0
  148. package/dist/structural-rules/index.js +141 -0
  149. package/dist/structural-rules/index.js.map +1 -0
  150. package/dist/structural-rules/python/PY001-asyncio-task-without-cancel.d.ts +11 -0
  151. package/dist/structural-rules/python/PY001-asyncio-task-without-cancel.d.ts.map +1 -0
  152. package/dist/structural-rules/python/PY001-asyncio-task-without-cancel.js +66 -0
  153. package/dist/structural-rules/python/PY001-asyncio-task-without-cancel.js.map +1 -0
  154. package/dist/structural-rules/python/PY002-unbounded-dict-singleton.d.ts +11 -0
  155. package/dist/structural-rules/python/PY002-unbounded-dict-singleton.d.ts.map +1 -0
  156. package/dist/structural-rules/python/PY002-unbounded-dict-singleton.js +135 -0
  157. package/dist/structural-rules/python/PY002-unbounded-dict-singleton.js.map +1 -0
  158. package/dist/structural-rules/python/PY003-broad-except-clause.d.ts +11 -0
  159. package/dist/structural-rules/python/PY003-broad-except-clause.d.ts.map +1 -0
  160. package/dist/structural-rules/python/PY003-broad-except-clause.js +86 -0
  161. package/dist/structural-rules/python/PY003-broad-except-clause.js.map +1 -0
  162. package/dist/structural-rules/python/PY004-swallowed-async-exception.d.ts +11 -0
  163. package/dist/structural-rules/python/PY004-swallowed-async-exception.d.ts.map +1 -0
  164. package/dist/structural-rules/python/PY004-swallowed-async-exception.js +167 -0
  165. package/dist/structural-rules/python/PY004-swallowed-async-exception.js.map +1 -0
  166. package/dist/structural-rules/python/PY005-fastapi-without-pydantic.d.ts +11 -0
  167. package/dist/structural-rules/python/PY005-fastapi-without-pydantic.d.ts.map +1 -0
  168. package/dist/structural-rules/python/PY005-fastapi-without-pydantic.js +154 -0
  169. package/dist/structural-rules/python/PY005-fastapi-without-pydantic.js.map +1 -0
  170. package/dist/structural-rules/python/PY006-blocking-io-in-async.d.ts +11 -0
  171. package/dist/structural-rules/python/PY006-blocking-io-in-async.d.ts.map +1 -0
  172. package/dist/structural-rules/python/PY006-blocking-io-in-async.js +130 -0
  173. package/dist/structural-rules/python/PY006-blocking-io-in-async.js.map +1 -0
  174. package/dist/structural-rules/python/PY007-sqlalchemy-session-leak.d.ts +11 -0
  175. package/dist/structural-rules/python/PY007-sqlalchemy-session-leak.d.ts.map +1 -0
  176. package/dist/structural-rules/python/PY007-sqlalchemy-session-leak.js +93 -0
  177. package/dist/structural-rules/python/PY007-sqlalchemy-session-leak.js.map +1 -0
  178. package/dist/structural-rules/python/PY008-celery-task-without-retry.d.ts +11 -0
  179. package/dist/structural-rules/python/PY008-celery-task-without-retry.d.ts.map +1 -0
  180. package/dist/structural-rules/python/PY008-celery-task-without-retry.js +154 -0
  181. package/dist/structural-rules/python/PY008-celery-task-without-retry.js.map +1 -0
  182. package/dist/structural-rules/python/PY009-unsafe-pickle-deserialization.d.ts +11 -0
  183. package/dist/structural-rules/python/PY009-unsafe-pickle-deserialization.d.ts.map +1 -0
  184. package/dist/structural-rules/python/PY009-unsafe-pickle-deserialization.js +133 -0
  185. package/dist/structural-rules/python/PY009-unsafe-pickle-deserialization.js.map +1 -0
  186. package/dist/structural-rules/python/PY010-leaked-aiohttp-session.d.ts +11 -0
  187. package/dist/structural-rules/python/PY010-leaked-aiohttp-session.d.ts.map +1 -0
  188. package/dist/structural-rules/python/PY010-leaked-aiohttp-session.js +80 -0
  189. package/dist/structural-rules/python/PY010-leaked-aiohttp-session.js.map +1 -0
  190. package/dist/structural-rules/rules/SR001-swallowed-async-rejection.d.ts +11 -0
  191. package/dist/structural-rules/rules/SR001-swallowed-async-rejection.d.ts.map +1 -0
  192. package/dist/structural-rules/rules/SR001-swallowed-async-rejection.js +145 -0
  193. package/dist/structural-rules/rules/SR001-swallowed-async-rejection.js.map +1 -0
  194. package/dist/structural-rules/rules/SR002-unbounded-collection.d.ts +11 -0
  195. package/dist/structural-rules/rules/SR002-unbounded-collection.d.ts.map +1 -0
  196. package/dist/structural-rules/rules/SR002-unbounded-collection.js +196 -0
  197. package/dist/structural-rules/rules/SR002-unbounded-collection.js.map +1 -0
  198. package/dist/structural-rules/rules/SR003-timer-without-cleanup.d.ts +11 -0
  199. package/dist/structural-rules/rules/SR003-timer-without-cleanup.d.ts.map +1 -0
  200. package/dist/structural-rules/rules/SR003-timer-without-cleanup.js +148 -0
  201. package/dist/structural-rules/rules/SR003-timer-without-cleanup.js.map +1 -0
  202. package/dist/structural-rules/rules/SR004-request-boundary-no-validation.d.ts +11 -0
  203. package/dist/structural-rules/rules/SR004-request-boundary-no-validation.d.ts.map +1 -0
  204. package/dist/structural-rules/rules/SR004-request-boundary-no-validation.js +162 -0
  205. package/dist/structural-rules/rules/SR004-request-boundary-no-validation.js.map +1 -0
  206. package/dist/structural-rules/rules/SR005-halfopen-probe-gate.d.ts +11 -0
  207. package/dist/structural-rules/rules/SR005-halfopen-probe-gate.d.ts.map +1 -0
  208. package/dist/structural-rules/rules/SR005-halfopen-probe-gate.js +150 -0
  209. package/dist/structural-rules/rules/SR005-halfopen-probe-gate.js.map +1 -0
  210. package/dist/structural-rules/rules/SR006-fanout-error-sanitization.d.ts +11 -0
  211. package/dist/structural-rules/rules/SR006-fanout-error-sanitization.d.ts.map +1 -0
  212. package/dist/structural-rules/rules/SR006-fanout-error-sanitization.js +161 -0
  213. package/dist/structural-rules/rules/SR006-fanout-error-sanitization.js.map +1 -0
  214. package/dist/structural-rules/rules/SR007-cross-request-error.d.ts +11 -0
  215. package/dist/structural-rules/rules/SR007-cross-request-error.d.ts.map +1 -0
  216. package/dist/structural-rules/rules/SR007-cross-request-error.js +175 -0
  217. package/dist/structural-rules/rules/SR007-cross-request-error.js.map +1 -0
  218. package/dist/structural-rules/rules/SR008-background-task-orphan.d.ts +11 -0
  219. package/dist/structural-rules/rules/SR008-background-task-orphan.d.ts.map +1 -0
  220. package/dist/structural-rules/rules/SR008-background-task-orphan.js +176 -0
  221. package/dist/structural-rules/rules/SR008-background-task-orphan.js.map +1 -0
  222. package/dist/structural-rules/rules/SR009-missing-retry-backoff.d.ts +11 -0
  223. package/dist/structural-rules/rules/SR009-missing-retry-backoff.d.ts.map +1 -0
  224. package/dist/structural-rules/rules/SR009-missing-retry-backoff.js +168 -0
  225. package/dist/structural-rules/rules/SR009-missing-retry-backoff.js.map +1 -0
  226. package/dist/structural-rules/rules/SR010-retry-storm.d.ts +11 -0
  227. package/dist/structural-rules/rules/SR010-retry-storm.d.ts.map +1 -0
  228. package/dist/structural-rules/rules/SR010-retry-storm.js +181 -0
  229. package/dist/structural-rules/rules/SR010-retry-storm.js.map +1 -0
  230. package/dist/structural-rules/rules/SR011-event-listener-leak.d.ts +11 -0
  231. package/dist/structural-rules/rules/SR011-event-listener-leak.d.ts.map +1 -0
  232. package/dist/structural-rules/rules/SR011-event-listener-leak.js +208 -0
  233. package/dist/structural-rules/rules/SR011-event-listener-leak.js.map +1 -0
  234. package/dist/structural-rules/rules/SR012-promise-race-leak.d.ts +11 -0
  235. package/dist/structural-rules/rules/SR012-promise-race-leak.d.ts.map +1 -0
  236. package/dist/structural-rules/rules/SR012-promise-race-leak.js +191 -0
  237. package/dist/structural-rules/rules/SR012-promise-race-leak.js.map +1 -0
  238. package/dist/structural-rules/rules/SR013-missing-idempotency-key.d.ts +11 -0
  239. package/dist/structural-rules/rules/SR013-missing-idempotency-key.d.ts.map +1 -0
  240. package/dist/structural-rules/rules/SR013-missing-idempotency-key.js +219 -0
  241. package/dist/structural-rules/rules/SR013-missing-idempotency-key.js.map +1 -0
  242. package/dist/structural-rules/rules/SR014-mutable-closure-async.d.ts +11 -0
  243. package/dist/structural-rules/rules/SR014-mutable-closure-async.d.ts.map +1 -0
  244. package/dist/structural-rules/rules/SR014-mutable-closure-async.js +208 -0
  245. package/dist/structural-rules/rules/SR014-mutable-closure-async.js.map +1 -0
  246. package/dist/structural-rules/rules/SR015-dangling-abort-controller.d.ts +11 -0
  247. package/dist/structural-rules/rules/SR015-dangling-abort-controller.d.ts.map +1 -0
  248. package/dist/structural-rules/rules/SR015-dangling-abort-controller.js +190 -0
  249. package/dist/structural-rules/rules/SR015-dangling-abort-controller.js.map +1 -0
  250. package/dist/structural-rules/rules/SR016-unsafe-json-parse.d.ts +11 -0
  251. package/dist/structural-rules/rules/SR016-unsafe-json-parse.d.ts.map +1 -0
  252. package/dist/structural-rules/rules/SR016-unsafe-json-parse.js +187 -0
  253. package/dist/structural-rules/rules/SR016-unsafe-json-parse.js.map +1 -0
  254. package/dist/structural-rules/suppressions.d.ts +43 -0
  255. package/dist/structural-rules/suppressions.d.ts.map +1 -0
  256. package/dist/structural-rules/suppressions.js +115 -0
  257. package/dist/structural-rules/suppressions.js.map +1 -0
  258. package/dist/structural-rules/types.d.ts +43 -0
  259. package/dist/structural-rules/types.d.ts.map +1 -0
  260. package/dist/structural-rules/types.js +3 -0
  261. package/dist/structural-rules/types.js.map +1 -0
  262. package/dist/utils/advisory-signals.d.ts +5 -0
  263. package/dist/utils/advisory-signals.d.ts.map +1 -1
  264. package/dist/utils/advisory-signals.js +50 -12
  265. package/dist/utils/advisory-signals.js.map +1 -1
  266. package/dist/utils/ai-debt-budget.d.ts.map +1 -1
  267. package/dist/utils/ai-debt-budget.js +5 -2
  268. package/dist/utils/ai-debt-budget.js.map +1 -1
  269. package/dist/utils/brain-cache.d.ts +100 -0
  270. package/dist/utils/brain-cache.d.ts.map +1 -0
  271. package/dist/utils/brain-cache.js +346 -0
  272. package/dist/utils/brain-cache.js.map +1 -0
  273. package/dist/utils/cli-json.d.ts.map +1 -1
  274. package/dist/utils/cli-json.js +80 -12
  275. package/dist/utils/cli-json.js.map +1 -1
  276. package/dist/utils/execution-bus.d.ts +10 -0
  277. package/dist/utils/execution-bus.d.ts.map +1 -1
  278. package/dist/utils/execution-bus.js +16 -0
  279. package/dist/utils/execution-bus.js.map +1 -1
  280. package/dist/utils/governance-provenance.d.ts +95 -0
  281. package/dist/utils/governance-provenance.d.ts.map +1 -0
  282. package/dist/utils/governance-provenance.js +187 -0
  283. package/dist/utils/governance-provenance.js.map +1 -0
  284. package/dist/utils/pilot-metrics.d.ts +46 -0
  285. package/dist/utils/pilot-metrics.d.ts.map +1 -0
  286. package/dist/utils/pilot-metrics.js +240 -0
  287. package/dist/utils/pilot-metrics.js.map +1 -0
  288. package/dist/utils/policy-compiler.d.ts +6 -0
  289. package/dist/utils/policy-compiler.d.ts.map +1 -1
  290. package/dist/utils/policy-compiler.js +20 -0
  291. package/dist/utils/policy-compiler.js.map +1 -1
  292. package/dist/utils/replay-runtime.d.ts +34 -0
  293. package/dist/utils/replay-runtime.d.ts.map +1 -1
  294. package/dist/utils/replay-runtime.js +207 -0
  295. package/dist/utils/replay-runtime.js.map +1 -1
  296. package/dist/workspace/cross-repo-graph.d.ts +111 -0
  297. package/dist/workspace/cross-repo-graph.d.ts.map +1 -0
  298. package/dist/workspace/cross-repo-graph.js +450 -0
  299. package/dist/workspace/cross-repo-graph.js.map +1 -0
  300. package/dist/workspace/federated-context.d.ts +144 -0
  301. package/dist/workspace/federated-context.d.ts.map +1 -0
  302. package/dist/workspace/federated-context.js +347 -0
  303. package/dist/workspace/federated-context.js.map +1 -0
  304. package/dist/workspace/index.d.ts +38 -0
  305. package/dist/workspace/index.d.ts.map +1 -0
  306. package/dist/workspace/index.js +48 -0
  307. package/dist/workspace/index.js.map +1 -0
  308. package/package.json +10 -10
@@ -0,0 +1,196 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.SR002UnboundedCollection = void 0;
37
+ const ts = __importStar(require("typescript"));
38
+ function getLineAndCol(sf, pos) {
39
+ const lc = sf.getLineAndCharacterOfPosition(pos);
40
+ return { line: lc.line + 1, column: lc.character + 1 };
41
+ }
42
+ function getEvidenceLines(sourceText, line) {
43
+ const lines = sourceText.split('\n');
44
+ return (lines[line - 1] || '').slice(0, 120);
45
+ }
46
+ function typeTextIncludesMapOrSet(typeNode) {
47
+ const text = typeNode.getText();
48
+ return /\b(Map|Set)</.test(text);
49
+ }
50
+ function initializerIsMapOrSet(init) {
51
+ if (ts.isNewExpression(init) &&
52
+ ts.isIdentifier(init.expression)) {
53
+ const name = init.expression.text;
54
+ return name === 'Map' || name === 'Set';
55
+ }
56
+ return false;
57
+ }
58
+ function hasDeleteCallOnField(classNode, fieldName) {
59
+ let found = false;
60
+ const visitDelete = (node) => {
61
+ if (found)
62
+ return;
63
+ // Look for: this.fieldName.delete( or fieldName.delete(
64
+ if (ts.isCallExpression(node) &&
65
+ ts.isPropertyAccessExpression(node.expression) &&
66
+ node.expression.name.text === 'delete') {
67
+ const obj = node.expression.expression;
68
+ // this.fieldName.delete(
69
+ if (ts.isPropertyAccessExpression(obj) &&
70
+ obj.expression.kind === ts.SyntaxKind.ThisKeyword &&
71
+ obj.name.text === fieldName) {
72
+ found = true;
73
+ return;
74
+ }
75
+ // fieldName.delete( (direct reference)
76
+ if (ts.isIdentifier(obj) && obj.text === fieldName) {
77
+ found = true;
78
+ return;
79
+ }
80
+ }
81
+ ts.forEachChild(node, visitDelete);
82
+ };
83
+ ts.forEachChild(classNode, visitDelete);
84
+ return found;
85
+ }
86
+ function hasLruOrBoundComment(node, sf) {
87
+ const fullText = sf.getFullText();
88
+ const start = node.getFullStart();
89
+ const leadingTrivia = fullText.slice(start, node.getStart(sf));
90
+ const lruPattern = /lru|maxsize|max_size|capacity|bounded|evict|ttl/i;
91
+ return lruPattern.test(leadingTrivia);
92
+ }
93
+ function keyTypeIncludesString(typeText) {
94
+ // Map<K, V> — check if K contains 'string'
95
+ const inner = typeText.match(/(?:Map|Set)<([^,>]+)/);
96
+ if (!inner)
97
+ return false;
98
+ return /string/i.test(inner[1]);
99
+ }
100
+ class SR002UnboundedCollection {
101
+ id = 'SR002';
102
+ name = 'Unbounded collection';
103
+ policyRef = 'P006';
104
+ severity = 'BLOCKING';
105
+ languages = ['typescript', 'javascript'];
106
+ description = 'Class-level Map or Set fields with no size bound grow without limit, causing unbounded memory growth.';
107
+ check(filePath, sourceText) {
108
+ try {
109
+ const violations = [];
110
+ const ext = filePath.endsWith('.tsx')
111
+ ? ts.ScriptKind.TSX
112
+ : filePath.endsWith('.jsx')
113
+ ? ts.ScriptKind.JSX
114
+ : filePath.endsWith('.js')
115
+ ? ts.ScriptKind.JS
116
+ : ts.ScriptKind.TS;
117
+ const sf = ts.createSourceFile(filePath, sourceText, ts.ScriptTarget.Latest, true, ext);
118
+ const visitClass = (classNode) => {
119
+ for (const member of classNode.members) {
120
+ if (!ts.isPropertyDeclaration(member))
121
+ continue;
122
+ // Skip readonly
123
+ if (member.modifiers?.some(m => m.kind === ts.SyntaxKind.ReadonlyKeyword)) {
124
+ continue;
125
+ }
126
+ const typeNode = member.type;
127
+ const initializer = member.initializer;
128
+ let isMapOrSet = false;
129
+ let typeText = '';
130
+ if (typeNode) {
131
+ typeText = typeNode.getText(sf);
132
+ // Skip ReadonlyMap/ReadonlySet
133
+ if (/Readonly(Map|Set)/.test(typeText))
134
+ continue;
135
+ if (typeTextIncludesMapOrSet(typeNode))
136
+ isMapOrSet = true;
137
+ }
138
+ if (!isMapOrSet && initializer) {
139
+ if (initializerIsMapOrSet(initializer)) {
140
+ isMapOrSet = true;
141
+ if (ts.isNewExpression(initializer) && ts.isIdentifier(initializer.expression)) {
142
+ typeText = initializer.expression.text + '<string, unknown>';
143
+ }
144
+ }
145
+ }
146
+ if (!isMapOrSet)
147
+ continue;
148
+ // Only flag when key type contains 'string' (dynamic keys)
149
+ if (!keyTypeIncludesString(typeText))
150
+ continue;
151
+ // Skip if there's a .delete( call on this field anywhere in the class
152
+ const fieldName = ts.isIdentifier(member.name) ? member.name.text : '';
153
+ if (!fieldName)
154
+ continue;
155
+ if (hasDeleteCallOnField(classNode, fieldName))
156
+ continue;
157
+ // Skip if LRU/capacity comment nearby
158
+ if (hasLruOrBoundComment(member, sf))
159
+ continue;
160
+ const { line, column } = getLineAndCol(sf, member.getStart(sf));
161
+ const evidence = getEvidenceLines(sourceText, line);
162
+ violations.push({
163
+ ruleId: this.id,
164
+ ruleName: this.name,
165
+ policyRef: this.policyRef,
166
+ severity: this.severity,
167
+ filePath,
168
+ line,
169
+ column,
170
+ evidence,
171
+ operationalRisk: 'Class-level Map/Set keyed by dynamic strings grows without bound under sustained load, ' +
172
+ 'leading to OOM crashes or gradual memory exhaustion in long-running services.',
173
+ remediation: 'Replace with an LRU cache (e.g. `lru-cache`), add explicit eviction via `.delete()` calls, ' +
174
+ 'or cap size before each `.set()`. Document the bound with a comment.',
175
+ determinism: 'deterministic-structural',
176
+ confidence: 0.88,
177
+ language: filePath.match(/\.(js|jsx)$/) ? 'javascript' : 'typescript',
178
+ });
179
+ }
180
+ };
181
+ const visitNode = (node) => {
182
+ if (ts.isClassDeclaration(node)) {
183
+ visitClass(node);
184
+ }
185
+ ts.forEachChild(node, visitNode);
186
+ };
187
+ ts.forEachChild(sf, visitNode);
188
+ return violations;
189
+ }
190
+ catch {
191
+ return [];
192
+ }
193
+ }
194
+ }
195
+ exports.SR002UnboundedCollection = SR002UnboundedCollection;
196
+ //# sourceMappingURL=SR002-unbounded-collection.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SR002-unbounded-collection.js","sourceRoot":"","sources":["../../../src/structural-rules/rules/SR002-unbounded-collection.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAAiC;AAGjC,SAAS,aAAa,CAAC,EAAiB,EAAE,GAAW;IACnD,MAAM,EAAE,GAAG,EAAE,CAAC,6BAA6B,CAAC,GAAG,CAAC,CAAC;IACjD,OAAO,EAAE,IAAI,EAAE,EAAE,CAAC,IAAI,GAAG,CAAC,EAAE,MAAM,EAAE,EAAE,CAAC,SAAS,GAAG,CAAC,EAAE,CAAC;AACzD,CAAC;AAED,SAAS,gBAAgB,CAAC,UAAkB,EAAE,IAAY;IACxD,MAAM,KAAK,GAAG,UAAU,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IACrC,OAAO,CAAC,KAAK,CAAC,IAAI,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;AAC/C,CAAC;AAED,SAAS,wBAAwB,CAAC,QAAqB;IACrD,MAAM,IAAI,GAAG,QAAQ,CAAC,OAAO,EAAE,CAAC;IAChC,OAAO,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACnC,CAAC;AAED,SAAS,qBAAqB,CAAC,IAAmB;IAChD,IACE,EAAE,CAAC,eAAe,CAAC,IAAI,CAAC;QACxB,EAAE,CAAC,YAAY,CAAC,IAAI,CAAC,UAAU,CAAC,EAChC,CAAC;QACD,MAAM,IAAI,GAAG,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC;QAClC,OAAO,IAAI,KAAK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AC,CAAC;YAEF,MAAM,SAAS,GAAG,CAAC,IAAa,EAAQ,EAAE;gBACxC,IAAI,EAAE,CAAC,kBAAkB,CAAC,IAAI,CAAC,EAAE,CAAC;oBAChC,UAAU,CAAC,IAAI,CAAC,CAAC;gBACnB,CAAC;gBACD,EAAE,CAAC,YAAY,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;YACnC,CAAC,CAAC;YAEF,EAAE,CAAC,YAAY,CAAC,EAAE,EAAE,SAAS,CAAC,CAAC;YAC/B,OAAO,UAAU,CAAC;QACpB,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,EAAE,CAAC;QACZ,CAAC;IACH,CAAC;CACF;AA7GD,4DA6GC"}
@@ -0,0 +1,11 @@
1
+ import { StructuralRule, StructuralViolation, RuleLanguage } from '../types';
2
+ export declare class SR003TimerWithoutCleanup implements StructuralRule {
3
+ id: string;
4
+ name: string;
5
+ policyRef: string;
6
+ severity: "BLOCKING";
7
+ languages: RuleLanguage[];
8
+ description: string;
9
+ check(filePath: string, sourceText: string): StructuralViolation[];
10
+ }
11
+ //# sourceMappingURL=SR003-timer-without-cleanup.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SR003-timer-without-cleanup.d.ts","sourceRoot":"","sources":["../../../src/structural-rules/rules/SR003-timer-without-cleanup.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAqD7E,qBAAa,wBAAyB,YAAW,cAAc;IAC7D,EAAE,SAAW;IACb,IAAI,SAA2B;IAC/B,SAAS,SAAU;IACnB,QAAQ,EAAG,UAAU,CAAU;IAC/B,SAAS,EAAE,YAAY,EAAE,CAAgC;IACzD,WAAW,SAC8G;IAEzH,KAAK,CAAC,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,mBAAmB,EAAE;CAsEnE"}
@@ -0,0 +1,148 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.SR003TimerWithoutCleanup = void 0;
37
+ const ts = __importStar(require("typescript"));
38
+ function getLineAndCol(sf, pos) {
39
+ const lc = sf.getLineAndCharacterOfPosition(pos);
40
+ return { line: lc.line + 1, column: lc.character + 1 };
41
+ }
42
+ function getEvidenceLines(sourceText, line) {
43
+ const lines = sourceText.split('\n');
44
+ return (lines[line - 1] || '').slice(0, 120);
45
+ }
46
+ function isInsideClassDeclaration(node) {
47
+ let current = node.parent;
48
+ while (current) {
49
+ if (ts.isClassDeclaration(current) || ts.isClassExpression(current))
50
+ return true;
51
+ current = current.parent;
52
+ }
53
+ return false;
54
+ }
55
+ /** Returns true if the call expression is the RHS of a `this.xxx = ...` assignment. */
56
+ function isAssignedToThisProperty(callNode) {
57
+ const parent = callNode.parent;
58
+ // Direct: this.x = setInterval(...)
59
+ if (ts.isBinaryExpression(parent) &&
60
+ parent.operatorToken.kind === ts.SyntaxKind.EqualsToken &&
61
+ parent.right === callNode &&
62
+ ts.isPropertyAccessExpression(parent.left) &&
63
+ parent.left.expression.kind === ts.SyntaxKind.ThisKeyword) {
64
+ return true;
65
+ }
66
+ // Variable declaration: const timer = setInterval(...), then check if timer is assigned to this.x
67
+ // We accept the simpler form: if stored in any local variable inside the same function body
68
+ // — we only require that it's NOT a bare ExpressionStatement
69
+ if (ts.isVariableDeclaration(parent)) {
70
+ // It's stored in a local variable. We accept this as "handled" to reduce false positives.
71
+ return true;
72
+ }
73
+ // Initializer of a property declaration: this.x = setInterval handled above;
74
+ // also handle PropertyDeclaration initializer
75
+ if (ts.isPropertyDeclaration(parent)) {
76
+ return true;
77
+ }
78
+ return false;
79
+ }
80
+ class SR003TimerWithoutCleanup {
81
+ id = 'SR003';
82
+ name = 'Timer without cleanup';
83
+ policyRef = 'P007';
84
+ severity = 'BLOCKING';
85
+ languages = ['typescript', 'javascript'];
86
+ description = 'setInterval/setTimeout inside a class method whose return value is not stored prevents cleanup, causing timer leaks.';
87
+ check(filePath, sourceText) {
88
+ try {
89
+ const violations = [];
90
+ const ext = filePath.endsWith('.tsx')
91
+ ? ts.ScriptKind.TSX
92
+ : filePath.endsWith('.jsx')
93
+ ? ts.ScriptKind.JSX
94
+ : filePath.endsWith('.js')
95
+ ? ts.ScriptKind.JS
96
+ : ts.ScriptKind.TS;
97
+ const sf = ts.createSourceFile(filePath, sourceText, ts.ScriptTarget.Latest, true, ext);
98
+ const visit = (node) => {
99
+ if (ts.isCallExpression(node) &&
100
+ ts.isIdentifier(node.expression) &&
101
+ (node.expression.text === 'setInterval' || node.expression.text === 'setTimeout')) {
102
+ // Must be inside a class
103
+ if (!isInsideClassDeclaration(node)) {
104
+ ts.forEachChild(node, visit);
105
+ return;
106
+ }
107
+ // If the call result is stored or assigned, it's fine
108
+ if (isAssignedToThisProperty(node)) {
109
+ ts.forEachChild(node, visit);
110
+ return;
111
+ }
112
+ // The parent must be an ExpressionStatement (bare call — result discarded)
113
+ if (!ts.isExpressionStatement(node.parent)) {
114
+ ts.forEachChild(node, visit);
115
+ return;
116
+ }
117
+ const { line, column } = getLineAndCol(sf, node.getStart(sf));
118
+ const evidence = getEvidenceLines(sourceText, line);
119
+ violations.push({
120
+ ruleId: this.id,
121
+ ruleName: this.name,
122
+ policyRef: this.policyRef,
123
+ severity: this.severity,
124
+ filePath,
125
+ line,
126
+ column,
127
+ evidence,
128
+ operationalRisk: 'Timer handle is not stored, so it cannot be cleared in a destroy/stop method. ' +
129
+ 'Each instance or re-initialization leaks a timer, causing memory leaks and runaway callbacks.',
130
+ remediation: 'Store the return value: `this.timer = setInterval(...)` and call `clearInterval(this.timer)` ' +
131
+ 'in the class destructor / stop() / dispose() method.',
132
+ determinism: 'deterministic-structural',
133
+ confidence: 0.91,
134
+ language: filePath.match(/\.(js|jsx)$/) ? 'javascript' : 'typescript',
135
+ });
136
+ }
137
+ ts.forEachChild(node, visit);
138
+ };
139
+ ts.forEachChild(sf, visit);
140
+ return violations;
141
+ }
142
+ catch {
143
+ return [];
144
+ }
145
+ }
146
+ }
147
+ exports.SR003TimerWithoutCleanup = SR003TimerWithoutCleanup;
148
+ //# sourceMappingURL=SR003-timer-without-cleanup.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SR003-timer-without-cleanup.js","sourceRoot":"","sources":["../../../src/structural-rules/rules/SR003-timer-without-cleanup.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAAiC;AAGjC,SAAS,aAAa,CAAC,EAAiB,EAAE,GAAW;IACnD,MAAM,EAAE,GAAG,EAAE,CAAC,6BAA6B,CAAC,GAAG,CAAC,CAAC;IACjD,OAAO,EAA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,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,YAAY;qBACtE,CAAC,CAAC;gBACL,CAAC;gBAED,EAAE,CAAC,YAAY,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;YAC/B,CAAC,CAAC;YAEF,EAAE,CAAC,YAAY,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC;YAC3B,OAAO,UAAU,CAAC;QACpB,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,EAAE,CAAC;QACZ,CAAC;IACH,CAAC;CACF;AA/ED,4DA+EC"}
@@ -0,0 +1,11 @@
1
+ import { StructuralRule, StructuralViolation, RuleLanguage } from '../types';
2
+ export declare class SR004RequestBoundaryNoValidation implements StructuralRule {
3
+ id: string;
4
+ name: string;
5
+ policyRef: string;
6
+ severity: "BLOCKING";
7
+ languages: RuleLanguage[];
8
+ description: string;
9
+ check(filePath: string, sourceText: string): StructuralViolation[];
10
+ }
11
+ //# sourceMappingURL=SR004-request-boundary-no-validation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SR004-request-boundary-no-validation.d.ts","sourceRoot":"","sources":["../../../src/structural-rules/rules/SR004-request-boundary-no-validation.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAuE7E,qBAAa,gCAAiC,YAAW,cAAc;IACrE,EAAE,SAAW;IACb,IAAI,SAA+C;IACnD,SAAS,SAAU;IACnB,QAAQ,EAAG,UAAU,CAAU;IAC/B,SAAS,EAAE,YAAY,EAAE,CAAgC;IACzD,WAAW,SACiH;IAE5H,KAAK,CAAC,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,mBAAmB,EAAE;CA+EnE"}
@@ -0,0 +1,162 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.SR004RequestBoundaryNoValidation = void 0;
37
+ const ts = __importStar(require("typescript"));
38
+ function getLineAndCol(sf, pos) {
39
+ const lc = sf.getLineAndCharacterOfPosition(pos);
40
+ return { line: lc.line + 1, column: lc.character + 1 };
41
+ }
42
+ function getEvidenceLines(sourceText, line) {
43
+ const lines = sourceText.split('\n');
44
+ return (lines[line - 1] || '').slice(0, 120);
45
+ }
46
+ function isTestFile(filePath) {
47
+ return /\.(test|spec)\.(ts|js|tsx|jsx)$/.test(filePath);
48
+ }
49
+ /** Collect all text in a node (recursive) */
50
+ function collectNodeText(node, sf) {
51
+ return node.getText(sf);
52
+ }
53
+ /** Check if function body text contains validation indicators */
54
+ function hasValidation(bodyText) {
55
+ return (/\.parse\s*\(/.test(bodyText) ||
56
+ /\.safeParse\s*\(/.test(bodyText) ||
57
+ /\bz\s*\./.test(bodyText) ||
58
+ /\bschema\s*\./.test(bodyText) ||
59
+ /\bvalidate\s*\(/.test(bodyText) ||
60
+ /\bjoi\b/.test(bodyText) ||
61
+ /\byup\b/.test(bodyText));
62
+ }
63
+ /** Collect req.body / request.body access nodes inside a function body */
64
+ function findReqBodyAccess(node, sf) {
65
+ const results = [];
66
+ const visit = (n) => {
67
+ // req.body / request.body
68
+ if (ts.isPropertyAccessExpression(n) &&
69
+ n.name.text === 'body' &&
70
+ ts.isIdentifier(n.expression) &&
71
+ (n.expression.text === 'req' || n.expression.text === 'request')) {
72
+ results.push(n);
73
+ }
74
+ // ctx.input (tRPC)
75
+ if (ts.isPropertyAccessExpression(n) &&
76
+ n.name.text === 'input' &&
77
+ ts.isIdentifier(n.expression) &&
78
+ n.expression.text === 'ctx') {
79
+ results.push(n);
80
+ }
81
+ ts.forEachChild(n, visit);
82
+ };
83
+ ts.forEachChild(node, visit);
84
+ return results;
85
+ }
86
+ function getFunctionBodyNode(node) {
87
+ return node.body;
88
+ }
89
+ class SR004RequestBoundaryNoValidation {
90
+ id = 'SR004';
91
+ name = 'Request boundary without input validation';
92
+ policyRef = 'P008';
93
+ severity = 'BLOCKING';
94
+ languages = ['typescript', 'javascript'];
95
+ description = 'Route handlers accessing req.body or ctx.input without schema validation allow malformed input to reach business logic.';
96
+ check(filePath, sourceText) {
97
+ try {
98
+ if (isTestFile(filePath))
99
+ return [];
100
+ const violations = [];
101
+ const ext = filePath.endsWith('.tsx')
102
+ ? ts.ScriptKind.TSX
103
+ : filePath.endsWith('.jsx')
104
+ ? ts.ScriptKind.JSX
105
+ : filePath.endsWith('.js')
106
+ ? ts.ScriptKind.JS
107
+ : ts.ScriptKind.TS;
108
+ const sf = ts.createSourceFile(filePath, sourceText, ts.ScriptTarget.Latest, true, ext);
109
+ const checkFunctionBody = (funcNode) => {
110
+ const body = getFunctionBodyNode(funcNode);
111
+ if (!body)
112
+ return;
113
+ const bodyText = collectNodeText(body, sf);
114
+ // Only flag if body accesses req.body / request.body / ctx.input
115
+ const accesses = findReqBodyAccess(body, sf);
116
+ if (accesses.length === 0)
117
+ return;
118
+ // If there's validation, skip
119
+ if (hasValidation(bodyText))
120
+ return;
121
+ // Report on first access
122
+ const firstAccess = accesses[0];
123
+ const { line, column } = getLineAndCol(sf, firstAccess.getStart(sf));
124
+ const evidence = getEvidenceLines(sourceText, line);
125
+ violations.push({
126
+ ruleId: this.id,
127
+ ruleName: this.name,
128
+ policyRef: this.policyRef,
129
+ severity: this.severity,
130
+ filePath,
131
+ line,
132
+ column,
133
+ evidence,
134
+ operationalRisk: 'Unvalidated request input reaches business logic. Attackers can inject unexpected types, ' +
135
+ 'missing fields, or oversized payloads that cause runtime crashes or data corruption.',
136
+ remediation: 'Parse input with a schema before use: `const data = MySchema.parse(req.body)` ' +
137
+ '(Zod) or `const { error, value } = schema.validate(req.body)` (Joi). ' +
138
+ 'Use the parsed/validated value, not req.body directly.',
139
+ determinism: 'deterministic-structural',
140
+ confidence: 0.85,
141
+ language: filePath.match(/\.(js|jsx)$/) ? 'javascript' : 'typescript',
142
+ });
143
+ };
144
+ const visit = (node) => {
145
+ if (ts.isFunctionDeclaration(node) ||
146
+ ts.isFunctionExpression(node) ||
147
+ ts.isArrowFunction(node) ||
148
+ ts.isMethodDeclaration(node)) {
149
+ checkFunctionBody(node);
150
+ }
151
+ ts.forEachChild(node, visit);
152
+ };
153
+ ts.forEachChild(sf, visit);
154
+ return violations;
155
+ }
156
+ catch {
157
+ return [];
158
+ }
159
+ }
160
+ }
161
+ exports.SR004RequestBoundaryNoValidation = SR004RequestBoundaryNoValidation;
162
+ //# sourceMappingURL=SR004-request-boundary-no-validation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SR004-request-boundary-no-validation.js","sourceRoot":"","sources":["../../../src/structural-rules/rules/SR004-request-boundary-no-validation.ts"],"names":[],"mappings":";;;;;;;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1
+ import { StructuralRule, StructuralViolation, RuleLanguage } from '../types';
2
+ export declare class SR005HalfOpenProbeGate implements StructuralRule {
3
+ id: string;
4
+ name: string;
5
+ policyRef: string;
6
+ severity: "ADVISORY";
7
+ languages: RuleLanguage[];
8
+ description: string;
9
+ check(filePath: string, sourceText: string): StructuralViolation[];
10
+ }
11
+ //# sourceMappingURL=SR005-halfopen-probe-gate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SR005-halfopen-probe-gate.d.ts","sourceRoot":"","sources":["../../../src/structural-rules/rules/SR005-halfopen-probe-gate.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AA8D7E,qBAAa,sBAAuB,YAAW,cAAc;IAC3D,EAAE,SAAW;IACb,IAAI,SAAkD;IACtD,SAAS,SAAU;IACnB,QAAQ,EAAG,UAAU,CAAU;IAC/B,SAAS,EAAE,YAAY,EAAE,CAAgC;IACzD,WAAW,SACyH;IAEpI,KAAK,CAAC,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,mBAAmB,EAAE;CAyDnE"}