ai-database 2.1.1 → 2.3.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 (268) hide show
  1. package/CHANGELOG.md +47 -1
  2. package/README.md +1063 -186
  3. package/dist/actions.d.ts +2 -2
  4. package/dist/actions.d.ts.map +1 -1
  5. package/dist/actions.js +1 -1
  6. package/dist/actions.js.map +1 -1
  7. package/dist/ai-promise-db.d.ts +52 -23
  8. package/dist/ai-promise-db.d.ts.map +1 -1
  9. package/dist/ai-promise-db.js +185 -164
  10. package/dist/ai-promise-db.js.map +1 -1
  11. package/dist/authorization.d.ts.map +1 -1
  12. package/dist/authorization.js +38 -30
  13. package/dist/authorization.js.map +1 -1
  14. package/dist/cascade-orchestrator.d.ts +404 -0
  15. package/dist/cascade-orchestrator.d.ts.map +1 -0
  16. package/dist/cascade-orchestrator.js +828 -0
  17. package/dist/cascade-orchestrator.js.map +1 -0
  18. package/dist/cascade-write-strategy.d.ts +584 -0
  19. package/dist/cascade-write-strategy.d.ts.map +1 -0
  20. package/dist/cascade-write-strategy.js +590 -0
  21. package/dist/cascade-write-strategy.js.map +1 -0
  22. package/dist/ch-adapter.d.ts +358 -0
  23. package/dist/ch-adapter.d.ts.map +1 -0
  24. package/dist/ch-adapter.js +929 -0
  25. package/dist/ch-adapter.js.map +1 -0
  26. package/dist/client/index.d.ts +42 -0
  27. package/dist/client/index.d.ts.map +1 -0
  28. package/dist/client/index.js +43 -0
  29. package/dist/client/index.js.map +1 -0
  30. package/dist/client.d.ts +266 -0
  31. package/dist/client.d.ts.map +1 -0
  32. package/dist/client.js +81 -0
  33. package/dist/client.js.map +1 -0
  34. package/dist/constants.d.ts +64 -1
  35. package/dist/constants.d.ts.map +1 -1
  36. package/dist/constants.js +52 -2
  37. package/dist/constants.js.map +1 -1
  38. package/dist/dataloader.d.ts +99 -0
  39. package/dist/dataloader.d.ts.map +1 -0
  40. package/dist/dataloader.js +225 -0
  41. package/dist/dataloader.js.map +1 -0
  42. package/dist/db-provider-port.d.ts +501 -0
  43. package/dist/db-provider-port.d.ts.map +1 -0
  44. package/dist/db-provider-port.js +113 -0
  45. package/dist/db-provider-port.js.map +1 -0
  46. package/dist/digital-objects-provider.d.ts +49 -0
  47. package/dist/digital-objects-provider.d.ts.map +1 -0
  48. package/dist/digital-objects-provider.js +55 -0
  49. package/dist/digital-objects-provider.js.map +1 -0
  50. package/dist/do-sqlite-adapter.d.ts +402 -0
  51. package/dist/do-sqlite-adapter.d.ts.map +1 -0
  52. package/dist/do-sqlite-adapter.js +745 -0
  53. package/dist/do-sqlite-adapter.js.map +1 -0
  54. package/dist/docs-rels/custom-types.d.ts +134 -0
  55. package/dist/docs-rels/custom-types.d.ts.map +1 -0
  56. package/dist/docs-rels/custom-types.js +70 -0
  57. package/dist/docs-rels/custom-types.js.map +1 -0
  58. package/dist/docs-rels/index.d.ts +16 -0
  59. package/dist/docs-rels/index.d.ts.map +1 -0
  60. package/dist/docs-rels/index.js +16 -0
  61. package/dist/docs-rels/index.js.map +1 -0
  62. package/dist/docs-rels/migrations/index.d.ts +30 -0
  63. package/dist/docs-rels/migrations/index.d.ts.map +1 -0
  64. package/dist/docs-rels/migrations/index.js +128 -0
  65. package/dist/docs-rels/migrations/index.js.map +1 -0
  66. package/dist/docs-rels/schema.d.ts +2961 -0
  67. package/dist/docs-rels/schema.d.ts.map +1 -0
  68. package/dist/docs-rels/schema.js +244 -0
  69. package/dist/docs-rels/schema.js.map +1 -0
  70. package/dist/durable-clickhouse.d.ts.map +1 -1
  71. package/dist/durable-clickhouse.js +16 -13
  72. package/dist/durable-clickhouse.js.map +1 -1
  73. package/dist/durable-promise.d.ts.map +1 -1
  74. package/dist/durable-promise.js +34 -15
  75. package/dist/durable-promise.js.map +1 -1
  76. package/dist/errors.d.ts +127 -0
  77. package/dist/errors.d.ts.map +1 -0
  78. package/dist/errors.js +210 -0
  79. package/dist/errors.js.map +1 -0
  80. package/dist/eventbridge.d.ts +117 -0
  81. package/dist/eventbridge.d.ts.map +1 -0
  82. package/dist/eventbridge.js +238 -0
  83. package/dist/eventbridge.js.map +1 -0
  84. package/dist/events.d.ts +2 -2
  85. package/dist/events.d.ts.map +1 -1
  86. package/dist/events.js +1 -1
  87. package/dist/events.js.map +1 -1
  88. package/dist/execution-queue.d.ts.map +1 -1
  89. package/dist/execution-queue.js +4 -5
  90. package/dist/execution-queue.js.map +1 -1
  91. package/dist/index.d.ts +37 -8
  92. package/dist/index.d.ts.map +1 -1
  93. package/dist/index.js +112 -6
  94. package/dist/index.js.map +1 -1
  95. package/dist/linguistic.d.ts +3 -108
  96. package/dist/linguistic.d.ts.map +1 -1
  97. package/dist/linguistic.js +3 -372
  98. package/dist/linguistic.js.map +1 -1
  99. package/dist/logger.d.ts +132 -0
  100. package/dist/logger.d.ts.map +1 -0
  101. package/dist/logger.js +137 -0
  102. package/dist/logger.js.map +1 -0
  103. package/dist/memory-provider.d.ts +129 -0
  104. package/dist/memory-provider.d.ts.map +1 -1
  105. package/dist/memory-provider.js +592 -257
  106. package/dist/memory-provider.js.map +1 -1
  107. package/dist/pg-adapter.d.ts +424 -0
  108. package/dist/pg-adapter.d.ts.map +1 -0
  109. package/dist/pg-adapter.js +921 -0
  110. package/dist/pg-adapter.js.map +1 -0
  111. package/dist/pipelines-iceberg-emitter.d.ts +327 -0
  112. package/dist/pipelines-iceberg-emitter.d.ts.map +1 -0
  113. package/dist/pipelines-iceberg-emitter.js +351 -0
  114. package/dist/pipelines-iceberg-emitter.js.map +1 -0
  115. package/dist/provider-capabilities.d.ts +146 -0
  116. package/dist/provider-capabilities.d.ts.map +1 -0
  117. package/dist/provider-capabilities.js +214 -0
  118. package/dist/provider-capabilities.js.map +1 -0
  119. package/dist/rdb-provider-adapter.d.ts +195 -0
  120. package/dist/rdb-provider-adapter.d.ts.map +1 -0
  121. package/dist/rdb-provider-adapter.js +291 -0
  122. package/dist/rdb-provider-adapter.js.map +1 -0
  123. package/dist/schema/cascade.d.ts +49 -10
  124. package/dist/schema/cascade.d.ts.map +1 -1
  125. package/dist/schema/cascade.js +491 -273
  126. package/dist/schema/cascade.js.map +1 -1
  127. package/dist/schema/definition-caches.d.ts +24 -0
  128. package/dist/schema/definition-caches.d.ts.map +1 -0
  129. package/dist/schema/definition-caches.js +26 -0
  130. package/dist/schema/definition-caches.js.map +1 -0
  131. package/dist/schema/dependency-graph.d.ts +45 -0
  132. package/dist/schema/dependency-graph.d.ts.map +1 -0
  133. package/dist/schema/dependency-graph.js +47 -0
  134. package/dist/schema/dependency-graph.js.map +1 -0
  135. package/dist/schema/diff.d.ts +103 -0
  136. package/dist/schema/diff.d.ts.map +1 -0
  137. package/dist/schema/diff.js +329 -0
  138. package/dist/schema/diff.js.map +1 -0
  139. package/dist/schema/entity-operations.d.ts +99 -0
  140. package/dist/schema/entity-operations.d.ts.map +1 -0
  141. package/dist/schema/entity-operations.js +818 -0
  142. package/dist/schema/entity-operations.js.map +1 -0
  143. package/dist/schema/generation-context.d.ts +202 -0
  144. package/dist/schema/generation-context.d.ts.map +1 -0
  145. package/dist/schema/generation-context.js +393 -0
  146. package/dist/schema/generation-context.js.map +1 -0
  147. package/dist/schema/index.d.ts +32 -34
  148. package/dist/schema/index.d.ts.map +1 -1
  149. package/dist/schema/index.js +462 -519
  150. package/dist/schema/index.js.map +1 -1
  151. package/dist/schema/migration.d.ts +205 -0
  152. package/dist/schema/migration.d.ts.map +1 -0
  153. package/dist/schema/migration.js +327 -0
  154. package/dist/schema/migration.js.map +1 -0
  155. package/dist/schema/nl-query-generator.d.ts +68 -0
  156. package/dist/schema/nl-query-generator.d.ts.map +1 -0
  157. package/dist/schema/nl-query-generator.js +362 -0
  158. package/dist/schema/nl-query-generator.js.map +1 -0
  159. package/dist/schema/nl-query.d.ts +65 -0
  160. package/dist/schema/nl-query.d.ts.map +1 -0
  161. package/dist/schema/nl-query.js +178 -0
  162. package/dist/schema/nl-query.js.map +1 -0
  163. package/dist/schema/parse.d.ts.map +1 -1
  164. package/dist/schema/parse.js +152 -89
  165. package/dist/schema/parse.js.map +1 -1
  166. package/dist/schema/provider.d.ts +38 -0
  167. package/dist/schema/provider.d.ts.map +1 -1
  168. package/dist/schema/provider.js +15 -7
  169. package/dist/schema/provider.js.map +1 -1
  170. package/dist/schema/resolve.d.ts +46 -5
  171. package/dist/schema/resolve.d.ts.map +1 -1
  172. package/dist/schema/resolve.js +334 -117
  173. package/dist/schema/resolve.js.map +1 -1
  174. package/dist/schema/search-utils.d.ts +76 -0
  175. package/dist/schema/search-utils.d.ts.map +1 -0
  176. package/dist/schema/search-utils.js +86 -0
  177. package/dist/schema/search-utils.js.map +1 -0
  178. package/dist/schema/seed.d.ts +53 -0
  179. package/dist/schema/seed.d.ts.map +1 -0
  180. package/dist/schema/seed.js +94 -0
  181. package/dist/schema/seed.js.map +1 -0
  182. package/dist/schema/semantic.d.ts +11 -0
  183. package/dist/schema/semantic.d.ts.map +1 -1
  184. package/dist/schema/semantic.js +262 -68
  185. package/dist/schema/semantic.js.map +1 -1
  186. package/dist/schema/sub-apis.d.ts +52 -0
  187. package/dist/schema/sub-apis.d.ts.map +1 -0
  188. package/dist/schema/sub-apis.js +216 -0
  189. package/dist/schema/sub-apis.js.map +1 -0
  190. package/dist/schema/system-entities.d.ts +42 -0
  191. package/dist/schema/system-entities.d.ts.map +1 -0
  192. package/dist/schema/system-entities.js +101 -0
  193. package/dist/schema/system-entities.js.map +1 -0
  194. package/dist/schema/types.d.ts +91 -9
  195. package/dist/schema/types.d.ts.map +1 -1
  196. package/dist/schema/union-fallback.d.ts +219 -0
  197. package/dist/schema/union-fallback.d.ts.map +1 -0
  198. package/dist/schema/union-fallback.js +331 -0
  199. package/dist/schema/union-fallback.js.map +1 -0
  200. package/dist/schema/value-generators/ai.d.ts +54 -0
  201. package/dist/schema/value-generators/ai.d.ts.map +1 -0
  202. package/dist/schema/value-generators/ai.js +136 -0
  203. package/dist/schema/value-generators/ai.js.map +1 -0
  204. package/dist/schema/value-generators/index.d.ts +126 -0
  205. package/dist/schema/value-generators/index.d.ts.map +1 -0
  206. package/dist/schema/value-generators/index.js +219 -0
  207. package/dist/schema/value-generators/index.js.map +1 -0
  208. package/dist/schema/value-generators/placeholder.d.ts +52 -0
  209. package/dist/schema/value-generators/placeholder.d.ts.map +1 -0
  210. package/dist/schema/value-generators/placeholder.js +328 -0
  211. package/dist/schema/value-generators/placeholder.js.map +1 -0
  212. package/dist/schema/value-generators/types.d.ts +116 -0
  213. package/dist/schema/value-generators/types.d.ts.map +1 -0
  214. package/dist/schema/value-generators/types.js +11 -0
  215. package/dist/schema/value-generators/types.js.map +1 -0
  216. package/dist/schema/verb-derivation.d.ts +167 -0
  217. package/dist/schema/verb-derivation.d.ts.map +1 -0
  218. package/dist/schema/verb-derivation.js +281 -0
  219. package/dist/schema/verb-derivation.js.map +1 -0
  220. package/dist/schema/version.d.ts +111 -0
  221. package/dist/schema/version.d.ts.map +1 -0
  222. package/dist/schema/version.js +190 -0
  223. package/dist/schema/version.js.map +1 -0
  224. package/dist/schema.d.ts +1095 -23
  225. package/dist/schema.d.ts.map +1 -1
  226. package/dist/schema.js +2854 -38
  227. package/dist/schema.js.map +1 -1
  228. package/dist/semantic-vectors.d.ts +39 -0
  229. package/dist/semantic-vectors.d.ts.map +1 -0
  230. package/dist/semantic-vectors.js +334 -0
  231. package/dist/semantic-vectors.js.map +1 -0
  232. package/dist/semantic.d.ts +29 -1
  233. package/dist/semantic.d.ts.map +1 -1
  234. package/dist/semantic.js +26 -16
  235. package/dist/semantic.js.map +1 -1
  236. package/dist/telemetry.d.ts +128 -0
  237. package/dist/telemetry.d.ts.map +1 -0
  238. package/dist/telemetry.js +305 -0
  239. package/dist/telemetry.js.map +1 -0
  240. package/dist/tests.d.ts.map +1 -1
  241. package/dist/tests.js +30 -22
  242. package/dist/tests.js.map +1 -1
  243. package/dist/type-guards.d.ts +212 -0
  244. package/dist/type-guards.d.ts.map +1 -0
  245. package/dist/type-guards.js +318 -0
  246. package/dist/type-guards.js.map +1 -0
  247. package/dist/types.d.ts +33 -245
  248. package/dist/types.d.ts.map +1 -1
  249. package/dist/types.js +62 -72
  250. package/dist/types.js.map +1 -1
  251. package/dist/validation.d.ts +165 -0
  252. package/dist/validation.d.ts.map +1 -0
  253. package/dist/validation.js +639 -0
  254. package/dist/validation.js.map +1 -0
  255. package/dist/worker/db-provider.d.ts +168 -0
  256. package/dist/worker/db-provider.d.ts.map +1 -0
  257. package/dist/worker/db-provider.js +277 -0
  258. package/dist/worker/db-provider.js.map +1 -0
  259. package/dist/worker/index.d.ts +35 -0
  260. package/dist/worker/index.d.ts.map +1 -0
  261. package/dist/worker/index.js +37 -0
  262. package/dist/worker/index.js.map +1 -0
  263. package/dist/worker.d.ts +779 -0
  264. package/dist/worker.d.ts.map +1 -0
  265. package/dist/worker.js +2786 -0
  266. package/dist/worker.js.map +1 -0
  267. package/package.json +38 -8
  268. package/src/docs-rels/migrations/0001-init.sql +125 -0
@@ -0,0 +1,639 @@
1
+ /**
2
+ * Input Validation Module
3
+ *
4
+ * Security-focused validation for all provider inputs to prevent:
5
+ * - SQL injection attacks
6
+ * - NoSQL injection attacks
7
+ * - Path traversal attacks
8
+ * - Prototype pollution
9
+ * - Resource exhaustion (excessive length/depth)
10
+ *
11
+ * @packageDocumentation
12
+ */
13
+ import { ValidationError } from './errors.js';
14
+ // =============================================================================
15
+ // Validation Constants
16
+ // =============================================================================
17
+ /** Maximum allowed length for type names */
18
+ export const MAX_TYPE_LENGTH = 256;
19
+ /** Maximum allowed length for entity IDs */
20
+ export const MAX_ID_LENGTH = 512;
21
+ /** Maximum allowed length for search queries */
22
+ export const MAX_QUERY_LENGTH = 10000;
23
+ /** Maximum allowed nesting depth for objects */
24
+ export const MAX_OBJECT_DEPTH = 100;
25
+ /** Maximum allowed length for relation names */
26
+ export const MAX_RELATION_LENGTH = 256;
27
+ /** Maximum allowed length for field names */
28
+ export const MAX_FIELD_LENGTH = 256;
29
+ // =============================================================================
30
+ // Allowlist-Based Validation (Security Hardened)
31
+ // =============================================================================
32
+ /**
33
+ * Allowed characters for identifiers using allowlist approach.
34
+ * This is more secure than regex which can have bypass vulnerabilities.
35
+ */
36
+ /** Allowed uppercase letters (A-Z) */
37
+ const ALLOWED_UPPERCASE = new Set('ABCDEFGHIJKLMNOPQRSTUVWXYZ');
38
+ /** Allowed lowercase letters (a-z) */
39
+ const ALLOWED_LOWERCASE = new Set('abcdefghijklmnopqrstuvwxyz');
40
+ /** Allowed digits (0-9) */
41
+ const ALLOWED_DIGITS = new Set('0123456789');
42
+ /** Allowed letters (a-z, A-Z) */
43
+ const ALLOWED_LETTERS = new Set([...ALLOWED_UPPERCASE, ...ALLOWED_LOWERCASE]);
44
+ /** Allowed identifier characters (letters, digits, underscore) */
45
+ const ALLOWED_IDENTIFIER_CHARS = new Set([...ALLOWED_LETTERS, ...ALLOWED_DIGITS, '_']);
46
+ /** Allowed ID characters (letters, digits, underscore, hyphen, dot, forward slash for path-like IDs) */
47
+ const ALLOWED_ID_CHARS = new Set([...ALLOWED_LETTERS, ...ALLOWED_DIGITS, '_', '-', '.', '/']);
48
+ /** Allowed action type characters (letters, digits, underscore, hyphen) */
49
+ const ALLOWED_ACTION_CHARS = new Set([...ALLOWED_LETTERS, ...ALLOWED_DIGITS, '_', '-']);
50
+ /**
51
+ * Check if a character is in the allowlist
52
+ * Uses code point to ensure we only accept ASCII characters
53
+ */
54
+ function isAllowedChar(char, allowedSet) {
55
+ // Must be exactly one character
56
+ if (char.length !== 1)
57
+ return false;
58
+ // Must be ASCII (code point < 128)
59
+ const codePoint = char.charCodeAt(0);
60
+ if (codePoint >= 128)
61
+ return false;
62
+ // Must be in the allowed set
63
+ return allowedSet.has(char);
64
+ }
65
+ /**
66
+ * Check if a string contains only allowed characters
67
+ * This is the core allowlist validation function
68
+ */
69
+ function containsOnlyAllowedChars(str, allowedSet) {
70
+ for (const char of str) {
71
+ if (!isAllowedChar(char, allowedSet)) {
72
+ return false;
73
+ }
74
+ }
75
+ return true;
76
+ }
77
+ /**
78
+ * Check if a character is a letter (ASCII only)
79
+ */
80
+ function isLetter(char) {
81
+ return isAllowedChar(char, ALLOWED_LETTERS);
82
+ }
83
+ /**
84
+ * Validate type name format using allowlist approach
85
+ */
86
+ function isValidTypeNameFormat(name) {
87
+ if (name.length === 0)
88
+ return false;
89
+ // First character must be a letter
90
+ if (!isLetter(name[0]))
91
+ return false;
92
+ // All characters must be in the allowed set
93
+ return containsOnlyAllowedChars(name, ALLOWED_IDENTIFIER_CHARS);
94
+ }
95
+ /**
96
+ * Validate entity ID format using allowlist approach
97
+ * IDs can contain letters, digits, underscores, and hyphens (for UUIDs and slugs)
98
+ */
99
+ function isValidEntityIdFormat(id) {
100
+ if (id.length === 0)
101
+ return false;
102
+ // All characters must be in the allowed set
103
+ return containsOnlyAllowedChars(id, ALLOWED_ID_CHARS);
104
+ }
105
+ /**
106
+ * Validate relation name format using allowlist approach
107
+ */
108
+ function isValidRelationNameFormat(name) {
109
+ if (name.length === 0)
110
+ return false;
111
+ // First character must be a letter
112
+ if (!isLetter(name[0]))
113
+ return false;
114
+ // All characters must be in the allowed set
115
+ return containsOnlyAllowedChars(name, ALLOWED_IDENTIFIER_CHARS);
116
+ }
117
+ /**
118
+ * Validate field name format using allowlist approach
119
+ * Field names can optionally start with $
120
+ */
121
+ function isValidFieldNameFormat(name) {
122
+ if (name.length === 0)
123
+ return false;
124
+ let startIndex = 0;
125
+ // Handle optional $ prefix
126
+ if (name[0] === '$') {
127
+ if (name.length === 1)
128
+ return false;
129
+ startIndex = 1;
130
+ }
131
+ // Character after $ (or first char) must be a letter
132
+ if (!isLetter(name[startIndex]))
133
+ return false;
134
+ // All remaining characters must be in the allowed set
135
+ for (let i = startIndex; i < name.length; i++) {
136
+ if (!isAllowedChar(name[i], ALLOWED_IDENTIFIER_CHARS)) {
137
+ return false;
138
+ }
139
+ }
140
+ return true;
141
+ }
142
+ /**
143
+ * Validate action type format using allowlist approach
144
+ * Action types can contain letters, digits, underscores, and hyphens
145
+ */
146
+ function isValidActionTypeFormat(name) {
147
+ if (name.length === 0)
148
+ return false;
149
+ // First character must be a letter
150
+ if (!isLetter(name[0]))
151
+ return false;
152
+ // All characters must be in the allowed set (including hyphens)
153
+ return containsOnlyAllowedChars(name, ALLOWED_ACTION_CHARS);
154
+ }
155
+ // =============================================================================
156
+ // Validation Patterns (kept for event pattern validation only)
157
+ // =============================================================================
158
+ /**
159
+ * Pattern for valid event patterns: Type.action, type:action, or wildcards
160
+ * Supports both dot notation (Post.created) and colon notation (entity:created)
161
+ * This is kept as regex because it needs to validate pattern syntax,
162
+ * but the underlying type names are validated with allowlist
163
+ */
164
+ const EVENT_PATTERN_REGEX = /^(\*|\*\.[A-Za-z_]+|[A-Za-z_]+\.\*|[A-Za-z_]+\.[A-Za-z_:]+|[A-Za-z_]+:[A-Za-z_]+)$/;
165
+ // =============================================================================
166
+ // SQL Injection Patterns
167
+ // =============================================================================
168
+ /**
169
+ * Common SQL injection patterns to detect
170
+ */
171
+ const SQL_INJECTION_PATTERNS = [
172
+ /;\s*(DROP|DELETE|UPDATE|INSERT|ALTER|CREATE|TRUNCATE)/i,
173
+ /'\s*OR\s*'?\d*'?\s*=\s*'?\d*/i,
174
+ /"\s*OR\s*"?\d*"?\s*=\s*"?\d*/i,
175
+ /UNION\s+(ALL\s+)?SELECT/i,
176
+ /\/\*.*\*\//,
177
+ /--/,
178
+ /EXEC\s+/i,
179
+ /EXECUTE\s+/i,
180
+ /xp_cmdshell/i,
181
+ /WAITFOR\s+DELAY/i,
182
+ /SLEEP\s*\(/i,
183
+ /%27/i, // URL-encoded single quote
184
+ /%22/i, // URL-encoded double quote
185
+ ];
186
+ /**
187
+ * Path traversal patterns to detect
188
+ */
189
+ const PATH_TRAVERSAL_PATTERNS = [
190
+ /\.\.\//,
191
+ /\.\.\\/,
192
+ /%2e%2e%2f/i,
193
+ /%2e%2e\//i,
194
+ /\.\.%2f/i,
195
+ /%2e%2e%5c/i,
196
+ ];
197
+ /**
198
+ * Protocol injection patterns to detect in URLs
199
+ */
200
+ const PROTOCOL_INJECTION_PATTERNS = [
201
+ /^file:/i,
202
+ /^javascript:/i,
203
+ /^data:/i,
204
+ /^ftp:/i,
205
+ /^gopher:/i,
206
+ /^ldap:/i,
207
+ ];
208
+ /**
209
+ * Dangerous control characters that should be rejected
210
+ */
211
+ const CONTROL_CHARACTERS = /[\x00-\x08\x0B\x0C\x0E-\x1F\x7F]/;
212
+ /**
213
+ * Prototype pollution property names to reject
214
+ */
215
+ const DANGEROUS_PROPERTIES = new Set(['__proto__', 'constructor', 'prototype']);
216
+ // =============================================================================
217
+ // Re-export ValidationError from errors.ts for backwards compatibility
218
+ // =============================================================================
219
+ export { ValidationError };
220
+ // =============================================================================
221
+ // Validation Functions
222
+ // =============================================================================
223
+ /**
224
+ * Check if a string contains SQL injection patterns
225
+ */
226
+ function containsSqlInjection(value) {
227
+ return SQL_INJECTION_PATTERNS.some((pattern) => pattern.test(value));
228
+ }
229
+ /**
230
+ * Check if a string contains path traversal patterns
231
+ */
232
+ function containsPathTraversal(value) {
233
+ return PATH_TRAVERSAL_PATTERNS.some((pattern) => pattern.test(value));
234
+ }
235
+ /**
236
+ * Check if a string contains protocol injection patterns
237
+ */
238
+ function containsProtocolInjection(value) {
239
+ return PROTOCOL_INJECTION_PATTERNS.some((pattern) => pattern.test(value));
240
+ }
241
+ /**
242
+ * Check if a string contains dangerous control characters
243
+ */
244
+ function containsControlCharacters(value) {
245
+ return CONTROL_CHARACTERS.test(value);
246
+ }
247
+ /**
248
+ * Validate a type name
249
+ *
250
+ * Requirements:
251
+ * - Must be a string
252
+ * - Must not be empty
253
+ * - Must match alphanumeric pattern (with underscores)
254
+ * - Must not exceed max length
255
+ * - Must not contain SQL injection patterns
256
+ * - Must not contain control characters
257
+ *
258
+ * @throws ValidationError if validation fails
259
+ */
260
+ export function validateTypeName(type) {
261
+ // Check string type
262
+ if (typeof type !== 'string') {
263
+ throw new ValidationError(`Invalid type: must be a string, got ${type === null ? 'null' : typeof type}`, 'Input', 'type', type);
264
+ }
265
+ // Check empty
266
+ if (type.length === 0) {
267
+ throw new ValidationError('Invalid type: must not be empty', 'Input', 'type', type);
268
+ }
269
+ // Check length
270
+ if (type.length > MAX_TYPE_LENGTH) {
271
+ throw new ValidationError(`Invalid type: exceeds maximum length of ${MAX_TYPE_LENGTH}`, 'Input', 'type', type);
272
+ }
273
+ // Check control characters
274
+ if (containsControlCharacters(type)) {
275
+ throw new ValidationError('Invalid type: contains special characters that are not allowed', 'Input', 'type', type);
276
+ }
277
+ // Check SQL injection
278
+ if (containsSqlInjection(type)) {
279
+ throw new ValidationError('Invalid type: contains injection patterns that are not allowed', 'Input', 'type', type);
280
+ }
281
+ // Check pattern (alphanumeric + underscore) using allowlist
282
+ if (!isValidTypeNameFormat(type)) {
283
+ throw new ValidationError('Invalid type: must be alphanumeric with underscores, starting with a letter', 'Input', 'type', type);
284
+ }
285
+ }
286
+ /**
287
+ * Validate an entity ID
288
+ *
289
+ * Requirements:
290
+ * - Must be a string
291
+ * - Must not be empty
292
+ * - Must match safe ID pattern
293
+ * - Must not exceed max length
294
+ * - Must not contain SQL injection patterns
295
+ * - Must not contain path traversal patterns
296
+ * - Must not contain control characters
297
+ *
298
+ * @throws ValidationError if validation fails
299
+ */
300
+ export function validateEntityId(id) {
301
+ // Check string type
302
+ if (typeof id !== 'string') {
303
+ throw new ValidationError(`Invalid id: must be a string, got ${id === null ? 'null' : typeof id}`, 'Input', 'id', id);
304
+ }
305
+ // Check empty
306
+ if (id.length === 0) {
307
+ throw new ValidationError('Invalid id: must not be empty', 'Input', 'id', id);
308
+ }
309
+ // Check length
310
+ if (id.length > MAX_ID_LENGTH) {
311
+ throw new ValidationError(`Invalid id: exceeds maximum length of ${MAX_ID_LENGTH}`, 'Input', 'id', id);
312
+ }
313
+ // Check control characters
314
+ if (containsControlCharacters(id)) {
315
+ throw new ValidationError('Invalid id: contains special characters that are not allowed', 'Input', 'id', id);
316
+ }
317
+ // Check SQL injection
318
+ if (containsSqlInjection(id)) {
319
+ throw new ValidationError('Invalid id: contains injection patterns that are not allowed', 'Input', 'id', id);
320
+ }
321
+ // Check path traversal
322
+ if (containsPathTraversal(id)) {
323
+ throw new ValidationError('Invalid id: contains path traversal patterns that are not allowed', 'Input', 'id', id);
324
+ }
325
+ // Check pattern (alphanumeric + underscore + hyphen) using allowlist
326
+ if (!isValidEntityIdFormat(id)) {
327
+ throw new ValidationError('Invalid id: must contain only alphanumeric characters, underscores, and hyphens', 'Input', 'id', id);
328
+ }
329
+ }
330
+ /**
331
+ * Validate a search query
332
+ *
333
+ * Requirements:
334
+ * - Must be a string
335
+ * - Must not exceed max length
336
+ *
337
+ * Note: Search queries are more permissive since they're typically used
338
+ * for full-text search and the provider should handle them safely.
339
+ *
340
+ * @throws ValidationError if validation fails
341
+ */
342
+ export function validateSearchQuery(query) {
343
+ if (typeof query !== 'string') {
344
+ throw new ValidationError(`Invalid query: must be a string, got ${query === null ? 'null' : typeof query}`, 'Input', 'query', query);
345
+ }
346
+ if (query.length > MAX_QUERY_LENGTH) {
347
+ throw new ValidationError(`Invalid query: exceeds maximum length of ${MAX_QUERY_LENGTH}`, 'Input', 'query', query);
348
+ }
349
+ }
350
+ /**
351
+ * Calculate the depth of a nested object
352
+ */
353
+ function calculateObjectDepth(obj, currentDepth = 0) {
354
+ if (currentDepth > MAX_OBJECT_DEPTH) {
355
+ return currentDepth; // Stop early if we've exceeded max
356
+ }
357
+ if (obj === null || typeof obj !== 'object') {
358
+ return currentDepth;
359
+ }
360
+ if (Array.isArray(obj)) {
361
+ let maxDepth = currentDepth;
362
+ for (const item of obj) {
363
+ const depth = calculateObjectDepth(item, currentDepth + 1);
364
+ if (depth > maxDepth)
365
+ maxDepth = depth;
366
+ }
367
+ return maxDepth;
368
+ }
369
+ let maxDepth = currentDepth;
370
+ for (const value of Object.values(obj)) {
371
+ const depth = calculateObjectDepth(value, currentDepth + 1);
372
+ if (depth > maxDepth)
373
+ maxDepth = depth;
374
+ }
375
+ return maxDepth;
376
+ }
377
+ /**
378
+ * Check for prototype pollution in object data
379
+ */
380
+ function containsPrototypePollution(obj) {
381
+ if (obj === null || typeof obj !== 'object') {
382
+ return false;
383
+ }
384
+ if (Array.isArray(obj)) {
385
+ return obj.some(containsPrototypePollution);
386
+ }
387
+ for (const key of Object.keys(obj)) {
388
+ if (DANGEROUS_PROPERTIES.has(key)) {
389
+ return true;
390
+ }
391
+ if (containsPrototypePollution(obj[key])) {
392
+ return true;
393
+ }
394
+ }
395
+ return false;
396
+ }
397
+ /**
398
+ * Validate entity data
399
+ *
400
+ * Requirements:
401
+ * - Must be an object
402
+ * - Must not exceed max nesting depth
403
+ * - Must not contain prototype pollution attempts
404
+ *
405
+ * @throws ValidationError if validation fails
406
+ */
407
+ export function validateEntityData(data) {
408
+ if (data === null || typeof data !== 'object' || Array.isArray(data)) {
409
+ throw new ValidationError('Invalid data: must be an object', 'Input', 'data', data);
410
+ }
411
+ // Check depth
412
+ const depth = calculateObjectDepth(data);
413
+ if (depth > MAX_OBJECT_DEPTH) {
414
+ throw new ValidationError(`Invalid data: nested too deep, maximum depth is ${MAX_OBJECT_DEPTH}`, 'Input', 'data');
415
+ }
416
+ // Check for prototype pollution - but only reject 'constructor' at top level
417
+ // __proto__ is harmless in JSON.parse'd objects
418
+ const record = data;
419
+ if ('constructor' in record && typeof record['constructor'] === 'object') {
420
+ throw new ValidationError('Invalid data: constructor property not allowed', 'Input', 'data');
421
+ }
422
+ }
423
+ /**
424
+ * Validate a relation name
425
+ *
426
+ * Requirements:
427
+ * - Must be a string
428
+ * - Must not be empty
429
+ * - Must match alphanumeric pattern
430
+ * - Must not exceed max length
431
+ * - Must not contain SQL injection patterns
432
+ *
433
+ * @throws ValidationError if validation fails
434
+ */
435
+ export function validateRelationName(relation) {
436
+ if (typeof relation !== 'string') {
437
+ throw new ValidationError(`Invalid relation: must be a string, got ${relation === null ? 'null' : typeof relation}`, 'Input', 'relation', relation);
438
+ }
439
+ if (relation.length === 0) {
440
+ throw new ValidationError('Invalid relation: must not be empty', 'Input', 'relation', relation);
441
+ }
442
+ if (relation.length > MAX_RELATION_LENGTH) {
443
+ throw new ValidationError(`Invalid relation: exceeds maximum length of ${MAX_RELATION_LENGTH}`, 'Input', 'relation', relation);
444
+ }
445
+ if (containsSqlInjection(relation)) {
446
+ throw new ValidationError('Invalid relation: contains injection patterns that are not allowed', 'Input', 'relation', relation);
447
+ }
448
+ // Check pattern using allowlist
449
+ if (!isValidRelationNameFormat(relation)) {
450
+ throw new ValidationError('Invalid relation: must be alphanumeric with underscores, starting with a letter', 'Input', 'relation', relation);
451
+ }
452
+ }
453
+ /**
454
+ * Validate an event pattern
455
+ *
456
+ * Requirements:
457
+ * - Must be a string
458
+ * - Must match valid event pattern format
459
+ * - Must not contain SQL injection patterns
460
+ *
461
+ * @throws ValidationError if validation fails
462
+ */
463
+ export function validateEventPattern(pattern) {
464
+ if (typeof pattern !== 'string') {
465
+ throw new ValidationError(`Invalid pattern: must be a string, got ${pattern === null ? 'null' : typeof pattern}`, 'Input', 'pattern', pattern);
466
+ }
467
+ if (containsSqlInjection(pattern)) {
468
+ throw new ValidationError('Invalid pattern: contains injection patterns that are not allowed', 'Input', 'pattern', pattern);
469
+ }
470
+ if (!EVENT_PATTERN_REGEX.test(pattern)) {
471
+ throw new ValidationError('Invalid pattern: must be a valid event pattern (Type.action, *.action, Type.*, or *)', 'Input', 'pattern', pattern);
472
+ }
473
+ }
474
+ /**
475
+ * Validate an action type
476
+ *
477
+ * Requirements:
478
+ * - Must be a string
479
+ * - Must match alphanumeric pattern
480
+ * - Must not contain SQL injection patterns
481
+ *
482
+ * @throws ValidationError if validation fails
483
+ */
484
+ export function validateActionType(actionType) {
485
+ if (typeof actionType !== 'string') {
486
+ throw new ValidationError(`Invalid type: must be a string, got ${actionType === null ? 'null' : typeof actionType}`, 'Input', 'type', actionType);
487
+ }
488
+ if (containsSqlInjection(actionType)) {
489
+ throw new ValidationError('Invalid type: contains injection patterns that are not allowed', 'Input', 'type', actionType);
490
+ }
491
+ // Check pattern using allowlist
492
+ if (!isValidActionTypeFormat(actionType)) {
493
+ throw new ValidationError('Invalid type: must be alphanumeric with underscores, starting with a letter', 'Input', 'type', actionType);
494
+ }
495
+ }
496
+ /**
497
+ * Validate an artifact URL
498
+ *
499
+ * Requirements:
500
+ * - Must be a string
501
+ * - Must not contain path traversal patterns
502
+ * - Must not contain protocol injection
503
+ *
504
+ * @throws ValidationError if validation fails
505
+ */
506
+ export function validateArtifactUrl(url) {
507
+ if (typeof url !== 'string') {
508
+ throw new ValidationError(`Invalid url: must be a string, got ${url === null ? 'null' : typeof url}`, 'Input', 'url', url);
509
+ }
510
+ if (containsPathTraversal(url)) {
511
+ throw new ValidationError('Invalid url: path traversal not allowed', 'Input', 'url', url);
512
+ }
513
+ if (containsProtocolInjection(url)) {
514
+ throw new ValidationError('Invalid url: protocol not allowed', 'Input', 'url', url);
515
+ }
516
+ }
517
+ /**
518
+ * Validate a field name for search
519
+ *
520
+ * Requirements:
521
+ * - Must be a string
522
+ * - Must match valid field pattern or be $all
523
+ * - Must not contain SQL injection patterns
524
+ * - Must not be a dangerous property name
525
+ *
526
+ * @throws ValidationError if validation fails
527
+ */
528
+ export function validateFieldName(field) {
529
+ if (typeof field !== 'string') {
530
+ throw new ValidationError(`Invalid field: must be a string, got ${field === null ? 'null' : typeof field}`, 'Input', 'field', field);
531
+ }
532
+ // $all is a special valid field name
533
+ if (field === '$all') {
534
+ return;
535
+ }
536
+ if (containsSqlInjection(field)) {
537
+ throw new ValidationError('Invalid field: contains injection patterns that are not allowed', 'Input', 'field', field);
538
+ }
539
+ if (field.length > MAX_FIELD_LENGTH) {
540
+ throw new ValidationError(`Invalid field: exceeds maximum length of ${MAX_FIELD_LENGTH}`, 'Input', 'field', field);
541
+ }
542
+ // Check pattern using allowlist
543
+ if (!isValidFieldNameFormat(field)) {
544
+ throw new ValidationError('Invalid field: must be alphanumeric with underscores', 'Input', 'field', field);
545
+ }
546
+ }
547
+ /**
548
+ * Check if a field name is a dangerous property
549
+ */
550
+ export function isDangerousField(field) {
551
+ return DANGEROUS_PROPERTIES.has(field);
552
+ }
553
+ /**
554
+ * Validate list options
555
+ *
556
+ * Requirements:
557
+ * - limit must be a non-negative number if provided
558
+ * - offset must be a non-negative number if provided
559
+ * - orderBy must be a valid field name if provided
560
+ *
561
+ * @throws ValidationError if validation fails
562
+ */
563
+ export function validateListOptions(options) {
564
+ if (options === null || options === undefined) {
565
+ return;
566
+ }
567
+ if (typeof options !== 'object') {
568
+ throw new ValidationError('Invalid options: must be an object', 'Input', 'options', options);
569
+ }
570
+ const opts = options;
571
+ // Validate limit
572
+ if (opts['limit'] !== undefined) {
573
+ if (typeof opts['limit'] !== 'number') {
574
+ throw new ValidationError(`Invalid limit: must be a number, got ${typeof opts['limit']}`, 'Input', 'limit', opts['limit']);
575
+ }
576
+ if (opts['limit'] < 0) {
577
+ throw new ValidationError('Invalid limit: must be positive or zero', 'Input', 'limit', opts['limit']);
578
+ }
579
+ }
580
+ // Validate offset
581
+ if (opts['offset'] !== undefined) {
582
+ if (typeof opts['offset'] !== 'number') {
583
+ throw new ValidationError(`Invalid offset: must be a number, got ${typeof opts['offset']}`, 'Input', 'offset', opts['offset']);
584
+ }
585
+ if (opts['offset'] < 0) {
586
+ throw new ValidationError('Invalid offset: must be positive or zero', 'Input', 'offset', opts['offset']);
587
+ }
588
+ }
589
+ // Validate orderBy
590
+ if (opts['orderBy'] !== undefined) {
591
+ if (typeof opts['orderBy'] !== 'string') {
592
+ throw new ValidationError(`Invalid orderBy: must be a string, got ${typeof opts['orderBy']}`, 'Input', 'orderBy', opts['orderBy']);
593
+ }
594
+ if (containsSqlInjection(opts['orderBy'])) {
595
+ throw new ValidationError('Invalid orderBy: contains injection patterns that are not allowed', 'Input', 'orderBy', opts['orderBy']);
596
+ }
597
+ // Check pattern using allowlist
598
+ if (!isValidFieldNameFormat(opts['orderBy'])) {
599
+ throw new ValidationError('Invalid orderBy field: must be alphanumeric with underscores', 'Input', 'orderBy', opts['orderBy']);
600
+ }
601
+ }
602
+ }
603
+ /**
604
+ * Validate search options including fields array
605
+ *
606
+ * @throws ValidationError if validation fails
607
+ */
608
+ export function validateSearchOptions(options) {
609
+ if (options === null || options === undefined) {
610
+ return;
611
+ }
612
+ // First validate the base list options
613
+ validateListOptions(options);
614
+ const opts = options;
615
+ // Validate fields array
616
+ if (opts['fields'] !== undefined) {
617
+ if (!Array.isArray(opts['fields'])) {
618
+ throw new ValidationError('Invalid fields: must be an array', 'Input', 'fields', opts['fields']);
619
+ }
620
+ for (const field of opts['fields']) {
621
+ // Skip dangerous field names silently - they will be filtered out by the search method
622
+ // This allows the search to return empty results rather than throwing
623
+ if (typeof field === 'string' && DANGEROUS_PROPERTIES.has(field)) {
624
+ continue;
625
+ }
626
+ validateFieldName(field);
627
+ }
628
+ }
629
+ }
630
+ /**
631
+ * Sanitize a search query by escaping special regex characters
632
+ *
633
+ * This prevents regex injection in search operations.
634
+ */
635
+ export function sanitizeSearchQuery(query) {
636
+ // Escape regex special characters for safe string matching
637
+ return query.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
638
+ }
639
+ //# sourceMappingURL=validation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validation.js","sourceRoot":"","sources":["../src/validation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAE7C,gFAAgF;AAChF,uBAAuB;AACvB,gFAAgF;AAEhF,4CAA4C;AAC5C,MAAM,CAAC,MAAM,eAAe,GAAG,GAAG,CAAA;AAElC,4CAA4C;AAC5C,MAAM,CAAC,MAAM,aAAa,GAAG,GAAG,CAAA;AAEhC,gDAAgD;AAChD,MAAM,CAAC,MAAM,gBAAgB,GAAG,KAAK,CAAA;AAErC,gDAAgD;AAChD,MAAM,CAAC,MAAM,gBAAgB,GAAG,GAAG,CAAA;AAEnC,gDAAgD;AAChD,M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