@lunora/advisor 1.0.0-alpha.2 → 1.0.0-alpha.20

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 (68) hide show
  1. package/LICENSE.md +6 -0
  2. package/README.md +1 -1
  3. package/__assets__/package-og.svg +1 -1
  4. package/dist/index.d.mts +2158 -4
  5. package/dist/index.d.ts +2158 -4
  6. package/dist/index.mjs +110 -8
  7. package/dist/packem_shared/{AE_METRIC_EVENTS-DexctYv6.mjs → AE_METRIC_EVENTS-BM14d0lm.mjs} +3 -1
  8. package/dist/packem_shared/actionFetchSsrf-wbmYgzmz.mjs +26 -0
  9. package/dist/packem_shared/aiRawRunEscapeHatch-C29jd32J.mjs +26 -0
  10. package/dist/packem_shared/aiToolSideEffectPromptInjection-BtD3alqB.mjs +33 -0
  11. package/dist/packem_shared/aiUnboundedGenerationPublic-CbAcSxLB.mjs +26 -0
  12. package/dist/packem_shared/allowUnauthenticatedShardAccessEnabled-BcASq-jP.mjs +30 -0
  13. package/dist/packem_shared/argument-derived-sink-C1xTTqAt.mjs +30 -0
  14. package/dist/packem_shared/authCsrfCheckDisabled-DCf9FSoD.mjs +26 -0
  15. package/dist/packem_shared/authEmailVerificationDisabled-Dk-Tc5oU.mjs +26 -0
  16. package/dist/packem_shared/authSecureCookiesDisabled-osJrHW9Y.mjs +26 -0
  17. package/dist/packem_shared/authSessionFreshageZero-CjufCc_Q.mjs +26 -0
  18. package/dist/packem_shared/authTrustedOriginsWildcard-ylv4PKzC.mjs +26 -0
  19. package/dist/packem_shared/browserAllowPrivateTargets-CBvQxLAM.mjs +26 -0
  20. package/dist/packem_shared/browserUserUrlWithoutAllowlist-CvhA6w59.mjs +26 -0
  21. package/dist/packem_shared/containerInstanceKeyFromUserInput-BUXj2J4w.mjs +19 -0
  22. package/dist/packem_shared/containerRuntimeEgressRelaxation-B0LlfmDA.mjs +26 -0
  23. package/dist/packem_shared/containerStartEnableInternetOverride-DDaHZQ1L.mjs +26 -0
  24. package/dist/packem_shared/externalSourceOnGlobal-Bg-NfCX9.mjs +30 -0
  25. package/dist/packem_shared/externalSourceUnscoped-5vT-Bup3.mjs +44 -0
  26. package/dist/packem_shared/flagGatesSecurityWithUnsafeDefault-BhIs0shr.mjs +41 -0
  27. package/dist/packem_shared/{fromServerSchema-DinF1nph.mjs → fromServerSchema-BiB6JSiW.mjs} +9 -0
  28. package/dist/packem_shared/helpers-BySnKhVB.mjs +31 -0
  29. package/dist/packem_shared/httpActionMissingAuthGuard-CxipddNx.mjs +35 -0
  30. package/dist/packem_shared/httpActionResponseHeaderInjection-DOFS7pFT.mjs +39 -0
  31. package/dist/packem_shared/identityUndeclaredClaimTrusted-D8nXV2dd.mjs +32 -0
  32. package/dist/packem_shared/imagesUrlSourceFromUserInput-YcDQ0b_Y.mjs +19 -0
  33. package/dist/packem_shared/{indexReferencesUnknownField-DH0_dbUY.mjs → indexReferencesUnknownField-BSWNngxX.mjs} +1 -1
  34. package/dist/packem_shared/insertManyUnsafeUserData-Dn77XpmX.mjs +26 -0
  35. package/dist/packem_shared/kvUnscopedUserKeyIdor-YWwmfE8X.mjs +19 -0
  36. package/dist/packem_shared/mailInboundDispatchWithoutVerify-CHSRA8zz.mjs +28 -0
  37. package/dist/packem_shared/mailRecipientFromRequestInput-Cka2qu5J.mjs +26 -0
  38. package/dist/packem_shared/maskWeakHashStrategyOnPii-1c4q8Opf.mjs +35 -0
  39. package/dist/packem_shared/maskedRelationLeakViaWith-CPI4s0sl.mjs +76 -0
  40. package/dist/packem_shared/mutatorFullRowReplace-BJnNDaIV.mjs +26 -0
  41. package/dist/packem_shared/normalizeIdUsedAsAuthorization-BVPtCpzT.mjs +50 -0
  42. package/dist/packem_shared/outputProjectionMissingOnPublicRead-Bl5IMx0k.mjs +51 -0
  43. package/dist/packem_shared/ownerFieldFromArgsNotAuth-mOw3hE5z.mjs +26 -0
  44. package/dist/packem_shared/paymentCreateWithoutAuthorize-BYm4JLxo.mjs +26 -0
  45. package/dist/packem_shared/paymentWebhookWideTolerance-D9QQJMJq.mjs +35 -0
  46. package/dist/packem_shared/plaintextSecretInWranglerVariables-NKO4YkKf.mjs +35 -0
  47. package/dist/packem_shared/privilegedDispatchUnvalidatedPayload-5Forjckt.mjs +37 -0
  48. package/dist/packem_shared/privilegedFanoutFromPublicProcedure-D3dL01B8.mjs +26 -0
  49. package/dist/packem_shared/{publicMutationWithoutRatelimit-xBpJ6GWK.mjs → publicMutationWithoutRatelimit-DbIhgi7j.mjs} +2 -2
  50. package/dist/packem_shared/publicTableRlsOptoutConfusion-Bn71yoD4.mjs +38 -0
  51. package/dist/packem_shared/queueWithoutDlq-CSkGNb_0.mjs +41 -0
  52. package/dist/packem_shared/ratelimitDefaultMemoryStore-BISChG5C.mjs +26 -0
  53. package/dist/packem_shared/ratelimitKeySpoofableOrGlobal-DqlHYQQ3.mjs +26 -0
  54. package/dist/packem_shared/ratelimitMiddlewareFailOpen-CJgDCaUw.mjs +33 -0
  55. package/dist/packem_shared/{relationReferencesUnknownField-YznyXt_7.mjs → relationReferencesUnknownField-CjbLScJ1.mjs} +1 -1
  56. package/dist/packem_shared/shapeTargetsGlobalTable-DHrf4Koi.mjs +34 -0
  57. package/dist/packem_shared/shapeUnknownTable-C8aDWFoe.mjs +34 -0
  58. package/dist/packem_shared/softDeleteIncludeDeletedFromArgs-BLqDKrkM.mjs +38 -0
  59. package/dist/packem_shared/storageGenerateUploadUrlNoContentTypePin-Da4L9Ge8.mjs +26 -0
  60. package/dist/packem_shared/storageKeyFromUserArgs-B86elJgS.mjs +19 -0
  61. package/dist/packem_shared/storagePresignedUrlForPrivateContent-yGmb8uqz.mjs +47 -0
  62. package/dist/packem_shared/storageUploadWithoutContentTypeAllowlist-BV-gF1lT.mjs +27 -0
  63. package/dist/packem_shared/storageUploadWithoutMaxSize-DpxO59wU.mjs +27 -0
  64. package/dist/packem_shared/{userCreatingMutationWithoutCaptcha-CH31YsUZ.mjs → userCreatingMutationWithoutCaptcha-2DZtWIPb.mjs} +2 -2
  65. package/dist/packem_shared/vectorsNamespaceFromUserInput-CQhr5bVn.mjs +19 -0
  66. package/dist/packem_shared/workflowDuplicateStepName-ioBxPBCy.mjs +48 -0
  67. package/package.json +4 -3
  68. package/dist/packem_shared/helpers-DNCkMWZQ.mjs +0 -4
package/dist/index.d.ts CHANGED
@@ -18,6 +18,69 @@ interface AdvisorAdminRoute {
18
18
  usesGuard: boolean;
19
19
  }
20
20
  /**
21
+ * One `ctx.ai.run(model, …)` call whose model-id argument is derived from the
22
+ * handler's `args` with no server-side scoping — the input the
23
+ * `ai_raw_run_escape_hatch` lint consumes. `ctx.ai.run` is the raw Workers AI
24
+ * binding passthrough, bypassing the typed `ctx.ai.model(...)` + AI-SDK layer
25
+ * (`generateText`/`streamText`/…) that caps output and enforces a schema. When
26
+ * the model id comes straight from request input, any caller can select an
27
+ * arbitrary model. A fixed literal model, or one scoped by a server-trusted
28
+ * `ctx.*` value, is *not* recorded; only an arg-derived, unscoped model id
29
+ * reaches here — an arg-derived `inputs` argument is normal usage and is never
30
+ * inspected. Produced by the codegen feeder; runtime callers don't supply it,
31
+ * so the lint finds nothing there.
32
+ */
33
+ interface AdvisorAiRawRun {
34
+ /** The exported binding name of the procedure performing the `ctx.ai.run` call. */
35
+ exportName: string;
36
+ /** Source file relative to the lunora dir, no extension. */
37
+ file: string;
38
+ /** 1-based line of the `ctx.ai.run` call, or `0` when unknown. */
39
+ line: number;
40
+ }
41
+ /**
42
+ * One `generateText` / `streamText` call whose `tools` reach a privileged side
43
+ * effect — the shared input for the `ai_tool_side_effect_prompt_injection` lint.
44
+ * A model-callable `tool({ execute })` that writes to the database, dispatches
45
+ * another function, or sends outbound (fetch / mail / queue) hands the LLM the
46
+ * trigger for a real-world action; `userInputDerived` records whether the model
47
+ * input (`prompt`/`messages`/`system`) flows from the handler's `args`, the
48
+ * channel a prompt injection rides in on. Produced by the codegen feeder; runtime
49
+ * callers don't supply it, so the lint finds nothing there.
50
+ */
51
+ interface AdvisorAiToolSideEffect {
52
+ /** The exported binding name of the procedure performing the call. */
53
+ exportName: string;
54
+ /** Source file relative to the lunora dir, no extension. */
55
+ file: string;
56
+ /** 1-based line of the generation call, or `0` when unknown. */
57
+ line: number;
58
+ /** The generation entrypoint invoked. */
59
+ method: "generateText" | "streamText";
60
+ /** The privileged side-effect sink a model-callable tool reaches (`ctx.db.insert`, `ctx.run`, `ctx.fetch`, …). */
61
+ sideEffect: string;
62
+ /** `true` when a model-input option is derived from the handler's `args` (a bare `args.x`, or a name destructured from `args`). */
63
+ userInputDerived: boolean;
64
+ }
65
+ /**
66
+ * One `ctx.fetch(url, …)` call inside an action whose URL argument is derived
67
+ * from the handler's `args` — the input the `action_fetch_ssrf` lint consumes.
68
+ * `ctx.fetch` is the action-only outbound-request escape hatch with no host
69
+ * allowlist, so a URL assembled from request input is a server-side request
70
+ * forgery vector (cloud metadata endpoints, internal services). A fixed literal
71
+ * URL, or one built from config/`ctx.*`, is *not* recorded; only an arg-derived
72
+ * URL reaches here. Produced by the codegen feeder; runtime callers don't supply
73
+ * it, so the lint finds nothing there.
74
+ */
75
+ interface AdvisorArgumentDerivedFetch {
76
+ /** The exported binding name of the action performing the `ctx.fetch` call. */
77
+ exportName: string;
78
+ /** Source file relative to the lunora dir, no extension. */
79
+ file: string;
80
+ /** 1-based line of the `ctx.fetch` call, or `0` when unknown. */
81
+ line: number;
82
+ }
83
+ /**
21
84
  * One public procedure's argument validators reduced to the input-safety facts
22
85
  * the `public_arg_uses_any` and `unbounded_string_arg` lints consume: which args
23
86
  * are declared `v.any()` (unvalidated input) and which `v.string()` args carry no
@@ -38,6 +101,46 @@ interface AdvisorArgumentValidator {
38
101
  unboundedStringArgs: ReadonlyArray<string>;
39
102
  }
40
103
  /**
104
+ * One `createAuth({...})` call's configuration snapshot — the shared input for
105
+ * the five `auth_*` security lints (`auth_trusted_origins_wildcard`,
106
+ * `auth_csrf_check_disabled`, `auth_secure_cookies_disabled`,
107
+ * `auth_email_verification_disabled`, `auth_session_freshage_zero`).
108
+ *
109
+ * The feeder matches the `createAuth` call by callee name and, when its config
110
+ * argument is a static object literal, reads the handful of nested facts each
111
+ * lint cares about. An opaque config (a top-level spread, or a non-object-literal
112
+ * argument) is recorded with `analyzable: false` and every boolean fact left at
113
+ * its SAFE (not-flagged) value, so a config assembled elsewhere can't be flagged
114
+ * on a key it may or may not set. Produced by the codegen feeder; runtime
115
+ * callers don't supply it, so the auth-config lints find nothing there.
116
+ */
117
+ interface AdvisorAuthConfig {
118
+ /**
119
+ * `true` when the call's config argument was a static object literal the
120
+ * feeder could read. `false` when the config was opaque (a variable, spread,
121
+ * call result, or missing argument) — every lint below skips such a config.
122
+ */
123
+ analyzable: boolean;
124
+ /** `advanced.disableCSRFCheck === true`. */
125
+ disableCsrfCheck: boolean;
126
+ /** `emailAndPassword.enabled === true`. */
127
+ emailPasswordEnabled: boolean;
128
+ /** The exported binding name enclosing the `createAuth(...)` call. */
129
+ exportName: string;
130
+ /** Source file relative to the lunora dir, no extension. */
131
+ file: string;
132
+ /** 1-based line of the `createAuth(...)` call, or `0` when unknown. */
133
+ line: number;
134
+ /** `emailAndPassword.requireEmailVerification === true` present. */
135
+ requireEmailVerification: boolean;
136
+ /** `advanced.useSecureCookies === false`. */
137
+ secureCookiesDisabled: boolean;
138
+ /** `session.freshAge === 0` (explicit literal). */
139
+ sessionFreshAgeZero: boolean;
140
+ /** `trustedOrigins` array literal contains a `"*"` element. */
141
+ trustedOriginsWildcard: boolean;
142
+ }
143
+ /**
41
144
  * One `ctx.authApi.&lt;method>(...)` call discovered in a function body — the input
42
145
  * the `auth_api_call_without_headers` lint consumes. Produced by the codegen
43
146
  * feeder; runtime callers don't supply it, so the lint finds nothing there.
@@ -55,6 +158,100 @@ interface AdvisorAuthApiCall {
55
158
  method: string;
56
159
  }
57
160
  /**
161
+ * One `ctx.browser.&lt;method>(url, …)` call whose navigation URL (`arguments[0]`)
162
+ * is derived from the handler's `args` with no server-side scoping — the input
163
+ * the `browser_user_url_without_allowlist` lint consumes. `@lunora/browser`
164
+ * blocks private/internal targets by default, but a request-supplied *public*
165
+ * URL can still turn the headless browser into an open-proxy / SSRF tool
166
+ * (fetching arbitrary third-party URLs, DNS-rebinding to internal hosts). A
167
+ * fixed literal URL, or one scoped by a server-trusted `ctx.*` value, is not
168
+ * recorded; only an arg-derived, unscoped URL reaches here. Produced by the
169
+ * codegen feeder; runtime callers don't supply it, so the lint finds nothing
170
+ * there.
171
+ */
172
+ interface AdvisorBrowserUrlAccess {
173
+ /** The exported binding name of the procedure performing the `ctx.browser` call. */
174
+ exportName: string;
175
+ /** Source file relative to the lunora dir, no extension. */
176
+ file: string;
177
+ /** 1-based line of the `ctx.browser` call, or `0` when unknown. */
178
+ line: number;
179
+ /** The browser method invoked: `content` / `pdf` / `scrape` / `screenshot`. */
180
+ method: string;
181
+ }
182
+ /**
183
+ * One factory/constructor call in `lunora/` whose configuration object literal a
184
+ * security lint inspects for a present-or-absent key — the shared input for the
185
+ * config-call security lints (payment authorize, inbound-mail verify, rate-limit
186
+ * store, browser private-targets).
187
+ *
188
+ * The feeder records the callee name and, when the config argument is a static
189
+ * object literal it could read, the set of keys present and the subset assigned
190
+ * the literal `true`. Produced by the codegen feeder; runtime callers don't
191
+ * supply it, so the config-call lints find nothing there.
192
+ */
193
+ interface AdvisorConfigCall {
194
+ /**
195
+ * `true` when the call's config argument was a static object literal the
196
+ * feeder could read. `false` when the config was opaque (a variable, spread,
197
+ * call result, or missing argument) — key-presence lints skip such calls so
198
+ * a config assembled elsewhere can't be flagged on a key it may well set.
199
+ */
200
+ analyzable: boolean;
201
+ /** The factory function or constructor name at the call site, e.g. `createPayment` / `RateLimiter`. */
202
+ callee: string;
203
+ /** Source file relative to the lunora dir, no extension. */
204
+ file: string;
205
+ /** 1-based line of the call site, or `0` when unknown. */
206
+ line: number;
207
+ /** Keys present in the config object literal (empty when not `analyzable`). */
208
+ presentKeys: ReadonlyArray<string>;
209
+ /** Keys in the config object literal explicitly assigned the literal `true`. */
210
+ trueKeys: ReadonlyArray<string>;
211
+ }
212
+ /**
213
+ * One `ctx.containers.&lt;exportName>.get(name, …)` call whose instance key is
214
+ * derived from the handler's `args` with no server-side scoping — the input
215
+ * the `container_instance_key_from_user_input` lint consumes. A container
216
+ * definition's `.get(name)` accessor routes to one instance per `name`, so a
217
+ * key taken straight from request input lets any caller reach any other
218
+ * tenant's container (a cross-tenant IDOR). A fixed literal key, or one
219
+ * derived from a server-trusted identity (`` `${ctx.auth.userId}` `` —
220
+ * references `ctx`, so treated as scoped), is not recorded; only an
221
+ * arg-derived, unscoped key reaches here. Produced by the codegen feeder;
222
+ * runtime callers don't supply it, so the lint finds nothing there.
223
+ */
224
+ interface AdvisorContainerKeyAccess {
225
+ /** The exported binding name of the procedure performing the `ctx.containers` access. */
226
+ exportName: string;
227
+ /** Source file relative to the lunora dir, no extension. */
228
+ file: string;
229
+ /** 1-based line of the `ctx.containers.*.get` call, or `0` when unknown. */
230
+ line: number;
231
+ /** The container accessor method invoked — always `get` (the only per-instance-key sink). */
232
+ method: string;
233
+ }
234
+ /**
235
+ * One runtime container-override call: a `&lt;handle>.start({ enableInternet: true, … })`
236
+ * launch override, or a `&lt;handle>.egress.&lt;method>(...)` runtime firewall mutation
237
+ * (`allow` / `deny` / `setAllowed`) — the `container_start_enable_internet_override`
238
+ * and `container_runtime_egress_relaxation` lint input. Both shapes re-open network
239
+ * access the static `defineContainer` declaration (and its `container_public_internet`
240
+ * lint) assumes is locked down. Structurally identical to `ContainerOverrideIR`.
241
+ */
242
+ interface AdvisorContainerOverride {
243
+ /** e.g. the egress method name, or `"enableInternet: true"`. */
244
+ detail: string;
245
+ /** Export binding name of the procedure performing the call. */
246
+ exportName: string;
247
+ /** Source file relative to the lunora dir, no extension. */
248
+ file: string;
249
+ /** Which override shape matched. */
250
+ kind: "egress_relaxation" | "enable_internet";
251
+ /** 1-based line of the call, or `0` when unknown. */
252
+ line: number;
253
+ }
254
+ /**
58
255
  * One container declaration discovered in `lunora/containers.ts` — the input
59
256
  * the `container_*` lints consume. Produced by the codegen feeder (which lifts
60
257
  * the static fields of each `defineContainer({...})` export); runtime callers
@@ -84,6 +281,108 @@ interface AdvisorContainer {
84
281
  sleepAfter?: number | string;
85
282
  }
86
283
  /**
284
+ * One rate-limit / Turnstile middleware call — the `ratelimit_middleware_fail_open`
285
+ * lint input. `rateLimit`/`dbRateLimit` (`@lunora/ratelimit`) and
286
+ * `verifyTurnstileMiddleware` (`@lunora/auth`) each accept a `failOpen` escape
287
+ * hatch that admits every request when the limiter/siteverify is unavailable;
288
+ * `failOpen` is `true` only when the options literal set it to the boolean
289
+ * literal `true` (anything else is fail-closed). The lint escalates a fail-open
290
+ * guard to a finding when the guarded procedure (`exportName`/`limitName`) looks
291
+ * auth/payment-sensitive. Produced by the codegen feeder; runtime callers don't
292
+ * supply it, so the lint finds nothing there.
293
+ */
294
+ interface AdvisorFailOpenGuard {
295
+ /** The middleware factory at the call site: `rateLimit` / `dbRateLimit` / `verifyTurnstileMiddleware`. */
296
+ callee: string;
297
+ /** The exported binding name of the procedure the guard is attached to, or `"&lt;module>"` at file scope. */
298
+ exportName: string;
299
+ /** `true` only when the options literal set `failOpen: true` as a boolean literal; a non-literal or absent option is treated as fail-closed. */
300
+ failOpen: boolean;
301
+ /** Source file relative to the lunora dir, no extension. */
302
+ file: string;
303
+ /** The rate-limit `name` (second string argument) for `rateLimit`/`dbRateLimit`; `""` for `verifyTurnstileMiddleware`. */
304
+ limitName: string;
305
+ /** 1-based line of the middleware call, or `0` when unknown. */
306
+ line: number;
307
+ }
308
+ /**
309
+ * One `ctx.flags.boolean("key", &lt;boolean-literal>)` read — the
310
+ * `flag_gates_security_with_unsafe_default` lint input. OpenFeature returns the
311
+ * `defaultValue` when the provider errors, so a fail-open default on a
312
+ * security-shaped key (an `enforce`/`rls`/`gate`/`lockdown` protection
313
+ * defaulting `false`, or an `allow`/`permit`/`bypass` permission defaulting
314
+ * `true`) silently opens access during an outage. Only reads with a
315
+ * statically-known string key and boolean-literal default are recorded; the lint
316
+ * owns the security-shape + polarity judgment. Produced by the codegen feeder;
317
+ * runtime callers don't supply it, so the lint finds nothing there.
318
+ */
319
+ interface AdvisorFlagSecurityDefault {
320
+ /** The boolean-literal default returned on a provider outage (fail-open value). */
321
+ defaultValue: boolean;
322
+ /** The exported binding name of the procedure performing the flag read, or `"&lt;module>"` at file scope. */
323
+ exportName: string;
324
+ /** Source file relative to the lunora dir, no extension. */
325
+ file: string;
326
+ /** The flag key — the first string-literal argument of `ctx.flags.boolean`. */
327
+ key: string;
328
+ /** 1-based line of the `ctx.flags.boolean` call, or `0` when unknown. */
329
+ line: number;
330
+ }
331
+ /**
332
+ * One discovered `httpAction`/`httpRoute` handler that performs a side effect
333
+ * (`ctx.runMutation` / `ctx.runAction` / a `ctx.db.{insert,patch,replace,delete,
334
+ * insertManyUnsafe}` write) from the HTTP edge, with whether it reads `ctx.auth`
335
+ * — the `http_action_missing_auth_guard` lint input. A handler that mutates state
336
+ * or dispatches an action without ever consulting the request identity is an
337
+ * unauthenticated write bypassing identity/RLS (distinct from
338
+ * `admin_route_without_guard`, which covers Studio/admin paths). Only handlers
339
+ * with a statically-resolvable inline body and `ctx` binding are recorded
340
+ * (fail-safe under-report); read-only handlers are never recorded. Produced by
341
+ * the codegen feeder; runtime callers don't supply it, so the lint finds nothing
342
+ * there.
343
+ */
344
+ interface AdvisorHttpActionGuard {
345
+ /** The exported binding name of the handler (or `"&lt;module>"` when mounted inline / not a named binding). */
346
+ exportName: string;
347
+ /** Source file relative to the lunora dir, no extension. */
348
+ file: string;
349
+ /** Which HTTP surface the handler is: a raw `httpAction` or a typed `httpRoute` route. */
350
+ kind: "httpAction" | "httpRoute";
351
+ /** 1-based line of the handler call, or `0` when unknown. */
352
+ line: number;
353
+ /** For an `httpRoute`, the uppercased verb (`"POST"`); absent for a raw `httpAction`. */
354
+ method?: string;
355
+ /** `true` when the handler reads `ctx.auth` (a direct member access or a `const { auth } = ctx` destructure). */
356
+ readsAuth: boolean;
357
+ /** The first side effect found, as a stable label: `runMutation`, `runAction`, or `db.&lt;method>`. */
358
+ sideEffect: string;
359
+ }
360
+ /**
361
+ * One response-header write, inside an `httpAction` handler, whose value is derived
362
+ * from raw request input (`request.headers`, `request.url`/query, `await
363
+ * request.json()`) with no CR/LF sanitizer — the
364
+ * `http_action_response_header_injection` lint input. A `Request`-derived string
365
+ * placed verbatim into a response header lets a caller smuggle `\r\n` and inject
366
+ * extra headers or split the response. Only request-tainted, unguarded sites are
367
+ * recorded — a value routed through `isSafeHeaderValue`, `encodeURIComponent`/
368
+ * `encodeURI`, a numeric coercion, or `btoa` is treated as safe (`String(...)` /
369
+ * `.toString()` are NOT sanitizers). Produced by the codegen feeder; runtime
370
+ * callers don't supply it, so the lint finds nothing there. Structurally identical
371
+ * to `HttpHeaderWriteIR`.
372
+ */
373
+ interface AdvisorHttpHeaderWrite {
374
+ /** The exported binding name of the enclosing handler, or `"&lt;module>"` when mounted inline. */
375
+ exportName: string;
376
+ /** Source file relative to the lunora dir, no extension. */
377
+ file: string;
378
+ /** The header name being written (`"location"`), or `""` when the key is not a string literal. */
379
+ headerName: string;
380
+ /** 1-based line of the request-tainted header value. */
381
+ line: number;
382
+ /** How the header was written. */
383
+ via: "headers-append" | "headers-ctor" | "headers-set" | "response-init";
384
+ }
385
+ /**
87
386
  * One `ctx.sql` access discovered lexically inside a `query(...)` or
88
387
  * `mutation(...)` handler body — the input the `hyperdrive_outside_action` lint
89
388
  * consumes. Produced by the codegen feeder, which walks each exported function's
@@ -110,6 +409,41 @@ interface AdvisorHyperdriveCall {
110
409
  line: number;
111
410
  }
112
411
  /**
412
+ * One `&lt;receiver>.identity.&lt;key>` claim read (where `&lt;receiver>` is an RLS/mask
413
+ * policy `auth`, or `ctx.auth`/`context.auth`) — the shared input for the
414
+ * `identity_undeclared_claim_trusted` lint. `defineIdentity` validates only its
415
+ * declared claims at the trust boundary and forwards undeclared claims
416
+ * verbatim, so a read of a claim outside the declared contract trusts an
417
+ * unvalidated, forgeable value. `declared` records whether `key` is in the
418
+ * contract (or the always-present `userId`); the lint flags the undeclared reads.
419
+ * Produced by the codegen feeder — and only when a resolvable `defineIdentity`
420
+ * contract exists — so runtime callers supply nothing and the lint finds nothing
421
+ * there.
422
+ */
423
+ interface AdvisorIdentityClaimRead {
424
+ /** `true` when `key` is a declared claim (in the `defineIdentity` contract, or the always-present `userId`). */
425
+ declared: boolean;
426
+ /** The exported binding name of the enclosing declaration (`&lt;module>` at file scope). */
427
+ exportName: string;
428
+ /** Source file relative to the lunora dir, no extension. */
429
+ file: string;
430
+ /** The claim key read off the identity bag. */
431
+ key: string;
432
+ /** 1-based line of the read, or `0` when unknown. */
433
+ line: number;
434
+ }
435
+ /**
436
+ * One `buildImageDeliveryUrl({ key, … })` call (`@lunora/bindings/images`) whose
437
+ * `key` — the CDN transform's source image, an absolute URL or an
438
+ * origin-relative key — is derived from the handler's `args` with no
439
+ * server-side scoping — the `images_url_source_from_user_input` lint input.
440
+ */
441
+ interface AdvisorImageDeliveryUrlAccess {
442
+ exportName: string;
443
+ file: string;
444
+ line: number;
445
+ }
446
+ /**
113
447
  * Observed read signal over a table — the input the `index_utilization` runtime
114
448
  * lint consumes. Produced by the studio backend from each shard's recorded
115
449
  * metrics.
@@ -177,6 +511,49 @@ interface AdvisorInsertWrite {
177
511
  table: string;
178
512
  }
179
513
  /**
514
+ * One `ctx.kv.&lt;method>(key, …)` call whose namespace key is derived from the
515
+ * handler's `args` with no server-side scoping — the input the
516
+ * `kv_unscoped_user_key_idor` lint consumes. Workers KV is a single flat
517
+ * namespace, so a key taken straight from request input lets any caller read,
518
+ * overwrite, or delete another user's entry (an insecure direct object
519
+ * reference). A fixed literal key, or one prefixed with a server-trusted identity
520
+ * (`` `${ctx.auth.userId}:…` `` — references `ctx`, so treated as scoped), is not
521
+ * recorded; only an arg-derived, unscoped key reaches here. Produced by the
522
+ * codegen feeder; runtime callers don't supply it, so the lint finds nothing
523
+ * there.
524
+ */
525
+ interface AdvisorKvKeyAccess {
526
+ /** The exported binding name of the procedure performing the `ctx.kv` access. */
527
+ exportName: string;
528
+ /** Source file relative to the lunora dir, no extension. */
529
+ file: string;
530
+ /** 1-based line of the `ctx.kv` call, or `0` when unknown. */
531
+ line: number;
532
+ /** The `ctx.kv` method invoked: `get` / `getRaw` / `getWithMetadata` / `put` / `delete`. */
533
+ method: string;
534
+ }
535
+ /**
536
+ * One `ctx.mail`/`ctx.email` `send`/`queue` call whose recipient field
537
+ * (`to`/`cc`/`bcc`) is derived from the handler's `args` with no server-side
538
+ * scoping — the input the `mail_recipient_from_request_input` lint consumes. A
539
+ * recipient taken straight from request input turns the deployment into an
540
+ * open relay / spam amplifier: any caller can direct mail to an arbitrary
541
+ * address. A fixed literal recipient, or one scoped by a server-trusted
542
+ * `ctx.*` value (e.g. `ctx.auth.user.email`), is not recorded; only an
543
+ * arg-derived, unscoped recipient reaches here. Produced by the codegen
544
+ * feeder; runtime callers don't supply it, so the lint finds nothing there.
545
+ */
546
+ interface AdvisorMailRecipientAccess {
547
+ /** The exported binding name of the procedure performing the `ctx.mail`/`ctx.email` call. */
548
+ exportName: string;
549
+ /** Source file relative to the lunora dir, no extension. */
550
+ file: string;
551
+ /** 1-based line of the `ctx.mail`/`ctx.email` call, or `0` when unknown. */
552
+ line: number;
553
+ /** The mailer method invoked: `send` / `queue`. */
554
+ method: string;
555
+ }
556
+ /**
180
557
  * One procedure (query / mutation / action) discovered in the lunora source,
181
558
  * reduced to the facts the `mask_uncovered_pii_column` lint needs: whether the
182
559
  * procedure's builder chain includes `.use(mask(...))`, which `(table, column)`
@@ -214,6 +591,52 @@ interface AdvisorMaskProcedure {
214
591
  visibility: "internal" | "public";
215
592
  }
216
593
  /**
594
+ * One masked column whose `mask(policies)` strategy is a statically-known
595
+ * literal (`"hash"` or `"redact"`) — the `mask_weak_hash_strategy_on_pii` lint
596
+ * input. Unlike `AdvisorMaskProcedure` (one row per procedure, `maskColumns`
597
+ * without a strategy), this is one row per masked column with its strategy
598
+ * literal attached, so the lint can flag `"hash"` applied to a PII-named
599
+ * column. A `MaskFn` (custom, non-literal) strategy carries no lint-relevant
600
+ * signal and is never recorded here. Produced by the codegen feeder; runtime
601
+ * callers don't supply it, so the lint finds nothing there.
602
+ */
603
+ interface AdvisorMaskStrategy {
604
+ /** Masked column name. */
605
+ column: string;
606
+ /** The exported binding name of the procedure whose `.use(mask(...))` chain declared this column, or `"&lt;module>"` when declared at file scope. */
607
+ exportName: string;
608
+ /** Source file relative to the lunora dir, no extension. */
609
+ file: string;
610
+ /** 1-based line of the masked column's strategy property. */
611
+ line: number;
612
+ /** The statically-known strategy literal: `"hash"` or `"redact"`. */
613
+ strategy: string;
614
+ /** Logical table the masked column belongs to. */
615
+ table: string;
616
+ }
617
+ /**
618
+ * One whole-row `ctx.db.replace(id, document)` write discovered inside a custom
619
+ * mutator's authoritative `server` impl (`lunora/mutators.ts`) — the input the
620
+ * `mutator_full_row_replace` lint consumes.
621
+ *
622
+ * In the local-first sync engine a `replace` overwrites the entire row, so a
623
+ * concurrent edit to a *different* column (committed between this mutator's read
624
+ * and its write) is silently clobbered. `patch(id, { onlyTheField })` merges at
625
+ * the column level instead, letting independent field edits coexist — the
626
+ * blessed pattern for mutators on a synced (poke-live) table. Produced by the
627
+ * codegen feeder, which attributes each `replace` to the mutator export
628
+ * performing it; runtime callers don't supply it, so the lint finds nothing
629
+ * there.
630
+ */
631
+ interface AdvisorMutatorWrite {
632
+ /** The mutator export whose `server` impl performs the replace (e.g. `renameChannel`). */
633
+ exportName: string;
634
+ /** Openable source path the replace appears in — always `lunora/mutators.ts`. */
635
+ file: string;
636
+ /** 1-based line of the `replace(...)` call, or `0` when unknown. */
637
+ line: number;
638
+ }
639
+ /**
217
640
  * One non-deterministic API call discovered lexically inside a `query(...)` or
218
641
  * `mutation(...)` handler body — the input the `nondeterministic_query_mutation`
219
642
  * lint consumes. Produced by the codegen feeder, which walks each exported
@@ -236,6 +659,109 @@ interface AdvisorNondeterministicCall {
236
659
  line: number;
237
660
  }
238
661
  /**
662
+ * One `query`/`mutation` handler that gates a `ctx.db.get`/`patch`/`delete` on a
663
+ * null-checked `ctx.db.normalizeId(table, id)` result — the shared input for the
664
+ * `normalize_id_used_as_authorization` lint. `normalizeId` validates an id's
665
+ * structural shape only (it never reads the database), so a non-null result proves
666
+ * the id is well-formed, never that the caller owns the row; gating access on it is
667
+ * an IDOR. The lint keeps only public procedures with no `.use(rls(...))` and no
668
+ * ownership/identity mention (`mentionsOwnership`), then joins `table` against the
669
+ * schema's RLS mode before flagging. Produced by the codegen feeder; runtime callers
670
+ * don't supply it, so the lint finds nothing there. Structurally identical to
671
+ * `@lunora/codegen`'s `NormalizeIdAuthorizationIR`.
672
+ */
673
+ interface AdvisorNormalizeIdAuthorization {
674
+ /** The exported binding name of the procedure performing the normalize-then-access. */
675
+ exportName: string;
676
+ /** Source file relative to the lunora dir, no extension. */
677
+ file: string;
678
+ /** 1-based line of the `ctx.db.normalizeId(...)` call the access is gated on. */
679
+ line: number;
680
+ /** `true` when the handler anywhere reads an ownership-named identifier or `ctx.auth`/`ctx.identity`/… — an intervening ownership signal. */
681
+ mentionsOwnership: boolean;
682
+ /** The id-first `ctx.db` sink the normalized id reaches. */
683
+ sinkMethod: "delete" | "get" | "patch";
684
+ /** Table named in the `normalizeId` call, or `""` when its table argument wasn't a string literal. */
685
+ table: string;
686
+ /** `true` when the procedure's builder chain carries a `.use(rls(...))` step. */
687
+ usesRls: boolean;
688
+ /** `"internal"` for `internalQuery`/`internalMutation`; `"public"` for `query`/`mutation`. */
689
+ visibility: "internal" | "public";
690
+ }
691
+ /**
692
+ * One `ctx.db` write (`insert` / `replace` / `patch` / `insertManyUnsafe`) that
693
+ * sets an ownership / identity column — `userId`, `ownerId`, `tenantId`, and the
694
+ * like — from the handler's `args` instead of the server-trusted identity. This
695
+ * is the `owner_field_from_args_not_auth` lint input: the ownership column decides
696
+ * who a row belongs to, so a value taken from request input lets any caller write
697
+ * rows owned by another user or tenant (the act-as-any-user / cross-tenant IDOR
698
+ * vector). A column stamped from `ctx.auth` / `ctx.identity`, or set to a fixed
699
+ * literal, is *not* recorded; only an arg-derived identity write reaches here.
700
+ * Produced by the codegen feeder; runtime callers don't supply it, so the lint
701
+ * finds nothing there. Structurally identical to `OwnerFieldWriteIR`.
702
+ */
703
+ interface AdvisorOwnerFieldWrite {
704
+ /** The exported binding name of the procedure performing the write. */
705
+ exportName: string;
706
+ /** The identity column being written from `args` (e.g. `userId`). */
707
+ field: string;
708
+ /** Source file relative to the lunora dir, no extension. */
709
+ file: string;
710
+ /** 1-based line of the `ctx.db` write call, or `0` when unknown. */
711
+ line: number;
712
+ /** The `ctx.db` write method (`insert` / `replace` / `patch` / `insertManyUnsafe`). */
713
+ method: string;
714
+ }
715
+ /**
716
+ * One payment webhook-adapter construction (`createStripeAdapter` /
717
+ * `createPolarAdapter`) — the shared input for the
718
+ * `payment_webhook_wide_tolerance` lint. The adapters verify a webhook's signed
719
+ * timestamp against a `webhookToleranceSeconds` replay window (default 300s); an
720
+ * implausibly wide window leaves the endpoint accepting stale, replayable signed
721
+ * payloads long after capture. `toleranceSeconds` carries the statically-known
722
+ * literal (when present and a plain numeric literal); the lint fires only above a
723
+ * conservative ceiling. Produced by the codegen feeder; runtime callers don't
724
+ * supply it, so the lint finds nothing there.
725
+ */
726
+ interface AdvisorPaymentWebhook {
727
+ /** The adapter factory invoked. */
728
+ callee: "createPolarAdapter" | "createStripeAdapter";
729
+ /** The exported binding name of the enclosing declaration (`&lt;module>` at file scope). */
730
+ exportName: string;
731
+ /** Source file relative to the lunora dir, no extension. */
732
+ file: string;
733
+ /** 1-based line of the construction, or `0` when unknown. */
734
+ line: number;
735
+ /** Statically-known `webhookToleranceSeconds` literal, when present and a plain numeric literal. */
736
+ toleranceSeconds?: number;
737
+ }
738
+ /**
739
+ * One payload-derived privileged dispatch — a `ctx.run`/`context.run` back into a
740
+ * Lunora function from inside a `defineQueue` push handler or a `defineWorkflow`
741
+ * handler, whose args reference the handler's untrusted payload (`context.params`
742
+ * for a workflow, a `for (… of batch.messages)` body for a queue) — the input the
743
+ * `privileged_dispatch_unvalidated_payload` lint consumes. Both handler kinds run
744
+ * under the **system identity** (RLS disabled), so forwarding attacker-influenced
745
+ * payload into the dispatch skips the target's row policy. The lint joins the
746
+ * resolved `targetFile`/`targetExport` against the RLS-procedure evidence and
747
+ * fires only when the target enforces RLS. Produced by the codegen feeder;
748
+ * runtime callers don't supply it, so the lint finds nothing there.
749
+ */
750
+ interface AdvisorPrivilegedDispatch {
751
+ /** `"queue"` for a `defineQueue` handler, `"workflow"` for a `defineWorkflow` handler. */
752
+ dispatchKind: "queue" | "workflow";
753
+ /** Source file relative to the lunora dir, no extension. */
754
+ file: string;
755
+ /** The exported handler binding performing the dispatch. */
756
+ handlerExport: string;
757
+ /** 1-based line of the dispatch call, or `0` when unknown. */
758
+ line: number;
759
+ /** Export name of the dispatched target (`send` in `api.messages.send`). */
760
+ targetExport: string;
761
+ /** File path of the dispatched target relative to the lunora dir (`messages` in `api.messages.send`). */
762
+ targetFile: string;
763
+ }
764
+ /**
239
765
  * One procedure (query / mutation / action) reduced to the protective middlewares
240
766
  * its builder chain installs plus the behavioural facts that decide whether a
241
767
  * guard is expected — the input the `public_mutation_without_ratelimit` and
@@ -249,12 +775,18 @@ interface AdvisorProcedureProtection {
249
775
  callsMail: boolean;
250
776
  /** The exported binding name of the procedure (e.g. `signUp`). */
251
777
  exportName: string;
778
+ /** `true` when the handler fans work out to a privileged, cost-bearing dispatch surface (scheduler `runAfter`/`runAt`, a queue producer send, or a workflow create). Read by the privileged-fanout lint, paired with public visibility and no rate limit. */
779
+ fanOut: boolean;
252
780
  /** Source file relative to the lunora dir, no extension. */
253
781
  file: string;
254
782
  /** Registration kind — `query` is read-only; `mutation`/`action` are write-shaped. */
255
783
  kind: "action" | "mutation" | "query";
784
+ /** `true` when the handler runs an AI generation (`generateText`/`streamText`/`generateObject`/`streamObject`) with no `maxOutputTokens` bound. Read by the `ai_unbounded_generation_public` lint (paired with public visibility). */
785
+ unboundedAiGeneration: boolean;
256
786
  /** `true` when the chain carries `.use(verifyTurnstile(...))` or a `protectPublic({ captcha })` bundle. */
257
787
  usesCaptcha: boolean;
788
+ /** `true` when the handler calls `ctx.db.insertManyUnsafe(...)`, which bypasses validators and triggers. Read by the `insert_many_unsafe_user_data` lint (paired with public visibility). */
789
+ usesInsertManyUnsafe: boolean;
258
790
  /** `true` when the chain carries `.use(mask(...))`. */
259
791
  usesMask: boolean;
260
792
  /** `true` when the chain carries `.use(rateLimit(...))` or a `protectPublic({ rateLimit })` bundle. */
@@ -285,6 +817,45 @@ interface AdvisorQueryRead {
285
817
  table: string;
286
818
  }
287
819
  /**
820
+ * The queue-shaped input the `queue_*` lints consume, produced by the codegen
821
+ * feeder — one per `defineQueue` export in `lunora/queues.ts`. Runtime callers
822
+ * don't supply it, so the queue lints simply find nothing there.
823
+ *
824
+ * A structural subset of codegen's `QueueIR`, so the feeder passes the IR array
825
+ * straight through without conversion (mirrors how `AdvisorWorkflow` tracks
826
+ * `WorkflowIR` and `AdvisorContainer` tracks `ContainerIR`).
827
+ */
828
+ /**
829
+ * The push-consumer batch/retry tuning a queue lint inspects — the subset of
830
+ * `QueueIR["tuning"]` mirrored onto the wrangler `queues.consumers[]` entry.
831
+ */
832
+ interface AdvisorQueueTuning {
833
+ /**
834
+ * The wrangler name of the dead-letter queue exhausted messages are routed
835
+ * to. `undefined` when none is declared — a message that exhausts its
836
+ * retries is then dropped and permanently lost.
837
+ */
838
+ deadLetterQueue?: string;
839
+ /** Max delivery retries before a message is dead-lettered/dropped (Cloudflare default 3). */
840
+ maxRetries?: number;
841
+ }
842
+ /** One queue declared via a `defineQueue()` export in `lunora/queues.ts`. */
843
+ interface AdvisorQueue {
844
+ /** The `lunora/queues.ts` export name, e.g. `notifications`. */
845
+ exportName: string;
846
+ /** How the queue is consumed: `"push"` (a worker `queue()` handler) or `"pull"` (external HTTP). */
847
+ mode: "pull" | "push";
848
+ /**
849
+ * The stable wrangler queue name (kebab-cased export name unless a `name:`
850
+ * literal overrides it). Used to recognise a queue that is itself another
851
+ * queue's `deadLetterQueue` target — a terminal sink that must not be
852
+ * flagged for lacking its own DLQ.
853
+ */
854
+ name: string;
855
+ /** Push-consumer batch/retry tuning; the `deadLetterQueue`/`maxRetries` the queue lints read. */
856
+ tuning: AdvisorQueueTuning;
857
+ }
858
+ /**
288
859
  * One `ctx.r2sql` access discovered lexically inside a `query(...)` or
289
860
  * `mutation(...)` handler body — the input the `r2sql_outside_action` lint
290
861
  * consumes. Produced by the codegen feeder, which walks each exported function's
@@ -312,6 +883,70 @@ interface AdvisorR2sqlCall {
312
883
  line: number;
313
884
  }
314
885
  /**
886
+ * One `rateLimit`/`dbRateLimit` middleware call (`@lunora/ratelimit`) whose
887
+ * `key` selector is derived from the handler's `args` with no server-side
888
+ * scoping — the `ratelimit_key_spoofable_or_global` lint input.
889
+ */
890
+ interface AdvisorRatelimitKeySelector {
891
+ callee: string;
892
+ exportName: string;
893
+ file: string;
894
+ limitName: string;
895
+ line: number;
896
+ }
897
+ /**
898
+ * One `query` handler whose `return` hands back the raw rows of a table — the
899
+ * result of a `ctx.db.&lt;table>.findMany()` / `.findFirst()` / `.get()` read, or a
900
+ * `ctx.db.query("&lt;table>")…collect()` fluent chain — returned directly (or through
901
+ * one local `const` hop) with no hand-built projection. The shared input for the
902
+ * `output_projection_missing_on_public_read` lint, which keeps only `visibility
903
+ * === "public"` rows with no `.output(...)` / `.use(mask(...))` on the chain and
904
+ * joins `table` against the schema's PII-named columns before flagging. Produced by
905
+ * the codegen feeder; runtime callers don't supply it, so the lint finds nothing
906
+ * there. Structurally identical to `@lunora/codegen`'s `RawRowReturnIR`.
907
+ */
908
+ interface AdvisorRawRowReturn {
909
+ /** The exported binding name of the query returning the raw rows. */
910
+ exportName: string;
911
+ /** Source file relative to the lunora dir, no extension. */
912
+ file: string;
913
+ /** 1-based line of the `return` (or concise-body) expression. */
914
+ line: number;
915
+ /** Table whose raw rows are returned, or `""` when the read's table couldn't be statically resolved. */
916
+ table: string;
917
+ /** `true` when the procedure's builder chain carries a `.use(mask(...))` step. */
918
+ usesMask: boolean;
919
+ /** `true` when the procedure's builder chain carries an `.output(...)` return-shape projection. */
920
+ usesOutput: boolean;
921
+ /** `"internal"` for `internalQuery`; `"public"` for `query`. */
922
+ visibility: "internal" | "public";
923
+ }
924
+ /**
925
+ * One `ctx.db.&lt;table>.findMany({ with: { &lt;rel> } })` relation-hydrating list read
926
+ * — the shared input for the `masked_relation_leak_via_with` lint. Column
927
+ * masking is applied per-procedure to the top-level rows of the table named in
928
+ * the read; it does **not** descend into `with`-hydrated relations, so a masked
929
+ * table surfaced only through a `with` on an unprotected parent read is returned
930
+ * in the clear. The lint resolves each relation accessor to its target table and
931
+ * joins it against the discovered mask evidence before flagging. Produced by the
932
+ * codegen feeder; runtime callers don't supply it, so the lint finds nothing
933
+ * there. Structurally identical to `@lunora/codegen`'s `RelationLoadIR`.
934
+ */
935
+ interface AdvisorRelationLoad {
936
+ /** The exported binding name of the procedure performing the read. */
937
+ exportName: string;
938
+ /** Source file relative to the lunora dir, no extension. */
939
+ file: string;
940
+ /** 1-based line of the read call. */
941
+ line: number;
942
+ /** Parent table the read targets, or `""` when it couldn't be statically resolved. */
943
+ parentTable: string;
944
+ /** Relation accessor names named in the read's `with: { … }` map — matched against the parent table's declared relations. */
945
+ relations: ReadonlyArray<string>;
946
+ /** `"internal"` for `internalQuery` / `internalMutation` / `internalAction`. */
947
+ visibility: "internal" | "public";
948
+ }
949
+ /**
315
950
  * One procedure (query / mutation / action) discovered in the lunora source,
316
951
  * reduced to the facts the `rls_uncovered_table` lint needs: whether the
317
952
  * procedure's builder chain includes `.use(rls(...))`, and which tables the
@@ -351,6 +986,15 @@ interface AdvisorRlsProcedure {
351
986
  * read — tables, their columns, indexes, and relations.
352
987
  */
353
988
  interface AdvisorSchema {
989
+ /**
990
+ * Set when the schema opted into `.rls("required")` — every table's `ctx.db`
991
+ * write path is denied without an RLS-covering procedure UNLESS the table
992
+ * itself is `.public()` (see {@link AdvisorTable.isPublic}). `undefined` when
993
+ * the schema never called `.rls("required")`. Read by the
994
+ * `public_table_rls_optout_confusion` and `allow_unauthenticated_shard_access_enabled`
995
+ * lints.
996
+ */
997
+ rlsMode?: "required";
354
998
  tables: ReadonlyArray<AdvisorTable>;
355
999
  }
356
1000
  /** A table plus the column/index/relation metadata lints inspect. */
@@ -363,6 +1007,14 @@ interface AdvisorTable {
363
1007
  */
364
1008
  externallyManaged?: boolean;
365
1009
  /**
1010
+ * Set when the table was declared with `.source(...)` (plan 077) —
1011
+ * materialized from an external Hyperdrive-backed database. Read by the
1012
+ * `external_source_*` lints to enforce the tenant-scope boundary (mandatory
1013
+ * `tenantBy` under `.shardBy()`) and reject sourcing a `.global()` table.
1014
+ * Optional — feeders that don't know about sourced tables omit it.
1015
+ */
1016
+ externalSource?: AdvisorExternalSource;
1017
+ /**
366
1018
  * Declared column names (the `defineTable({...})` keys). Excludes the
367
1019
  * framework-managed system fields `_id` / `_creationTime`, which every table
368
1020
  * has implicitly — lints that resolve a column treat those as always valid.
@@ -370,6 +1022,15 @@ interface AdvisorTable {
370
1022
  fields: ReadonlyArray<string>;
371
1023
  /** Every declared index, across all kinds (secondary / search / rank / vector). */
372
1024
  indexes: ReadonlyArray<AdvisorIndex>;
1025
+ /**
1026
+ * `true` when the table was declared with `.public()` — an explicit opt-OUT
1027
+ * of the schema's `.rls("required")` enforcement for this one table (the
1028
+ * name is misleading: it means "unprotected by RLS", not "safe to read
1029
+ * publicly"). Has no effect when the schema itself never required RLS.
1030
+ * Defaults to `false`. Read by `public_table_rls_optout_confusion` and
1031
+ * `allow_unauthenticated_shard_access_enabled`.
1032
+ */
1033
+ isPublic?: boolean;
373
1034
  /** Table name. */
374
1035
  name: string;
375
1036
  /**
@@ -384,6 +1045,27 @@ interface AdvisorTable {
384
1045
  optionalFields?: ReadonlySet<string>;
385
1046
  /** Declared relations (`.relations((r) => …)`). */
386
1047
  relations: ReadonlyArray<AdvisorRelation>;
1048
+ /**
1049
+ * Storage tier the table is declared in: `"global"` (a `.global()` table,
1050
+ * lives in D1 — the cross-shard tier), `"shardBy"` (partitioned across
1051
+ * shard DOs by a key), or `"root"` (the default single-DO table). Read by
1052
+ * the `shape_*` lints to flag replication shapes targeting a `.global()`
1053
+ * table (poll-refreshed/latency-tiered, not poke-live). Optional — the
1054
+ * codegen feeder always supplies it, the runtime feeder derives it; a feeder
1055
+ * that omits it leaves tier-sensitive lints to treat the table as local.
1056
+ */
1057
+ shardKind?: "global" | "root" | "shardBy";
1058
+ /**
1059
+ * Set when the table opted into `.softDelete()` — the marker column
1060
+ * (`field`, default `deletedAt`) whose presence excludes a row from list
1061
+ * reads unless `includeDeleted: true` is passed. Read by
1062
+ * `soft_delete_include_deleted_from_args` to confirm a read's target actually
1063
+ * soft-deletes before flagging an `includeDeleted` toggle on a public read.
1064
+ * Optional — a feeder that doesn't track soft-delete omits it.
1065
+ */
1066
+ softDelete?: {
1067
+ field: string;
1068
+ };
387
1069
  }
388
1070
  /**
389
1071
  * One declared index, flattened across Lunora's index kinds so a single lint can
@@ -400,6 +1082,21 @@ interface AdvisorIndex {
400
1082
  name: string;
401
1083
  unique?: boolean;
402
1084
  }
1085
+ /** The statically-knowable `.source(...)` bits the `external_source_*` lints read. */
1086
+ interface AdvisorExternalSource {
1087
+ /** `true` when a `reconcileEveryMs` was given (the incremental-mode delete-visibility companion). */
1088
+ hasReconcile?: boolean;
1089
+ /** `true` when a `tenantBy` mapper was given — the tenant-isolation boundary. */
1090
+ hasTenantBy: boolean;
1091
+ /** Delete-detection mode literal, when given (`"full-pull"` | `"incremental"`). */
1092
+ mode?: string;
1093
+ /**
1094
+ * `true` when `.source(...)` was declared but its config wasn't a static object
1095
+ * literal, so `hasTenantBy` (and the rest) couldn't be read. Only the codegen
1096
+ * feeder can hit this; the runtime feeder always holds the real config.
1097
+ */
1098
+ unanalyzable?: boolean;
1099
+ }
403
1100
  /**
404
1101
  * One declared relation. For a `one` relation the FK column `field` lives on
405
1102
  * the holding table; for `many` it lives on the target. `name` is the accessor
@@ -440,6 +1137,28 @@ interface AdvisorSecretLiteral {
440
1137
  preview: string;
441
1138
  }
442
1139
  /**
1140
+ * A replication shape declared via `defineShape({ table, where, columns? })` in
1141
+ * `lunora/shapes.ts` (the local-first sync engine's partial-replication unit).
1142
+ * The `shape_*` lints cross-reference each shape's {@link AdvisorShape.table}
1143
+ * against the declared schema to flag a shape targeting an unknown table or a
1144
+ * `.global()` table (which replicates through the latency-tiered D1 poll path,
1145
+ * not the poke-live op-log). Supplied by the codegen feeder, which lifts only
1146
+ * the export name + the static `table` literal; absent for runtime callers,
1147
+ * where the shape lints find nothing.
1148
+ */
1149
+ interface AdvisorShape {
1150
+ /** Export binding name — the shape's registry key (e.g. `channelMessages`). */
1151
+ exportName: string;
1152
+ /** File the shape is declared in (relative, for the operator to open). */
1153
+ file: string;
1154
+ /**
1155
+ * The `table` string literal the shape replicates from, or `undefined` when
1156
+ * the feeder could not read it as a plain string literal — tier-sensitive
1157
+ * lints skip a shape with no resolvable table rather than guessing.
1158
+ */
1159
+ table?: string;
1160
+ }
1161
+ /**
443
1162
  * One shard's observed traffic share — the input the `hot_shard` runtime lint
444
1163
  * consumes. Produced by the studio backend, which fans out over a sharded
445
1164
  * function's shards and reads each shard's recorded request volume from the
@@ -469,6 +1188,32 @@ interface AdvisorShardTraffic {
469
1188
  shardKey: string;
470
1189
  }
471
1190
  /**
1191
+ * One `ctx.db.&lt;table>.findMany({ includeDeleted })` list read whose
1192
+ * `includeDeleted` is either a hardcoded `true` or derived from the handler's
1193
+ * `args` — the shared input for the `soft_delete_include_deleted_from_args`
1194
+ * lint. `includeDeleted` resurfaces rows a `.softDelete()` table would otherwise
1195
+ * hide from list reads; on a public read that means any caller (arg-derived) or
1196
+ * every caller (hardcoded `true`) can see soft-deleted rows. Produced by the
1197
+ * codegen feeder; runtime callers don't supply it, so the lint finds nothing
1198
+ * there. Structurally identical to `@lunora/codegen`'s `SoftDeleteReadIR`.
1199
+ */
1200
+ interface AdvisorSoftDeleteRead {
1201
+ /** The exported binding name of the procedure performing the read. */
1202
+ exportName: string;
1203
+ /** Source file relative to the lunora dir, no extension. */
1204
+ file: string;
1205
+ /** `true` when `includeDeleted` was derived from the handler's `args` (any caller can flip it). */
1206
+ fromArgs: boolean;
1207
+ /** `true` when `includeDeleted` was a hardcoded `true` literal (always resurfaces soft-deleted rows). */
1208
+ hardcodedTrue: boolean;
1209
+ /** 1-based line of the read call. */
1210
+ line: number;
1211
+ /** Table read, or `""` when the table couldn't be statically resolved. */
1212
+ table: string;
1213
+ /** `"internal"` for `internalQuery` / `internalMutation` / `internalAction`. */
1214
+ visibility: "internal" | "public";
1215
+ }
1216
+ /**
472
1217
  * One `ctx.sql` tagged-template interpolation that splices an unparameterized
473
1218
  * string-building expression into the query — the input the `sql_injection_risk`
474
1219
  * lint consumes. A `${…}` placeholder that simply names a value is bound as a
@@ -486,6 +1231,55 @@ interface AdvisorSqlInterpolation {
486
1231
  line: number;
487
1232
  }
488
1233
  /**
1234
+ * One `ctx.storage.&lt;bucket>.&lt;method>(key, …)` call whose R2 object key is derived
1235
+ * from the handler's `args` with no server-side scoping — the input the
1236
+ * `storage_key_from_user_args` lint consumes. An object key taken straight from
1237
+ * request input lets any caller read, overwrite, or delete another user's object
1238
+ * (object-level IDOR). A key prefixed with a server-trusted identity (a `ctx.*`
1239
+ * value such as `` `${ctx.auth.userId}/…` ``) is treated as scoped and is *not*
1240
+ * recorded; only an arg-derived, `ctx`-free key reaches here. Produced by the
1241
+ * codegen feeder; runtime callers don't supply it, so the lint finds nothing there.
1242
+ */
1243
+ interface AdvisorStorageKeyAccess {
1244
+ /** The exported binding name of the procedure performing the storage call. */
1245
+ exportName: string;
1246
+ /** Source file relative to the lunora dir, no extension. */
1247
+ file: string;
1248
+ /** 1-based line of the storage call, or `0` when unknown. */
1249
+ line: number;
1250
+ /** The bucket method invoked with the arg-derived key, e.g. `get` / `put` / `delete` / `download`. */
1251
+ method: string;
1252
+ }
1253
+ /**
1254
+ * One tracked `ctx.storage.&lt;bucket>.&lt;method>(...)` upload/signing call — the
1255
+ * shared input for the storage config-hygiene security lints
1256
+ * (`storage_upload_without_content_type_allowlist`, `storage_upload_without_max_size`,
1257
+ * `storage_generate_upload_url_no_content_type_pin`, `storage_presigned_url_for_private_content`).
1258
+ * `upload`/`store` carry the `UploadOptions` guards (`allowedContentTypes` /
1259
+ * `maxSize`); `generateUploadUrl` carries the signed-PUT `contentType` pin;
1260
+ * `getPresignedUrl`/`getSignedUrl` carry a statically-known `expiresInSeconds`
1261
+ * literal. `presentKeys` is empty (and `expiresInSeconds` unset) when the
1262
+ * options argument was absent, a non-literal, or a spread — see `analyzable`.
1263
+ * Produced by the codegen feeder; runtime callers don't supply it, so the
1264
+ * lints find nothing there.
1265
+ */
1266
+ interface AdvisorStorageUpload {
1267
+ /** `true` when the call's options-object argument (or its deliberate absence) was statically resolvable. */
1268
+ analyzable: boolean;
1269
+ /** Numeric literal value of an `expiresInSeconds` option, when statically known (`getSignedUrl` / `getPresignedUrl` only). */
1270
+ expiresInSeconds?: number;
1271
+ /** The exported binding name of the procedure performing the call. */
1272
+ exportName: string;
1273
+ /** Source file relative to the lunora dir, no extension. */
1274
+ file: string;
1275
+ /** 1-based line of the call, or `0` when unknown. */
1276
+ line: number;
1277
+ /** The `ctx.storage` method invoked. */
1278
+ method: "generateUploadUrl" | "getPresignedUrl" | "getSignedUrl" | "store" | "upload";
1279
+ /** Options-object keys present at the call site (empty when not `analyzable`, or when no options argument was passed). */
1280
+ presentKeys: string[];
1281
+ }
1282
+ /**
489
1283
  * A bounded sample of rows from one table, fed into the constraint-validator
490
1284
  * lint by the studio backend (via `readTablePage`). The cap prevents unbounded
491
1285
  * scans while still catching obvious violations on small-to-medium tables.
@@ -511,6 +1305,28 @@ interface AdvisorTableSample {
511
1305
  readonly truncated: boolean;
512
1306
  }
513
1307
  /**
1308
+ * One `ctx.vectors.&lt;method>(indexName, input)` call whose `input.namespace` is
1309
+ * derived from the handler's `args` with no server-side scoping — the input the
1310
+ * `vectors_namespace_from_user_input` lint consumes. A Vectorize namespace
1311
+ * partitions one index into isolated sub-collections, so a namespace taken
1312
+ * straight from request input lets any caller read or poison another tenant's
1313
+ * vectors. A fixed literal namespace, or one prefixed with a server-trusted
1314
+ * identity (`` `${ctx.auth.orgId}` `` — references `ctx`, so treated as
1315
+ * scoped), is not recorded; only an arg-derived, unscoped namespace reaches
1316
+ * here. Produced by the codegen feeder; runtime callers don't supply it, so
1317
+ * the lint finds nothing there.
1318
+ */
1319
+ interface AdvisorVectorNamespaceAccess {
1320
+ /** The exported binding name of the procedure performing the `ctx.vectors` access. */
1321
+ exportName: string;
1322
+ /** Source file relative to the lunora dir, no extension. */
1323
+ file: string;
1324
+ /** 1-based line of the `ctx.vectors` call, or `0` when unknown. */
1325
+ line: number;
1326
+ /** The `ctx.vectors` method invoked: `query` / `upsert` / `upsertMany`. */
1327
+ method: string;
1328
+ }
1329
+ /**
514
1330
  * The two workflow-shaped inputs the `workflow_*` lints consume, produced by the
515
1331
  * codegen feeder. {@link AdvisorWorkflow} is the declaration side (one per
516
1332
  * `defineWorkflow` export in `lunora/workflows.ts`); {@link AdvisorWorkflowCall}
@@ -523,10 +1339,27 @@ interface AdvisorTableSample {
523
1339
  * how `AdvisorContainer` tracks `ContainerIR` and `AdvisorInsertWrite` tracks
524
1340
  * `InsertWriteIR`).
525
1341
  */
1342
+ /** One durable step call lifted from a workflow handler body — the input the duplicate-step-name lint compares. Structural subset of codegen's `WorkflowStepIR`. */
1343
+ interface AdvisorWorkflowStep {
1344
+ /** 1-based line of the durable step call, or `0` when unknown. */
1345
+ line: number;
1346
+ /** The native step method invoked: `do` / `sleep` / `sleepUntil` / `waitForEvent`. */
1347
+ method: string;
1348
+ /** The step's static label (the first string-literal argument). */
1349
+ name: string;
1350
+ }
526
1351
  /** One workflow declared via a `defineWorkflow()` export in `lunora/workflows.ts`. */
527
1352
  interface AdvisorWorkflow {
528
1353
  /** The `lunora/workflows.ts` export name, e.g. `orderPipeline`. */
529
1354
  exportName: string;
1355
+ /**
1356
+ * The durable step labels discovered in the handler body, in source order —
1357
+ * the duplicate-step-name input. Cloudflare memoizes a step by its name, so a
1358
+ * name used twice makes the second call silently return the first's cached
1359
+ * result. Supplied by the codegen feeder; `undefined` for runtime callers,
1360
+ * where the lint finds nothing.
1361
+ */
1362
+ steps?: ReadonlyArray<AdvisorWorkflowStep>;
530
1363
  }
531
1364
  /** One `ctx.workflows.get("name")` call discovered in a function body. */
532
1365
  interface AdvisorWorkflowCall {
@@ -540,6 +1373,23 @@ interface AdvisorWorkflowCall {
540
1373
  workflow: string;
541
1374
  }
542
1375
  /**
1376
+ * One committed `wrangler.jsonc` `vars` entry whose value is a plaintext secret —
1377
+ * the input the `plaintext_secret_in_wrangler_vars` lint consumes. The full value
1378
+ * is never carried; only a redacted {@link AdvisorWranglerVariable.preview}.
1379
+ * Produced by `@lunora/config` (which reads `wrangler.jsonc`) and threaded through
1380
+ * codegen; runtime callers don't supply it, so the lint finds nothing there.
1381
+ */
1382
+ interface AdvisorWranglerVariable {
1383
+ /** The `wrangler.jsonc` file the var was read from, relative to the project root. */
1384
+ file: string;
1385
+ /** The offending `vars` key (e.g. `STRIPE_SECRET_KEY`). */
1386
+ key: string;
1387
+ /** Heuristic that matched, e.g. `stripe_live_key` / `private_key` / `secret_named_var`. */
1388
+ kind: string;
1389
+ /** Redacted preview (first few chars + length) — never the full secret. */
1390
+ preview: string;
1391
+ }
1392
+ /**
543
1393
  * Severity of a finding, mirroring splinter's `level`. `ERROR` is a definite
544
1394
  * problem, `WARN` a likely one, `INFO` an advisory nudge.
545
1395
  */
@@ -610,6 +1460,33 @@ interface LintContext {
610
1460
  */
611
1461
  adminRoutes?: ReadonlyArray<AdvisorAdminRoute>;
612
1462
  /**
1463
+ * `ctx.ai.run(model, …)` calls whose model-id argument is derived from the
1464
+ * handler's `args` with no server-side scoping — the `ai_raw_run_escape_hatch`
1465
+ * input. `ctx.ai.run` is the raw Workers AI passthrough, so an arg-derived model
1466
+ * id lets any caller select an arbitrary model, bypassing the typed
1467
+ * `ctx.ai.model(...)` + AI-SDK layer's cap/schema (an arg-derived `inputs`
1468
+ * argument is normal usage and is not recorded). Supplied by the codegen feeder;
1469
+ * absent for runtime callers, where the lint finds nothing.
1470
+ */
1471
+ aiRawRuns?: ReadonlyArray<AdvisorAiRawRun>;
1472
+ /**
1473
+ * `generateText` / `streamText` calls whose model-callable `tools` reach a
1474
+ * privileged side effect (DB write / function dispatch / outbound
1475
+ * fetch/mail/queue) — the `ai_tool_side_effect_prompt_injection` input. Each
1476
+ * row's `userInputDerived` says whether the model input flows from `args`; the
1477
+ * lint fires only when it does. Supplied by the codegen feeder; absent for
1478
+ * runtime callers, where the lint finds nothing.
1479
+ */
1480
+ aiToolSideEffects?: ReadonlyArray<AdvisorAiToolSideEffect>;
1481
+ /**
1482
+ * `ctx.fetch(url, …)` calls inside actions whose URL argument is derived from
1483
+ * the handler's `args` — the `action_fetch_ssrf` input. `ctx.fetch` has no
1484
+ * host allowlist, so a URL built from request input is a server-side request
1485
+ * forgery vector. Supplied by the codegen feeder; absent for runtime callers,
1486
+ * where the lint finds nothing.
1487
+ */
1488
+ argumentDerivedFetches?: ReadonlyArray<AdvisorArgumentDerivedFetch>;
1489
+ /**
613
1490
  * Per-public-procedure argument validators that weaken input safety — the
614
1491
  * `public_arg_uses_any` (`v.any()` args) and `unbounded_string_arg` (length-less
615
1492
  * `v.string()` args) input. Supplied by the codegen feeder for public procedures
@@ -623,12 +1500,98 @@ interface LintContext {
623
1500
  */
624
1501
  authApiCalls?: ReadonlyArray<AdvisorAuthApiCall>;
625
1502
  /**
1503
+ * Per-`createAuth({...})`-call configuration snapshots — the shared input for
1504
+ * the five `auth_*` security lints (`auth_trusted_origins_wildcard`,
1505
+ * `auth_csrf_check_disabled`, `auth_secure_cookies_disabled`,
1506
+ * `auth_email_verification_disabled`, `auth_session_freshage_zero`). Each
1507
+ * carries whether the call's config object literal was statically analyzable
1508
+ * and, when it was, the handful of nested facts the lints check (a
1509
+ * `trustedOrigins` wildcard, `advanced.disableCSRFCheck`/`useSecureCookies`,
1510
+ * `emailAndPassword.enabled`/`requireEmailVerification`,
1511
+ * `session.freshAge === 0`). Supplied by the codegen feeder; absent for
1512
+ * runtime callers, where the auth-config lints find nothing.
1513
+ */
1514
+ authConfigs?: ReadonlyArray<AdvisorAuthConfig>;
1515
+ /**
1516
+ * `ctx.browser.&lt;method>(url, …)` calls whose navigation URL is derived from the
1517
+ * handler's `args` with no server-side scoping — the
1518
+ * `browser_user_url_without_allowlist` input. `@lunora/browser` blocks
1519
+ * private/internal targets by default, but a request-supplied public URL can
1520
+ * still be an open-proxy / SSRF vector; the lint suppresses findings when a
1521
+ * `createBrowser` config-call is hardened with `allowedHosts` or `resolveDns`.
1522
+ * Supplied by the codegen feeder; absent for runtime callers, where the lint
1523
+ * finds nothing.
1524
+ */
1525
+ browserUrlAccesses?: ReadonlyArray<AdvisorBrowserUrlAccess>;
1526
+ /**
1527
+ * Factory/constructor calls in `lunora/` whose config object literal a
1528
+ * security lint inspects for a present-or-absent key — the shared input for
1529
+ * the config-call security lints (payment authorize, inbound-mail verify,
1530
+ * rate-limit store, browser private-targets). Supplied by the codegen feeder;
1531
+ * absent for runtime callers, where the config-call lints find nothing.
1532
+ */
1533
+ configCalls?: ReadonlyArray<AdvisorConfigCall>;
1534
+ /**
1535
+ * `ctx.containers.&lt;name>.get(key, …)` calls whose instance key is derived from
1536
+ * the handler's `args` with no server-side scoping — the
1537
+ * `container_instance_key_from_user_input` input. Each container definition's
1538
+ * `.get(name)` accessor routes to one instance per key, so an arg-derived key lets
1539
+ * any caller reach another tenant's container (cross-tenant IDOR). A key scoped by
1540
+ * a server-trusted `ctx.*` value, or a fixed literal, is not recorded. Supplied by
1541
+ * the codegen feeder; absent for runtime callers, where the lint finds nothing.
1542
+ */
1543
+ containerKeyAccesses?: ReadonlyArray<AdvisorContainerKeyAccess>;
1544
+ /**
1545
+ * Runtime container-override calls — a `.start({ enableInternet: true, … })`
1546
+ * launch override, or a `.egress.&lt;method>(...)` runtime firewall mutation — the
1547
+ * `container_start_enable_internet_override` and `container_runtime_egress_relaxation`
1548
+ * lint input. Supplied by the codegen feeder; absent for runtime callers, where
1549
+ * those lints find nothing.
1550
+ */
1551
+ containerOverrides?: ReadonlyArray<AdvisorContainerOverride>;
1552
+ /**
626
1553
  * Containers declared in `lunora/containers.ts` — the `container_*` lint
627
1554
  * input. Supplied by the codegen feeder; absent for runtime callers, where
628
1555
  * the container lints find nothing.
629
1556
  */
630
1557
  containers?: ReadonlyArray<AdvisorContainer>;
631
1558
  /**
1559
+ * `rateLimit`/`dbRateLimit` (`@lunora/ratelimit`) and `verifyTurnstileMiddleware`
1560
+ * (`@lunora/auth`) middleware calls, each with whether its options literal set
1561
+ * `failOpen: true` and the rate-limit `name` — the
1562
+ * `ratelimit_middleware_fail_open` input. These guards fail closed by default; a
1563
+ * `failOpen: true` admits every request during a limiter/siteverify outage, so
1564
+ * the lint fires when a fail-open guard protects an auth/payment-sensitive
1565
+ * procedure. Supplied by the codegen feeder; absent for runtime callers, where
1566
+ * the lint finds nothing.
1567
+ */
1568
+ failOpenGuards?: ReadonlyArray<AdvisorFailOpenGuard>;
1569
+ /**
1570
+ * `ctx.flags.boolean(key, default)` reads with a statically-known string key and
1571
+ * boolean-literal default — the `flag_gates_security_with_unsafe_default` input.
1572
+ * OpenFeature returns the default when the provider errors, so a fail-open
1573
+ * default on a security-shaped key (an `enforce`/`rls`/`gate`/`lockdown`
1574
+ * protection defaulting `false`, or an `allow`/`permit`/`bypass` permission
1575
+ * defaulting `true`) silently opens access during an outage. Supplied by the
1576
+ * codegen feeder; absent for runtime callers, where the lint finds nothing.
1577
+ */
1578
+ flagSecurityDefaults?: ReadonlyArray<AdvisorFlagSecurityDefault>;
1579
+ /**
1580
+ * `httpAction`/`httpRoute` handlers that perform a side effect
1581
+ * (`ctx.runMutation` / `ctx.runAction` / a `ctx.db` write) from the HTTP edge,
1582
+ * with whether each reads `ctx.auth` — the `http_action_missing_auth_guard`
1583
+ * input. Supplied by the codegen feeder; absent for runtime callers, where the
1584
+ * lint finds nothing.
1585
+ */
1586
+ httpActionGuards?: ReadonlyArray<AdvisorHttpActionGuard>;
1587
+ /**
1588
+ * Response-header writes, inside `httpAction` handlers, whose value is derived
1589
+ * from raw request input (`request.headers`/URL/query/body) with no CR/LF
1590
+ * sanitizer — the `http_action_response_header_injection` input. Supplied by the
1591
+ * codegen feeder; absent for runtime callers, where the lint finds nothing.
1592
+ */
1593
+ httpHeaderWrites?: ReadonlyArray<AdvisorHttpHeaderWrite>;
1594
+ /**
632
1595
  * Hyperdrive `ctx.sql` accesses discovered lexically inside `query`/`mutation`
633
1596
  * handler bodies — the `hyperdrive_outside_action` input. Supplied by the
634
1597
  * codegen feeder, which omits `action` handlers (where `ctx.sql` is the typed,
@@ -636,6 +1599,30 @@ interface LintContext {
636
1599
  */
637
1600
  hyperdriveCalls?: ReadonlyArray<AdvisorHyperdriveCall>;
638
1601
  /**
1602
+ * `&lt;receiver>.identity.&lt;key>` claim reads (RLS/mask policy `auth`, or
1603
+ * `ctx.auth`/`context.auth`) — the `identity_undeclared_claim_trusted` input.
1604
+ * `defineIdentity` validates only declared claims and forwards undeclared ones
1605
+ * verbatim, so each row's `declared` flag says whether `key` is in the contract
1606
+ * (or the always-present `userId`); the lint fires on the undeclared reads.
1607
+ * Supplied by the codegen feeder — and only when a resolvable `defineIdentity`
1608
+ * contract exists; absent for runtime callers, where the lint finds nothing.
1609
+ */
1610
+ identityClaimReads?: ReadonlyArray<AdvisorIdentityClaimRead>;
1611
+ /**
1612
+ * `buildImageDeliveryUrl({ key, … })` calls (`@lunora/bindings/images`) whose
1613
+ * `key` — the CDN transform's source image, an absolute URL or an
1614
+ * origin-relative key — is derived from the handler's `args` with no
1615
+ * server-side scoping — the `images_url_source_from_user_input` input.
1616
+ * `ctx.images.transform`/`info` take image bytes, never a URL, so they are
1617
+ * not sinks; only the `key` of `buildImageDeliveryUrl` accepts a URL-or-key
1618
+ * source and is inspected. An arg-derived key lets any caller point the
1619
+ * CDN's `/cdn-cgi/image/` transform at an attacker-chosen origin (SSRF /
1620
+ * open proxy). A fixed literal, or a key scoped by a server-trusted `ctx.*`
1621
+ * value, is not recorded. Supplied by the codegen feeder; absent for
1622
+ * runtime callers, where the lint finds nothing.
1623
+ */
1624
+ imageDeliveryUrlAccesses?: ReadonlyArray<AdvisorImageDeliveryUrlAccess>;
1625
+ /**
639
1626
  * Per-declared-index hit counts observed at runtime (the dead-index half of
640
1627
  * the `index_utilization` lint input). Supplied by the studio backend, which
641
1628
  * sums the per-`(table, index)` reads each shard records in the durable
@@ -651,6 +1638,26 @@ interface LintContext {
651
1638
  */
652
1639
  inserts?: ReadonlyArray<AdvisorInsertWrite>;
653
1640
  /**
1641
+ * `ctx.kv.&lt;method>(key, …)` calls whose namespace key is derived from the
1642
+ * handler's `args` with no server-side scoping — the `kv_unscoped_user_key_idor`
1643
+ * input. Workers KV is one flat namespace, so a key taken straight from request
1644
+ * input lets any caller read/overwrite/delete another user's entry (IDOR). Only
1645
+ * arg-derived, unscoped keys are recorded (a fixed literal or a
1646
+ * `${ctx.auth.userId}:…` prefix is not). Supplied by the codegen feeder; absent
1647
+ * for runtime callers, where the lint finds nothing.
1648
+ */
1649
+ kvKeyAccesses?: ReadonlyArray<AdvisorKvKeyAccess>;
1650
+ /**
1651
+ * `ctx.mail`/`ctx.email` `send`/`queue` calls whose `to`/`cc`/`bcc` recipient is
1652
+ * derived from the handler's `args` with no server-side scoping — the
1653
+ * `mail_recipient_from_request_input` input. A recipient taken straight from
1654
+ * request input turns the deployment into an open relay / spam amplifier (any
1655
+ * caller can direct mail to an arbitrary address). A recipient scoped by a
1656
+ * server-trusted `ctx.*` value, or a fixed literal, is not recorded. Supplied by
1657
+ * the codegen feeder; absent for runtime callers, where the lint finds nothing.
1658
+ */
1659
+ mailRecipientAccesses?: ReadonlyArray<AdvisorMailRecipientAccess>;
1660
+ /**
654
1661
  * Per-procedure column-masking usage discovered in function bodies (the
655
1662
  * `mask_uncovered_pii_column` input). Carries whether each procedure's builder
656
1663
  * chain includes `.use(mask(...))`, which `(table, column)` pairs its mask
@@ -660,6 +1667,23 @@ interface LintContext {
660
1667
  */
661
1668
  maskProcedures?: ReadonlyArray<AdvisorMaskProcedure>;
662
1669
  /**
1670
+ * Masked columns whose `mask(policies)` strategy is a statically-known
1671
+ * literal (the `mask_weak_hash_strategy_on_pii` input). One row per masked
1672
+ * column, with the `"hash"` / `"redact"` strategy literal attached; a
1673
+ * `MaskFn` (custom, non-literal) strategy is never recorded. Supplied by
1674
+ * the codegen feeder; absent for runtime callers, where the lint finds
1675
+ * nothing.
1676
+ */
1677
+ maskStrategies?: ReadonlyArray<AdvisorMaskStrategy>;
1678
+ /**
1679
+ * Whole-row `ctx.db.replace(id, document)` writes lifted from custom
1680
+ * mutators' authoritative `server` impls (the `mutator_full_row_replace`
1681
+ * input). Each `replace` overwrites the entire row, clobbering a concurrent
1682
+ * edit to a different column on a synced table. Supplied by the codegen
1683
+ * feeder; absent for runtime callers, where the lint finds nothing.
1684
+ */
1685
+ mutatorWrites?: ReadonlyArray<AdvisorMutatorWrite>;
1686
+ /**
663
1687
  * Non-deterministic API calls (`Date.now`, `Math.random`,
664
1688
  * `crypto.randomUUID`, `crypto.getRandomValues`, `fetch`) discovered lexically
665
1689
  * inside `query`/`mutation` handler bodies — the `nondeterministic_query_mutation`
@@ -669,6 +1693,48 @@ interface LintContext {
669
1693
  */
670
1694
  nondeterministicCalls?: ReadonlyArray<AdvisorNondeterministicCall>;
671
1695
  /**
1696
+ * `query`/`mutation` handlers that gate a `ctx.db.get`/`patch`/`delete` on a
1697
+ * null-checked `ctx.db.normalizeId(table, id)` result — the
1698
+ * `normalize_id_used_as_authorization` input. `normalizeId` validates an id's
1699
+ * structural shape only (it never reads the database), so gating access on a
1700
+ * non-null result is an IDOR. The lint keeps only public procedures with no
1701
+ * `.use(rls(...))` and no ownership/identity mention, then joins `table` against
1702
+ * the schema's RLS mode before flagging. Supplied by the codegen feeder; absent
1703
+ * for runtime callers, where the lint finds nothing.
1704
+ */
1705
+ normalizeIdAuthorizations?: ReadonlyArray<AdvisorNormalizeIdAuthorization>;
1706
+ /**
1707
+ * `ctx.db` writes (`insert` / `replace` / `patch` / `insertManyUnsafe`) that set
1708
+ * an ownership / identity column (`userId`, `ownerId`, `tenantId`, …) from the
1709
+ * handler's `args` instead of the server-trusted identity — the
1710
+ * `owner_field_from_args_not_auth` input. The ownership column decides who a row
1711
+ * belongs to, so an arg-derived value lets any caller write rows owned by another
1712
+ * user or tenant (act-as-any-user / cross-tenant IDOR). A column stamped from
1713
+ * `ctx.*`, or a fixed literal, is not recorded. Supplied by the codegen feeder;
1714
+ * absent for runtime callers, where the lint finds nothing.
1715
+ */
1716
+ ownerFieldWrites?: ReadonlyArray<AdvisorOwnerFieldWrite>;
1717
+ /**
1718
+ * Payment webhook-adapter constructions (`createStripeAdapter` /
1719
+ * `createPolarAdapter`) — the payment-webhook wide-tolerance lint's input. Each row's
1720
+ * `toleranceSeconds` is the statically-known `webhookToleranceSeconds` replay
1721
+ * window (default 300s); the lint fires only above a conservative ceiling, where
1722
+ * the endpoint would accept stale, replayable signed payloads. Supplied by the
1723
+ * codegen feeder; absent for runtime callers, where the lint finds nothing.
1724
+ */
1725
+ paymentWebhooks?: ReadonlyArray<AdvisorPaymentWebhook>;
1726
+ /**
1727
+ * Payload-derived privileged dispatches — the `privileged_dispatch_unvalidated_payload`
1728
+ * input. Each is a `ctx.run`/`context.run` back into a Lunora function from inside a
1729
+ * `defineQueue` push handler or a `defineWorkflow` handler, whose args reference the
1730
+ * handler's untrusted payload (`context.params` for a workflow, a `for (… of
1731
+ * batch.messages)` body for a queue). Both handler kinds run under the system identity
1732
+ * (RLS disabled), so the lint joins the resolved target against `rlsProcedures` and
1733
+ * fires only when the target enforces a row policy. Supplied by the codegen feeder;
1734
+ * absent for runtime callers, where the lint finds nothing.
1735
+ */
1736
+ privilegedDispatches?: ReadonlyArray<AdvisorPrivilegedDispatch>;
1737
+ /**
672
1738
  * Per-procedure protective-middleware snapshots — the
673
1739
  * `public_mutation_without_ratelimit` and `user_creating_mutation_without_captcha`
674
1740
  * input. Records which `.use(...)` guards (`rateLimit`, captcha, `rls`, `mask`,
@@ -684,6 +1750,13 @@ interface LintContext {
684
1750
  */
685
1751
  queries?: ReadonlyArray<AdvisorQueryRead>;
686
1752
  /**
1753
+ * Queues declared via `defineQueue` exports in `lunora/queues.ts` — the
1754
+ * declaration-side input for the `queue_*` lints (`queue_without_dlq`).
1755
+ * Supplied by the codegen feeder; absent for runtime callers, where the
1756
+ * queue lints find nothing.
1757
+ */
1758
+ queues?: ReadonlyArray<AdvisorQueue>;
1759
+ /**
687
1760
  * R2 SQL `ctx.r2sql` accesses discovered lexically inside `query`/`mutation`
688
1761
  * handler bodies — the `r2sql_outside_action` input. Supplied by the codegen
689
1762
  * feeder, which omits `action` handlers (where `ctx.r2sql` is the typed,
@@ -691,6 +1764,36 @@ interface LintContext {
691
1764
  */
692
1765
  r2sqlCalls?: ReadonlyArray<AdvisorR2sqlCall>;
693
1766
  /**
1767
+ * `rateLimit`/`dbRateLimit` middleware calls (`@lunora/ratelimit`) whose
1768
+ * `key` selector is derived from the handler's `args` with no server-side
1769
+ * scoping — the `ratelimit_key_spoofable_or_global` input. A key an
1770
+ * attacker controls lets them rotate it per request and bypass the limit
1771
+ * entirely, defeating its purpose. A selector scoped by `ctx` (e.g.
1772
+ * `ctx.auth.userId`, `ctx.ip`), or one with no `args` reference at all (a
1773
+ * fixed/global bucket), is not recorded. Supplied by the codegen feeder;
1774
+ * absent for runtime callers, where the lint finds nothing.
1775
+ */
1776
+ ratelimitKeySelectors?: ReadonlyArray<AdvisorRatelimitKeySelector>;
1777
+ /**
1778
+ * `query` handlers that `return` the raw rows of a table (a `ctx.db` row read
1779
+ * or `ctx.db.query(...)` fluent chain, returned directly or through one local
1780
+ * `const` hop, with no hand-built projection) — the
1781
+ * `output_projection_missing_on_public_read` input. The lint keeps only public
1782
+ * queries with no `.output(...)`/mask on the chain, then joins `table` against
1783
+ * the schema's PII-named columns before nudging. Supplied by the codegen
1784
+ * feeder; absent for runtime callers, where the lint finds nothing.
1785
+ */
1786
+ rawRowReturns?: ReadonlyArray<AdvisorRawRowReturn>;
1787
+ /**
1788
+ * `ctx.db.&lt;table>.findMany({ with: { &lt;rel> } })` relation-hydrating list reads
1789
+ * — the `masked_relation_leak_via_with` input. Column masking is applied to a
1790
+ * read's top-level rows but does not descend into `with`-hydrated relations,
1791
+ * so a masked table surfaced only through a `with` on an unprotected public
1792
+ * read is returned in the clear. Supplied by the codegen feeder; absent for
1793
+ * runtime callers, where the lint finds nothing.
1794
+ */
1795
+ relationLoads?: ReadonlyArray<AdvisorRelationLoad>;
1796
+ /**
694
1797
  * Per-procedure RLS usage discovered in function bodies (the
695
1798
  * `rls_uncovered_table` input). Carries whether each procedure's builder chain
696
1799
  * includes `.use(rls(...))`, which tables the procedure reads/writes, and which
@@ -708,6 +1811,14 @@ interface LintContext {
708
1811
  */
709
1812
  secretLiterals?: ReadonlyArray<AdvisorSecretLiteral>;
710
1813
  /**
1814
+ * Replication shapes declared via `defineShape` in `lunora/shapes.ts` — the
1815
+ * `shape_unknown_table` and `shape_targets_global_table` lint input. Each
1816
+ * carries the export name and its static `table` literal, cross-referenced
1817
+ * against {@link LintContext.schema}. Supplied by the codegen feeder; absent
1818
+ * for runtime callers, where the shape lints find nothing.
1819
+ */
1820
+ shapes?: ReadonlyArray<AdvisorShape>;
1821
+ /**
711
1822
  * Per-shard observed traffic — the `hot_shard` lint input. Supplied by the
712
1823
  * studio backend, which fans out over a sharded function's shards and reads
713
1824
  * each shard's recorded request volume from the durable `__lunora_metrics`
@@ -715,6 +1826,15 @@ interface LintContext {
715
1826
  */
716
1827
  shardTraffic?: ReadonlyArray<AdvisorShardTraffic>;
717
1828
  /**
1829
+ * `ctx.db.&lt;table>.findMany({ includeDeleted })` list reads whose
1830
+ * `includeDeleted` is a hardcoded `true` or derived from the handler's
1831
+ * `args` — the `soft_delete_include_deleted_from_args` input. On a public
1832
+ * read of a `.softDelete()` table this resurfaces soft-deleted rows to any
1833
+ * caller (arg-derived) or every caller (hardcoded). Supplied by the codegen
1834
+ * feeder; absent for runtime callers, where the lint finds nothing.
1835
+ */
1836
+ softDeleteReads?: ReadonlyArray<AdvisorSoftDeleteRead>;
1837
+ /**
718
1838
  * `ctx.sql` tagged-template interpolations that splice an unparameterized
719
1839
  * string-building expression into the query — the `sql_injection_risk` input.
720
1840
  * Supplied by the codegen feeder; absent for runtime callers, where the lint
@@ -722,6 +1842,29 @@ interface LintContext {
722
1842
  */
723
1843
  sqlInterpolations?: ReadonlyArray<AdvisorSqlInterpolation>;
724
1844
  /**
1845
+ * `ctx.storage.&lt;bucket>.&lt;method>(key, …)` calls whose R2 object key is derived
1846
+ * from the handler's `args` with no server-side scoping — the
1847
+ * `storage_key_from_user_args` input. The bucket read/write/URL/delete methods
1848
+ * key by their first argument, so an arg-derived key is object-level IDOR
1849
+ * (read/overwrite/delete anyone's object). A key referencing a server-trusted
1850
+ * `ctx.*` value (e.g. `${ctx.auth.userId}/…`) is treated as scoped and not
1851
+ * recorded. Supplied by the codegen feeder; absent for runtime callers, where
1852
+ * the lint finds nothing.
1853
+ */
1854
+ storageKeyAccesses?: ReadonlyArray<AdvisorStorageKeyAccess>;
1855
+ /**
1856
+ * Tracked `ctx.storage.&lt;bucket>.&lt;method>(...)` upload/signing calls — the
1857
+ * shared input for the storage config-hygiene lints
1858
+ * (`storage_upload_without_content_type_allowlist`, `storage_upload_without_max_size`,
1859
+ * `storage_generate_upload_url_no_content_type_pin`,
1860
+ * `storage_presigned_url_for_private_content`). Each row carries the method
1861
+ * invoked, which options-object keys were present, and (for the two URL
1862
+ * signers) a statically-known `expiresInSeconds` literal. Supplied by the
1863
+ * codegen feeder; absent for runtime callers, where these lints find
1864
+ * nothing.
1865
+ */
1866
+ storageUploads?: ReadonlyArray<AdvisorStorageUpload>;
1867
+ /**
725
1868
  * Bounded row samples per table — the `constraint_validator` lint input.
726
1869
  * Supplied by the studio backend, which reads up to the configured row cap
727
1870
  * from each table via `readTablePage` and assembles the existing-id set for
@@ -744,6 +1887,16 @@ interface LintContext {
744
1887
  */
745
1888
  tableScans?: ReadonlyArray<AdvisorTableScan>;
746
1889
  /**
1890
+ * `ctx.vectors.&lt;method>(index, { namespace, … })` calls whose `namespace` is
1891
+ * derived from the handler's `args` with no server-side scoping — the
1892
+ * `vectors_namespace_from_user_input` input. A Vectorize namespace partitions one
1893
+ * index into isolated sub-collections, so an arg-derived namespace lets any caller
1894
+ * read or poison another tenant's vectors. A namespace scoped by a server-trusted
1895
+ * `ctx.*` value, or a fixed literal, is not recorded. Supplied by the codegen
1896
+ * feeder; absent for runtime callers, where the lint finds nothing.
1897
+ */
1898
+ vectorNamespaceAccesses?: ReadonlyArray<AdvisorVectorNamespaceAccess>;
1899
+ /**
747
1900
  * `ctx.workflows.get("name")` call sites discovered in function bodies — the
748
1901
  * use-side input the `workflow_unused` and `workflow_unknown_target` lints
749
1902
  * cross-reference against {@link LintContext.workflows}. Supplied by the
@@ -758,6 +1911,13 @@ interface LintContext {
758
1911
  * nothing.
759
1912
  */
760
1913
  workflows?: ReadonlyArray<AdvisorWorkflow>;
1914
+ /**
1915
+ * Committed `wrangler.jsonc` `vars` entries holding plaintext secrets — the
1916
+ * input for the `plaintext_secret_in_wrangler_vars` lint. Supplied by
1917
+ * `@lunora/config` (which reads `wrangler.jsonc`) via the codegen pass-through;
1918
+ * absent for runtime callers, where the lint finds nothing.
1919
+ */
1920
+ wranglerVariables?: ReadonlyArray<AdvisorWranglerVariable>;
761
1921
  }
762
1922
  /**
763
1923
  * A single advisory rule. `run` is pure over its {@link LintContext} so lints are
@@ -786,9 +1946,9 @@ interface Lint {
786
1946
  title: string;
787
1947
  }
788
1948
  /**
789
- * Minimal structural view of the `@lunora/analytics` SQL client — just its
1949
+ * Minimal structural view of the `@lunora/bindings/analytics` SQL client — just its
790
1950
  * `query(sql)` method. Kept structural (not an `import type` from
791
- * `@lunora/analytics`) so the advisor needn't depend on the analytics package;
1951
+ * `@lunora/bindings/analytics`) so the advisor needn't depend on the analytics package;
792
1952
  * the real `AnalyticsSqlClient` satisfies it, as does a plain test double.
793
1953
  */
794
1954
  interface AnalyticsMetricsSource {
@@ -926,6 +2086,23 @@ declare const hotShard: Lint;
926
2086
  */
927
2087
  declare const indexUtilization: Lint;
928
2088
  /**
2089
+ * Flags an action's `ctx.fetch(url, …)` whose URL is derived from the handler's
2090
+ * `args` — a server-side request forgery (SSRF) vector.
2091
+ *
2092
+ * `ctx.fetch` is the action-only outbound-request escape hatch, and it applies no
2093
+ * host allowlist: whatever URL it is handed, it fetches. When that URL comes from
2094
+ * request input (`ctx.fetch(args.url)`, a template embedding `args.*`, or a URL
2095
+ * built one hop earlier from `args`), a caller can point the worker at the cloud
2096
+ * metadata endpoint (`169.254.169.254`) or an internal service and read the
2097
+ * response — classic SSRF. The fix is to validate the URL against an allowlist of
2098
+ * expected hosts before fetching, and to reject private / link-local targets.
2099
+ *
2100
+ * Runs only when the codegen feeder supplies fetch-taint evidence
2101
+ * (`context.argumentDerivedFetches`); a runtime caller flags nothing. One finding per
2102
+ * arg-derived `ctx.fetch` call.
2103
+ */
2104
+ declare const actionFetchSsrf: Lint;
2105
+ /**
929
2106
  * Flags an `httpRoute` on an admin/privileged-looking path whose handler shows no
930
2107
  * auth/admin guard.
931
2108
  *
@@ -942,6 +2119,91 @@ declare const indexUtilization: Lint;
942
2119
  */
943
2120
  declare const adminRouteWithoutGuard: Lint;
944
2121
  /**
2122
+ * Flags a `ctx.ai.run(model, …)` call whose model-id argument is derived from
2123
+ * the handler's `args` with no server-side scoping — arbitrary model
2124
+ * selection that bypasses the typed AI-SDK layer.
2125
+ *
2126
+ * `ctx.ai.run` is the raw Workers AI binding passthrough (void-style
2127
+ * `ai.run`), bypassing `ctx.ai.model(...)` plus the AI SDK functions
2128
+ * (`generateText`, `streamText`, …) entirely — no output cap, no schema. When
2129
+ * the model id comes straight from request input (`ctx.ai.run(args.model,
2130
+ * …)`, or one built one hop earlier from `args`), any caller can pick which
2131
+ * model runs, sidestepping whatever the typed path would have enforced. Only
2132
+ * the model argument (`arguments[0]`) is inspected; an arg-derived `inputs`
2133
+ * (`arguments[1]`) is normal, expected usage and is never flagged. A model
2134
+ * scoped by a server-trusted `ctx.*` value is treated as scoped and not
2135
+ * flagged.
2136
+ *
2137
+ * Runs only when the codegen feeder supplies raw-run evidence
2138
+ * (`context.aiRawRuns`); a runtime caller flags nothing. One finding per
2139
+ * arg-derived, unscoped `ctx.ai.run` call.
2140
+ */
2141
+ declare const aiRawRunEscapeHatch: Lint;
2142
+ /**
2143
+ * Flags a `generateText` / `streamText` call whose model input is user-derived
2144
+ * **and** whose model-callable `tools` reach a privileged side effect.
2145
+ *
2146
+ * The AI SDK lets the model call a `tool({ execute })` to take an action. When
2147
+ * that tool's `execute` performs a real side effect — a DB write, a function
2148
+ * dispatch (`ctx.run`), or an outbound send (fetch / mail / queue) — and the
2149
+ * model's prompt / messages carry user-supplied text, an injected instruction in
2150
+ * that text can steer the model into firing the side effect. The model becomes a
2151
+ * confused deputy: attacker-authored words drive privileged actions. This is the
2152
+ * canonical LLM prompt-injection-to-tool-call hazard.
2153
+ *
2154
+ * Runs only when the codegen feeder supplies generation evidence
2155
+ * (`context.aiToolSideEffects`); a runtime caller flags nothing. Fires only when
2156
+ * the model input is derived from the handler's `args` — a fully server-authored
2157
+ * prompt driving a side-effecting tool is not flagged. Deliberately narrow (an
2158
+ * inherently heuristic rule): one finding per matching call.
2159
+ */
2160
+ declare const aiToolSideEffectPromptInjection: Lint;
2161
+ /**
2162
+ * Flags a public procedure that runs an AI text/object generation
2163
+ * (`generateText` / `streamText` / `generateObject` / `streamObject`) with no
2164
+ * `maxOutputTokens` bound in its config.
2165
+ *
2166
+ * Each generation call bills against the account's Workers AI / provider budget
2167
+ * in proportion to the tokens produced. Left unbounded and reachable from a
2168
+ * `.public()` procedure, an anonymous caller can request arbitrarily long
2169
+ * completions in a loop — a denial-of-wallet vector — and can also tie up worker
2170
+ * CPU/time on long streams. The fix is to cap output with `maxOutputTokens` (and
2171
+ * ideally rate-limit the entry point).
2172
+ *
2173
+ * Only a call whose config is a visible object literal is judged; a hoisted or
2174
+ * spread config is statically opaque and left un-flagged (fail-open) to avoid a
2175
+ * false positive. Runs only when the codegen feeder supplies procedure-protection
2176
+ * evidence (`context.procedureProtections`); a runtime caller flags nothing.
2177
+ */
2178
+ declare const aiUnboundedGenerationPublic: Lint;
2179
+ /**
2180
+ * Flags an app that opts into `allowUnauthenticatedShardAccess: true` while its
2181
+ * schema has an RLS gap (no `.rls("required")`, or a `.public()` table).
2182
+ *
2183
+ * `allowUnauthenticatedShardAccess` (a `WorkerOptions` field consumed by
2184
+ * `createWorker(...)`) turns off the fail-closed default that denies a shard
2185
+ * lookup for a request with no verified identity. That is a deliberate, opt-in
2186
+ * posture switch — appropriate for a public/anonymous-first shard resolver — but
2187
+ * combined with a schema that never enforces `.rls("required")` (or that leaves
2188
+ * a table `.public()`, i.e. exempt from it), an unauthenticated caller can shard-hop
2189
+ * and read another tenant's rows with no row-security guard behind the door.
2190
+ *
2191
+ * **Evidence and coverage gap**: this reads `context.configCalls`, fed by the
2192
+ * codegen `discover-config-calls.ts` feeder's `.extend(fn)` callback-shape
2193
+ * support — it only sees the setting when a `lunora/`-local file calls the
2194
+ * generated `defineApp()...extend(() => ({ allowUnauthenticatedShardAccess:
2195
+ * true }))` escape hatch (the pattern the `nuxt` / `analog` templates use in
2196
+ * `lunora/server.ts`). An app that sets the same field via `@lunora/vite`'s
2197
+ * `LunoraPluginOptions` (`vite.config.ts`) or a hand-authored worker entry
2198
+ * outside `lunora/` (the `sveltekit` / `astro` / `react-router` /
2199
+ * `tanstack-start` template style) is invisible to this lint — a coverage gap,
2200
+ * not a false negative this lint claims to catch.
2201
+ *
2202
+ * Runs only when the codegen feeder supplies config-call evidence; a runtime
2203
+ * caller flags nothing. One finding per opted-in `.extend(...)` call site.
2204
+ */
2205
+ declare const allowUnauthenticatedShardAccessEnabled: Lint;
2206
+ /**
945
2207
  * Flags a `ctx.authApi.&lt;method>(...)` call whose argument object omits `headers`.
946
2208
  *
947
2209
  * `@lunora/auth`'s `withAuthPlugins` middleware attaches the full privileged
@@ -959,6 +2221,135 @@ declare const adminRouteWithoutGuard: Lint;
959
2221
  */
960
2222
  declare const authApiCallWithoutHeaders: Lint;
961
2223
  /**
2224
+ * Flags a `createAuth({...})` call whose `advanced.disableCSRFCheck` is
2225
+ * explicitly `true`.
2226
+ *
2227
+ * better-auth's CSRF check validates the request's origin against
2228
+ * `trustedOrigins` before applying a state-changing auth mutation (sign-in,
2229
+ * sign-up, session revocation, …). `disableCSRFCheck: true` turns that check
2230
+ * off outright, so a cross-site request riding the browser's ambient auth
2231
+ * cookie is processed the same as a same-origin one — the standard CSRF
2232
+ * exposure.
2233
+ *
2234
+ * Runs only when the codegen feeder supplies auth-config evidence
2235
+ * (`context.authConfigs`), and only for an analyzable config (a static,
2236
+ * spread-free object literal); an opaque config could set the key elsewhere
2237
+ * and is skipped rather than guessed at. One finding per matching `createAuth`
2238
+ * call.
2239
+ */
2240
+ declare const authCsrfCheckDisabled: Lint;
2241
+ /**
2242
+ * Flags a `createAuth({...})` call with `emailAndPassword.enabled: true` and no
2243
+ * `emailAndPassword.requireEmailVerification: true`.
2244
+ *
2245
+ * better-auth defaults `requireEmailVerification` off, so an email/password
2246
+ * account is usable — signed in, able to act — the moment it's created, before
2247
+ * the caller has proven ownership of the email address. That lets an attacker
2248
+ * sign up with a victim's email (or an address they don't control) and operate
2249
+ * the account immediately, and it weakens any downstream flow (password reset,
2250
+ * account recovery) that assumes a verified address.
2251
+ *
2252
+ * Runs only when the codegen feeder supplies auth-config evidence
2253
+ * (`context.authConfigs`), and only for an analyzable config (a static,
2254
+ * spread-free object literal); an opaque config could set the key elsewhere
2255
+ * and is skipped rather than guessed at. One finding per matching `createAuth`
2256
+ * call.
2257
+ */
2258
+ declare const authEmailVerificationDisabled: Lint;
2259
+ /**
2260
+ * Flags a `createAuth({...})` call whose `advanced.useSecureCookies` is
2261
+ * explicitly `false`.
2262
+ *
2263
+ * `@lunora/auth` defaults `useSecureCookies` ON unless the deployment's
2264
+ * `baseURL` is provably plain `http://` (a local dev origin) — see
2265
+ * `hardenAuthOptions` in `packages/auth/src/create-auth.ts`. An explicit
2266
+ * `useSecureCookies: false` overrides that secure-by-default posture, so the
2267
+ * session cookie ships without the `Secure` attribute even on an HTTPS
2268
+ * deployment — it is then sent over any plaintext connection an attacker can
2269
+ * coerce (mixed-content requests, a downgraded subdomain), exposing the
2270
+ * session.
2271
+ *
2272
+ * Runs only when the codegen feeder supplies auth-config evidence
2273
+ * (`context.authConfigs`), and only for an analyzable config (a static,
2274
+ * spread-free object literal); an opaque config could set the key elsewhere
2275
+ * and is skipped rather than guessed at. One finding per matching `createAuth`
2276
+ * call.
2277
+ */
2278
+ declare const authSecureCookiesDisabled: Lint;
2279
+ /**
2280
+ * Flags a `createAuth({...})` call whose `session.freshAge` is explicitly the
2281
+ * literal `0`.
2282
+ *
2283
+ * `freshAge` is the window better-auth treats a session as "recently
2284
+ * re-authenticated" for sensitive operations (changing the password, adding a
2285
+ * passkey, revoking other sessions, …) that gate on a fresh session rather than
2286
+ * merely a valid one. Setting it to `0` disables that recent-reauth check
2287
+ * entirely — every sensitive operation is treated as fresh regardless of how
2288
+ * old the session is, so a long-lived stolen session (or token) can perform
2289
+ * them without ever proving the caller still controls the credentials.
2290
+ *
2291
+ * Runs only when the codegen feeder supplies auth-config evidence
2292
+ * (`context.authConfigs`), and only for an analyzable config (a static,
2293
+ * spread-free object literal); an opaque config could set the key elsewhere
2294
+ * and is skipped rather than guessed at. One finding per matching `createAuth`
2295
+ * call.
2296
+ */
2297
+ declare const authSessionFreshageZero: Lint;
2298
+ /**
2299
+ * Flags a `createAuth({...})` call whose `trustedOrigins` array literal
2300
+ * contains a `"*"` entry.
2301
+ *
2302
+ * better-auth's `trustedOrigins` is the allowlist its CSRF/origin validation
2303
+ * checks every state-changing request against. A `"*"` entry disables that
2304
+ * check entirely — any origin is accepted, which is exactly the protection
2305
+ * Lunora leans on to keep cross-site requests from riding an authenticated
2306
+ * cookie.
2307
+ *
2308
+ * Runs only when the codegen feeder supplies auth-config evidence
2309
+ * (`context.authConfigs`), and only for an analyzable config (a static,
2310
+ * spread-free object literal); an opaque config could set `trustedOrigins`
2311
+ * elsewhere and is skipped rather than guessed at. One finding per matching
2312
+ * `createAuth` call.
2313
+ */
2314
+ declare const authTrustedOriginsWildcard: Lint;
2315
+ /**
2316
+ * Flags a `createBrowser({ allowPrivateTargets: true })`.
2317
+ *
2318
+ * `@lunora/browser` blocks navigation to private / internal / loopback addresses
2319
+ * by default — that guard is what stops a browser action from being turned into a
2320
+ * server-side request forgery (SSRF) tool that reaches cloud metadata endpoints
2321
+ * (`169.254.169.254`), internal services, or `localhost`. Setting
2322
+ * `allowPrivateTargets: true` disables it wholesale. Combined with a
2323
+ * request-supplied URL that is the classic SSRF-to-metadata exfiltration path.
2324
+ *
2325
+ * Runs only when the codegen feeder supplies config-call evidence
2326
+ * (`context.configCalls`); a runtime caller flags nothing. One finding per
2327
+ * opted-out browser.
2328
+ */
2329
+ declare const browserAllowPrivateTargets: Lint;
2330
+ /**
2331
+ * Flags a `ctx.browser.&lt;method>(url, …)` call whose navigation URL is derived
2332
+ * from the handler's `args` with no server-side scoping — and no hardened
2333
+ * `createBrowser` allowlist to contain it.
2334
+ *
2335
+ * `@lunora/browser` blocks navigation to private/internal/loopback addresses by
2336
+ * default, but that guard only stops SSRF to *internal* targets. A
2337
+ * request-supplied *public* URL still turns the headless browser into an
2338
+ * open-proxy / request-forgery tool: any caller can make the deployment fetch
2339
+ * an arbitrary third-party URL (SSRF to public cloud APIs that trust the egress
2340
+ * IP, data exfiltration through the fetched URL), and — without pinned DNS — a
2341
+ * public hostname can rebind to an internal address after the guard's check.
2342
+ * The containment is an `allowedHosts` allowlist on `createBrowser`, or a
2343
+ * pinned `resolveDns`. This lint therefore suppresses all findings when the
2344
+ * config-call evidence shows a `createBrowser` hardened with either key; only
2345
+ * an unhardened browser reaching an arg-derived URL is flagged.
2346
+ *
2347
+ * Runs only when the codegen feeder supplies browser URL-access evidence
2348
+ * (`context.browserUrlAccesses`); a runtime caller flags nothing. One finding
2349
+ * per arg-derived, unscoped `ctx.browser` navigation.
2350
+ */
2351
+ declare const browserUserUrlWithoutAllowlist: Lint;
2352
+ /**
962
2353
  * Detect FK cycles in the declared relation graph via a DFS.
963
2354
  *
964
2355
  * A "circular FK" exists when a chain of `one` relations forms a loop — for
@@ -986,6 +2377,26 @@ declare const authApiCallWithoutHeaders: Lint;
986
2377
  */
987
2378
  declare const circularFk: Lint;
988
2379
  /**
2380
+ * Flags a `ctx.containers.&lt;exportName>.get(name, …)` call whose instance key
2381
+ * is derived from the handler's `args` with no server-side scoping — a
2382
+ * cross-tenant container IDOR.
2383
+ *
2384
+ * A container definition's `.get(name)` accessor routes to one Durable
2385
+ * Object-backed container instance per `name` — one container per entity
2386
+ * (user, room, job…). When the key comes straight from request input
2387
+ * (`ctx.containers.app.get(args.id)`, a template embedding `args.*`, or a key
2388
+ * built one hop earlier from `args`), any caller can hand in another tenant's
2389
+ * key and reach that tenant's container instance. The fix is to derive the
2390
+ * key from a server-trusted identity (`` `${ctx.auth.userId}` ``) or a record
2391
+ * the caller owns — a key that references `ctx` is treated as scoped and is
2392
+ * not flagged. `.any()`/`.pool()` are not sinks (they take no key).
2393
+ *
2394
+ * Runs only when the codegen feeder supplies container key-access evidence
2395
+ * (`context.containerKeyAccesses`); a runtime caller flags nothing. One
2396
+ * finding per arg-derived, unscoped `ctx.containers.*.get` call.
2397
+ */
2398
+ declare const containerInstanceKeyFromUserInput: Lint;
2399
+ /**
989
2400
  * Flags a container declared on a large instance type. The big `standard-3` /
990
2401
  * `standard-4` sizes (and large custom shapes) are billed on their provisioned
991
2402
  * memory + disk for the whole time an instance runs, so an over-provisioned
@@ -1006,6 +2417,8 @@ declare const containerOversizedInstance: Lint;
1006
2417
  * alone.
1007
2418
  */
1008
2419
  declare const containerPublicInternet: Lint;
2420
+ declare const containerRuntimeEgressRelaxation: Lint;
2421
+ declare const containerStartEnableInternetOverride: Lint;
1009
2422
  /**
1010
2423
  * Lunora port of splinter's `0009_duplicate_index`.
1011
2424
  *
@@ -1031,6 +2444,40 @@ declare const duplicateIndex: Lint;
1031
2444
  */
1032
2445
  declare const emptyIndex: Lint;
1033
2446
  /**
2447
+ * Flags a table that is both `.source(...)` and `.global()`.
2448
+ *
2449
+ * The two are contradictory. `.global()` already places a table in an external
2450
+ * store (D1, or a Hyperdrive-fronted Postgres/MySQL) that Lunora owns the schema
2451
+ * for and reads through the global backend. `.source(...)` declares the table as
2452
+ * **materialized from** an external database into a shard DO's SQLite by the
2453
+ * ingest poll loop. A table cannot simultaneously live in the global tier and be
2454
+ * polled into per-shard SQLite — the ingest loop has no DO-local table to write,
2455
+ * and the global backend has no poll loop. This is a definite misconfiguration,
2456
+ * so it is an `ERROR`.
2457
+ *
2458
+ * **Evidence supply**: reads `table.externalSource` + `table.shardKind`. Skipped
2459
+ * unless both a sourced declaration and the `global` tier are present.
2460
+ */
2461
+ declare const externalSourceOnGlobal: Lint;
2462
+ /**
2463
+ * Flags a `.source(...)` + `.shardBy(...)` table that has no `tenantBy` mapper.
2464
+ *
2465
+ * Per-shard SQLite isolation only controls *where* materialized rows land — not
2466
+ * what* the ingest query pulls. A sourced + sharded table whose `tenantBy` is
2467
+ * absent runs the same unscoped membership query on every tenant's Durable
2468
+ * Object, so each agent replicates the **entire** multitenant table into its own
2469
+ * SQLite (and then to its clients via `defineShape`). That is a cross-tenant data
2470
+ * leak, not a performance nit — so it is an `ERROR` that fails the build.
2471
+ *
2472
+ * `tenantBy(shardKey)` is the boundary: it binds this DO's shard key into the
2473
+ * query's parameters so the tenant can only ever pull its own rows.
2474
+ *
2475
+ * **Evidence supply**: reads `table.externalSource` (the codegen feeder captures
2476
+ * it from `.source({...})`; the runtime feeder derives it). A table without a
2477
+ * sourced declaration, or one not sharded, is skipped.
2478
+ */
2479
+ declare const externalSourceUnscoped: Lint;
2480
+ /**
1034
2481
  * Flags a query read that calls `.filter()` without first narrowing with
1035
2482
  * `.withIndex()` / `.withSearchIndex()`. Such a read loads *every* row of the
1036
2483
  * table and applies the predicate in memory — a full table scan that degrades
@@ -1044,6 +2491,25 @@ declare const emptyIndex: Lint;
1044
2491
  */
1045
2492
  declare const filterWithoutIndex: Lint;
1046
2493
  /**
2494
+ * Flags a `ctx.flags.boolean(key, default)` read on a security-shaped key whose
2495
+ * fail-open default selects the *permissive* branch.
2496
+ *
2497
+ * OpenFeature returns the caller-supplied default when the provider errors, so a
2498
+ * flag read is a security decision that fails to its default. When the key names
2499
+ * a protection (`enforce*`/`rls*`/`gate*`/`lockdown*`) and defaults `false`, or
2500
+ * names a permission/bypass (`allow*`/`permit*`/`bypass*`) and defaults `true`,
2501
+ * a flag-backend outage silently disables the protection or grants the
2502
+ * permission for every request.
2503
+ *
2504
+ * Runs only when the codegen feeder supplies flag-default evidence
2505
+ * (`context.flagSecurityDefaults`); a runtime caller flags nothing. Deliberately
2506
+ * narrow — matched on security-shaped key tokens with an unambiguous polarity
2507
+ * plus a boolean-literal default; keys whose polarity is indeterminate (a bare
2508
+ * `auth`/`admin`) or contradictory are skipped to keep the false-positive rate
2509
+ * low. One finding per read.
2510
+ */
2511
+ declare const flagGatesSecurityWithUnsafeDefault: Lint;
2512
+ /**
1047
2513
  * Flags a secret-shaped string literal checked into the lunora source.
1048
2514
  *
1049
2515
  * A live API key, access key, private key, or high-entropy token committed to the
@@ -1059,6 +2525,50 @@ declare const filterWithoutIndex: Lint;
1059
2525
  */
1060
2526
  declare const hardcodedSecret: Lint;
1061
2527
  /**
2528
+ * Flags an `httpAction`/`httpRoute` handler that performs a side effect
2529
+ * (`ctx.runMutation` / `ctx.runAction` / a `ctx.db` write) but never reads
2530
+ * `ctx.auth`.
2531
+ *
2532
+ * Unlike `query`/`mutation`/`action` procedures — which run under a resolved
2533
+ * identity and RLS — a raw HTTP handler is reached directly from the public
2534
+ * internet with no framework-supplied auth step. `HttpActionCtx` still exposes
2535
+ * `ctx.auth` (`getIdentity()` / `userId`), but nothing forces the handler to
2536
+ * consult it. A handler that mutates state or dispatches an action without ever
2537
+ * touching `ctx.auth` is an unauthenticated write endpoint: any anonymous caller
2538
+ * can drive the side effect, and the downstream `runMutation`/`runAction`/`db`
2539
+ * write runs with whatever ambient authority the handler carries — bypassing the
2540
+ * identity/RLS checks the rest of the app relies on. Distinct from
2541
+ * `admin_route_without_guard`, which covers Studio/admin-path routes.
2542
+ *
2543
+ * Runs only when the codegen feeder supplies HTTP-handler evidence
2544
+ * (`context.httpActionGuards`); a runtime caller flags nothing. The feeder only
2545
+ * records handlers that already perform a side effect and whose `ctx` binding was
2546
+ * statically resolvable (a named-function or wrapped handler is skipped,
2547
+ * fail-safe), so this lint just filters to those that never read `ctx.auth`. One
2548
+ * finding per handler.
2549
+ */
2550
+ declare const httpActionMissingAuthGuard: Lint;
2551
+ /**
2552
+ * Flags an `httpAction` handler that writes a response-header value derived from
2553
+ * raw request input (`request.headers`, `request.url`/query, `await
2554
+ * request.json()`) with no CR/LF sanitizer.
2555
+ *
2556
+ * A `Request`-derived string placed verbatim into a response header lets a caller
2557
+ * smuggle carriage-return/line-feed sequences (`\r\n`) into the response — injecting
2558
+ * additional headers (`Set-Cookie`, `Location`, CORS) or splitting the response body
2559
+ * (HTTP response splitting / header injection). Unlike `query`/`mutation` handlers,
2560
+ * a raw `httpAction` builds its own `Response`, so nothing forces the value through
2561
+ * the framework's `isSafeHeaderValue` CR/LF guard.
2562
+ *
2563
+ * Runs only when the codegen feeder supplies header-write evidence
2564
+ * (`context.httpHeaderWrites`); a runtime caller flags nothing. The feeder records
2565
+ * a site only when its value is request-tainted AND unguarded — a value routed
2566
+ * through `isSafeHeaderValue`, `encodeURIComponent`/`encodeURI`, a numeric coercion
2567
+ * (`Number`/`parseInt`/`parseFloat`), or `btoa` is treated as safe and never
2568
+ * recorded. One finding per unsafe header write.
2569
+ */
2570
+ declare const httpActionResponseHeaderInjection: Lint;
2571
+ /**
1062
2572
  * Flags a Hyperdrive `ctx.sql` access inside a `query(...)` or `mutation(...)`
1063
2573
  * handler body.
1064
2574
  *
@@ -1083,6 +2593,42 @@ declare const hardcodedSecret: Lint;
1083
2593
  */
1084
2594
  declare const hyperdriveOutsideAction: Lint;
1085
2595
  /**
2596
+ * Flags an authorization read of an identity claim that is **not** in the app's
2597
+ * declared `defineIdentity({ ... })` contract.
2598
+ *
2599
+ * `defineIdentity` is the trust boundary for `ctx.auth.identity`: the worker
2600
+ * validates a resolver's returned claims against the *declared* validators, but
2601
+ * — by design — forwards any **undeclared** claims through verbatim, unchecked.
2602
+ * So a policy predicate or authorize hook that reads `auth.identity.&lt;key>` for a
2603
+ * `&lt;key>` the contract never declares is trusting a value the runtime never
2604
+ * validated — a claim an attacker's token can carry with an arbitrary value.
2605
+ * Reading `userId` (always declared) or any declared claim is fine.
2606
+ *
2607
+ * Runs only when the codegen feeder supplies claim-read evidence
2608
+ * (`context.identityClaimReads`) — which it does only when a resolvable
2609
+ * `defineIdentity` contract exists — so an app with no typed identity contract,
2610
+ * or a runtime caller, flags nothing. One finding per undeclared read.
2611
+ */
2612
+ declare const identityUndeclaredClaimTrusted: Lint;
2613
+ /**
2614
+ * Flags a `buildImageDeliveryUrl({ key, … })` call (`@lunora/bindings/images`)
2615
+ * whose `key` is derived from the handler's `args` with no server-side scoping.
2616
+ *
2617
+ * `key` is the CDN transform's source image — an absolute URL, or an
2618
+ * origin-relative key under the account's own store — that `buildImageDeliveryUrl`
2619
+ * splices into the `/cdn-cgi/image/…` delivery URL. `ctx.images.transform`/`info`
2620
+ * take image *bytes*, never a URL, so they carry no equivalent risk and are not
2621
+ * flagged. An arg-derived `key` lets any caller point the CDN's on-the-fly
2622
+ * transform at an attacker-chosen origin (SSRF / open proxy against whatever
2623
+ * that origin trusts the CDN's egress IP for) or at an arbitrary key under the
2624
+ * account's own store.
2625
+ *
2626
+ * Runs only when the codegen feeder supplies image-delivery-URL evidence
2627
+ * (`context.imageDeliveryUrlAccesses`); a runtime caller flags nothing. One
2628
+ * finding per arg-derived, unscoped `key`.
2629
+ */
2630
+ declare const imagesUrlSourceFromUserInput: Lint;
2631
+ /**
1086
2632
  * A correctness lint with no splinter analogue — it exploits Lunora's static
1087
2633
  * edge: the schema is fully declared, so a typo'd index column is catchable at
1088
2634
  * codegen time rather than surfacing as a runtime error or a silently
@@ -1095,6 +2641,77 @@ declare const hyperdriveOutsideAction: Lint;
1095
2641
  */
1096
2642
  declare const indexReferencesUnknownField: Lint;
1097
2643
  /**
2644
+ * Flags a public procedure whose handler calls `ctx.db.insertManyUnsafe(...)`.
2645
+ *
2646
+ * `insertManyUnsafe` is the bulk-insert escape hatch: it writes rows straight to
2647
+ * storage, bypassing the per-row argument validators AND the schema's insert
2648
+ * triggers (which is where server-trusted columns, ownership stamping, and RLS
2649
+ * write checks live). That is acceptable for a seed script or an internal import
2650
+ * fed server-trusted rows — but on a `.public()` procedure the rows are shaped
2651
+ * from request input, so the bypass lets a caller write columns they should never
2652
+ * control and skip every trigger-enforced invariant. The fix is to use the
2653
+ * validated `ctx.db.insert(...)` path, or keep the unsafe bulk write in an
2654
+ * internal function fed only server-built rows.
2655
+ *
2656
+ * Runs only when the codegen feeder supplies procedure-protection evidence
2657
+ * (`context.procedureProtections`); a runtime caller flags nothing. One finding
2658
+ * per public procedure using the unsafe bulk insert.
2659
+ */
2660
+ declare const insertManyUnsafeUserData: Lint;
2661
+ /**
2662
+ * Flags a `ctx.kv` read/write whose namespace key is derived from the handler's
2663
+ * `args` with no server-side scoping — a namespace-level insecure direct object
2664
+ * reference (IDOR).
2665
+ *
2666
+ * Workers KV is a single flat namespace with no per-caller isolation. When a key
2667
+ * comes straight from request input (`ctx.kv.get(args.key)`, a template embedding
2668
+ * `args.*`, or a key built one hop earlier from `args`), any caller can hand in
2669
+ * another user's key and read, overwrite, or delete that user's entry. The fix is
2670
+ * to prefix every key with a server-trusted identity (`` `${ctx.auth.userId}:…` ``)
2671
+ * so a caller can only ever address their own entries — a key that references
2672
+ * `ctx` is treated as scoped and is not flagged. `list` is not a sink (it takes a
2673
+ * prefix, not a per-entry key).
2674
+ *
2675
+ * Runs only when the codegen feeder supplies KV key-access evidence
2676
+ * (`context.kvKeyAccesses`); a runtime caller flags nothing. One finding per
2677
+ * arg-derived, unscoped `ctx.kv` call.
2678
+ */
2679
+ declare const kvUnscopedUserKeyIdor: Lint;
2680
+ /**
2681
+ * Flags a `createInboundEmailHandler({...})` built without a `verify` hook.
2682
+ *
2683
+ * An inbound email handler receives mail from the public internet, where the
2684
+ * `from` address is trivially spoofable and the DKIM/SPF/DMARC verdicts are only
2685
+ * meaningful if the handler actually checks them. The `verify` hook is where that
2686
+ * check belongs. Omit it and the handler trusts every message it receives — and
2687
+ * when the handler dispatches into a Lunora function (which runs under the admin
2688
+ * bearer, with RLS disabled), a forged sender can drive privileged writes: a
2689
+ * confused-deputy escalation reachable by anyone who can send an email.
2690
+ *
2691
+ * Runs only when the codegen feeder supplies config-call evidence
2692
+ * (`context.configCalls`); a runtime caller flags nothing. Skips calls whose
2693
+ * config wasn't a static object literal. One finding per unverified handler.
2694
+ */
2695
+ declare const mailInboundDispatchWithoutVerify: Lint;
2696
+ /**
2697
+ * Flags a `ctx.mail`/`ctx.email` `send`/`queue` call whose recipient field
2698
+ * (to/cc/bcc) is derived from the handler's `args` with no server-side
2699
+ * scoping.
2700
+ *
2701
+ * A recipient derived straight from request input turns the deployment into
2702
+ * an open relay / spam amplifier — any caller can direct mail to an arbitrary
2703
+ * address just by supplying it as an argument. The fix is to derive
2704
+ * recipients from server-trusted state (e.g. the authenticated user's own
2705
+ * record via `ctx.auth`), never straight from `args`; if user-chosen
2706
+ * recipients are a genuine product requirement, gate the path behind
2707
+ * authentication and rate limiting rather than leaving it open to any caller.
2708
+ *
2709
+ * Runs only when the codegen feeder supplies mail recipient-access evidence
2710
+ * (`context.mailRecipientAccesses`); a runtime caller flags nothing. One
2711
+ * finding per offending `ctx.mail`/`ctx.email` call — not per recipient field.
2712
+ */
2713
+ declare const mailRecipientFromRequestInput: Lint;
2714
+ /**
1098
2715
  * Flags a public procedure that reads a table for which at least one other
1099
2716
  * procedure declares a column mask (evidence the developer decided that table
1100
2717
  * carries sensitive columns), but whose own builder chain does NOT include
@@ -1133,6 +2750,69 @@ declare const indexReferencesUnknownField: Lint;
1133
2750
  */
1134
2751
  declare const maskUncoveredPiiColumn: Lint;
1135
2752
  /**
2753
+ * Flags a `mask(policies)` column whose strategy is the literal `"hash"` and
2754
+ * whose column name matches a PII heuristic (`email`, `ssn`, `phone`, …).
2755
+ *
2756
+ * Lunora's `"hash"` mask strategy is an unsalted 32-bit FNV-1a digest — a
2757
+ * stable pseudonym for grouping/joining, deliberately **not** a confidentiality
2758
+ * control. Its narrow (~2^32) output space makes it brute-force-recoverable by
2759
+ * the very caller it is meant to mask from, and identical inputs always
2760
+ * produce identical tokens, so it also leaks cross-row/cross-tenant equality.
2761
+ * Applying it to a PII column reads as protection but isn't; `"redact"` (drop
2762
+ * to `null`) is the strategy that actually hides the value.
2763
+ *
2764
+ * Runs only when the codegen feeder supplies strategy evidence
2765
+ * (`context.maskStrategies`); a runtime caller with no evidence flags nothing.
2766
+ * A `MaskFn` (custom, non-literal) strategy carries no static signal and is
2767
+ * never recorded by the feeder, so it never reaches this lint either.
2768
+ */
2769
+ declare const maskWeakHashStrategyOnPii: Lint;
2770
+ /**
2771
+ * Flags a public read that hydrates a masked table's rows in the clear through a
2772
+ * `with` relation.
2773
+ *
2774
+ * Column masking (`.use(mask(...))`) is applied per-procedure to the *top-level*
2775
+ * rows of the table named in a read. It does **not** descend into relations
2776
+ * hydrated via `with` — `ctx.db.posts.findMany({ with: { author: true } })`
2777
+ * returns each `author` fully unmasked even when the `users` table is masked
2778
+ * elsewhere. So a table whose columns you carefully mask on its own reads is
2779
+ * still served in the clear whenever an unprotected parent read pulls it in as a
2780
+ * relation.
2781
+ *
2782
+ * INFO, near-zero false positives by construction: it fires only when all of
2783
+ * (1) the enclosing read is public, (2) the read declares `with: { &lt;rel> }`,
2784
+ * (3) `&lt;rel>` resolves through the schema to a real target table, and (4) that
2785
+ * target table actually has masked columns (per the discovered mask evidence).
2786
+ * Absent any mask usage the lint is a no-op. Runs only when the codegen feeder
2787
+ * supplies `context.relationLoads`; a runtime caller flags nothing. One finding
2788
+ * per `(read, masked relation)` pair.
2789
+ */
2790
+ declare const maskedRelationLeakViaWith: Lint;
2791
+ /**
2792
+ * Flags a custom mutator whose authoritative `server` impl writes a row with
2793
+ * `ctx.db.replace(id, document)` — a whole-document overwrite.
2794
+ *
2795
+ * The local-first sync engine serializes mutators in the shard DO, so two
2796
+ * mutators that touch the *same row* but *different columns* both run to
2797
+ * completion — but only if each writes its own column. A `replace` overwrites
2798
+ * the entire row from the document the mutator assembled, so a concurrent edit
2799
+ * to another column (committed between this mutator's read and its write, or
2800
+ * carried as a pending optimistic overlay on a client) is silently clobbered:
2801
+ * the kind of "two offline edits to different fields fight each other" data loss
2802
+ * a column-level merge avoids. `ctx.db.patch(id, { onlyTheChangedField })`
2803
+ * merges at the column level instead, so independent field edits coexist.
2804
+ *
2805
+ * `WARN`, not `ERROR`: `replace` is legitimate when the mutator genuinely owns
2806
+ * the whole row (a full-form save, a state-machine transition that rewrites
2807
+ * every field). The lint just surfaces the column-clobber risk so a developer
2808
+ * reaches for `patch` by default on a synced table.
2809
+ *
2810
+ * **Evidence supply**: runs only when the codegen feeder supplies
2811
+ * `context.mutatorWrites` (each a `replace` call lifted from a mutator's inline
2812
+ * `server` body); absent for runtime callers, where the lint finds nothing.
2813
+ */
2814
+ declare const mutatorFullRowReplace: Lint;
2815
+ /**
1136
2816
  * Flags a non-deterministic API call inside a `query(...)` or `mutation(...)`
1137
2817
  * handler body.
1138
2818
  *
@@ -1153,6 +2833,132 @@ declare const maskUncoveredPiiColumn: Lint;
1153
2833
  */
1154
2834
  declare const nondeterministicQueryMutation: Lint;
1155
2835
  /**
2836
+ * Flags a public `query`/`mutation` whose handler gates a `ctx.db.get`/`patch`/`delete`
2837
+ * on a null-checked `ctx.db.normalizeId(table, id)` result, with no intervening
2838
+ * ownership predicate and no RLS coverage.
2839
+ *
2840
+ * `normalizeId` performs pure structural validation — it checks that a string is
2841
+ * shaped like a valid id for `table` and returns the branded id, but it **never reads
2842
+ * the database**. A non-null result therefore proves only that the id is well-formed,
2843
+ * never that the row exists or that the caller owns it. Treating "normalizeId returned
2844
+ * non-null" as authorization is an IDOR: any caller who supplies a syntactically valid
2845
+ * id of another user's row reaches it. This is an INFO-level nudge — the handler may be
2846
+ * intentionally public — it flags a place where the shape check is doing load-bearing
2847
+ * work it can't actually do.
2848
+ *
2849
+ * **Negative-proof gates** (bias toward silence — a false negative is cheaper than a
2850
+ * false positive that trains users to ignore the advisor): the feeder records a row
2851
+ * only when a null-gated normalized id reaches an id-first sink, and this lint
2852
+ * additionally requires (1) `visibility === "public"` (an internal procedure trusts
2853
+ * its server caller for authorization), (2) no `.use(rls(...))` on the builder chain,
2854
+ * (3) no ownership/identity mention anywhere in the handler (`mentionsOwnership` — any
2855
+ * `ctx.auth`/`ctx.identity` read or ownership-named identifier suppresses), and (4) the
2856
+ * table not covered by schema-required RLS. A handler that compares the loaded row's
2857
+ * `userId` to `ctx.auth.userId`, or a schema in `.rls("required")` mode, is never
2858
+ * flagged.
2859
+ *
2860
+ * Runs only when the codegen feeder supplies `context.normalizeIdAuthorizations`; a
2861
+ * runtime caller flags nothing.
2862
+ */
2863
+ declare const normalizeIdUsedAsAuthorization: Lint;
2864
+ /**
2865
+ * Nudges a `.public()` `query` whose handler returns raw table rows — with no
2866
+ * `.output(...)` projection and no `.use(mask(...))` — when that table carries
2867
+ * PII-named columns (`email`, `phone`, `ssn`, …).
2868
+ *
2869
+ * A public query is reachable by any client. Returning a table row verbatim ships
2870
+ * every column it holds — including PII the caller never needed — and silently
2871
+ * widens the exposed surface every time a column is added to the table later. An
2872
+ * explicit `.output(v.object({ … }))` projection (or a `.use(mask(...))` policy)
2873
+ * makes the exposed shape intentional and stops the next-added column from leaking
2874
+ * by default. This is an INFO-level nudge, not a defect: the query may be perfectly
2875
+ * fine — it flags a place worth a deliberate projection decision.
2876
+ *
2877
+ * **Low-FP gates**: the feeder records a row only when the handler returns the raw
2878
+ * read result itself (a hand-built object / array / `.map(...)` projection is not
2879
+ * recorded), and this lint additionally requires (1) `visibility === "public"`,
2880
+ * (2) no `.output(...)` and no `.use(mask(...))` on the builder chain, and (3) the
2881
+ * returned table to declare at least one PII-named column. A public query returning
2882
+ * a non-PII lookup table (`emojis`, `countries`) is never flagged.
2883
+ *
2884
+ * Runs only when the codegen feeder supplies `context.rawRowReturns`; a runtime
2885
+ * caller flags nothing.
2886
+ */
2887
+ declare const outputProjectionMissingOnPublicRead: Lint;
2888
+ /**
2889
+ * Flags a `ctx.db` write (`insert` / `replace` / `patch` / `insertManyUnsafe`)
2890
+ * that sets an ownership / identity column — `userId`, `ownerId`, `tenantId`, and
2891
+ * the like — from the handler's `args` instead of the server-trusted identity.
2892
+ *
2893
+ * The ownership column decides *who a row belongs to*. When its value comes from
2894
+ * request input (`ctx.db.insert("posts", { userId: args.userId })`), any caller
2895
+ * can claim to be anyone: pass a different `userId` / `tenantId` and the write
2896
+ * lands a row owned by another user or tenant — the classic act-as-any-user /
2897
+ * cross-tenant IDOR. The fix is to stamp the ownership column from `ctx.auth` /
2898
+ * `ctx.identity` on the server and never read it from `args`. A column set from
2899
+ * `ctx.*`, or to a fixed literal, is correct and not flagged.
2900
+ *
2901
+ * Runs only when the codegen feeder supplies owner-write evidence
2902
+ * (`context.ownerFieldWrites`); a runtime caller flags nothing. One finding per
2903
+ * offending identity-column write.
2904
+ */
2905
+ declare const ownerFieldFromArgsNotAuth: Lint;
2906
+ /**
2907
+ * Flags a `createPayment({...})` constructed without an `authorize` callback.
2908
+ *
2909
+ * The `authorize(referenceId)` hook is `@lunora/payment`'s access-control gate: it
2910
+ * runs before every charge/refund/subscription operation and decides whether the
2911
+ * current caller may act on that payment reference. Omit it and the guard is
2912
+ * effectively open — any caller who can reach a reference id (often a
2913
+ * client-supplied string) can drive money movement against someone else's
2914
+ * payment, a broken-access-control (IDOR) escalation on the most sensitive
2915
+ * surface an app has.
2916
+ *
2917
+ * The context accessor `ctx.payments` is authorization-scoped by default; this
2918
+ * lint targets the direct `createPayment(...)` factory, where the gate is
2919
+ * opt-in. Runs only when the codegen feeder supplies config-call evidence
2920
+ * (`context.configCalls`); a runtime caller flags nothing. Skips calls whose
2921
+ * config wasn't a static object literal (the key may be set on a config built
2922
+ * elsewhere). One finding per unguarded call.
2923
+ */
2924
+ declare const paymentCreateWithoutAuthorize: Lint;
2925
+ /**
2926
+ * Flags a payment webhook adapter (`createStripeAdapter` / `createPolarAdapter`)
2927
+ * configured with an implausibly wide `webhookToleranceSeconds` replay window.
2928
+ *
2929
+ * The adapters reject a webhook whose signed timestamp is more than
2930
+ * `webhookToleranceSeconds` from now, so a captured-then-replayed signed payload
2931
+ * is refused once it ages past the window. The default (300s) is the recommended
2932
+ * clock-skew allowance; widening it to hours or days keeps stale, replayable
2933
+ * signed events valid long after capture, defeating the timestamp check and
2934
+ * re-opening the replay window the signature scheme exists to close.
2935
+ *
2936
+ * Runs only when the codegen feeder supplies adapter evidence
2937
+ * (`context.paymentWebhooks`); a runtime caller flags nothing. Fires only on a
2938
+ * statically-known numeric `webhookToleranceSeconds` literal above the ceiling —
2939
+ * a computed or env-sourced value is not evaluated, to keep the false-positive
2940
+ * rate low. One finding per matching adapter.
2941
+ */
2942
+ declare const paymentWebhookWideTolerance: Lint;
2943
+ /**
2944
+ * Flags a plaintext secret committed to `wrangler.jsonc`'s `vars` block.
2945
+ *
2946
+ * `vars` are **plaintext environment variables**: Wrangler bakes them into the
2947
+ * deployed Worker's bundle in cleartext, and `wrangler.jsonc` is checked into
2948
+ * source control — so a real API key, access key, private key, or token placed
2949
+ * there leaks two ways at once (every reader of the repo and the deployed bundle)
2950
+ * and rotating it means editing tracked config plus a redeploy. Secrets belong in
2951
+ * a Secrets Store binding (`ctx.secrets.get(name)`) or `wrangler secret put`, never
2952
+ * `vars`. The evidence comes from `@lunora/config`, which reads `wrangler.jsonc`
2953
+ * and applies the same secret-shape heuristics as `hardcoded_secret`, plus a
2954
+ * secret-suggestive key-name rule (`*_KEY` / `*_SECRET` / `*_TOKEN` / `*_PASSWORD`
2955
+ * / `*_DSN`), while skipping placeholders and public/publishable keys.
2956
+ *
2957
+ * Runs only when the config feeder supplies wrangler-variable evidence
2958
+ * (`context.wranglerVariables`); a runtime caller flags nothing. One finding per var.
2959
+ */
2960
+ declare const plaintextSecretInWranglerVariables: Lint;
2961
+ /**
1156
2962
  * Flags an RLS policy whose `table` names a table that does not exist in the
1157
2963
  * schema.
1158
2964
  *
@@ -1176,6 +2982,50 @@ declare const nondeterministicQueryMutation: Lint;
1176
2982
  */
1177
2983
  declare const policyReferencesUnknownTable: Lint;
1178
2984
  /**
2985
+ * Flags a `ctx.run`/`context.run` back into a Lunora function from inside a
2986
+ * `defineQueue` push handler or a `defineWorkflow` handler, when the dispatch's
2987
+ * args reference the handler's untrusted payload (`context.params` for a
2988
+ * workflow, a `for (… of batch.messages)` body for a queue) **and** the target
2989
+ * enforces row-level security.
2990
+ *
2991
+ * A queue/workflow handler runs under the deployment's **system identity** with
2992
+ * end-user RLS disabled — that is by design, so the handler can touch any row.
2993
+ * But the payload it receives is attacker-influenced: a queue body is whatever
2994
+ * was enqueued (often straight from a public mutation's `args`), and a
2995
+ * workflow's `params` are set by the `.create({ params })` caller. Forwarding
2996
+ * that payload into a function whose own protection is a *row policy* is a
2997
+ * confused-deputy: the policy that would have rejected the caller's request is
2998
+ * skipped because the handler, not the user, is now the principal. Any field
2999
+ * the payload controls that the target's RLS keys on (owner id, tenant id, row
3000
+ * id) becomes an act-as-any-user / cross-tenant write.
3001
+ *
3002
+ * The lint is deliberately narrow to stay false-positive-free: it fires **only**
3003
+ * when the resolved target (`api.&lt;file>.&lt;export>`) is found in the
3004
+ * RLS-procedure evidence with `usesRls: true`. A dispatch into a function that
3005
+ * does its own arg validation and carries no row policy (the common, correct
3006
+ * case — e.g. a welcome-message mutation with no `rls`) is not flagged. Runs
3007
+ * only when the codegen feeder supplies dispatch evidence
3008
+ * (`context.privilegedDispatches`); a runtime caller flags nothing.
3009
+ */
3010
+ declare const privilegedDispatchUnvalidatedPayload: Lint;
3011
+ /**
3012
+ * Flags a public procedure whose handler fans work out to a privileged,
3013
+ * cost-bearing dispatch surface without a rate-limit guard.
3014
+ *
3015
+ * `ctx.scheduler.runAfter` / `runAt`, a `ctx.queues.&lt;name>` producer send, and
3016
+ * `ctx.workflows.&lt;name>.create` all enqueue work that runs later under the
3017
+ * system identity (RLS disabled) and bills against the account. Triggered from a
3018
+ * `.public()` procedure with no rate limit, an anonymous caller can drive that
3019
+ * dispatch in a loop — a cost-amplification / denial-of-wallet vector, and a way
3020
+ * to flood a privileged async surface. The fix is to gate the public entry point
3021
+ * with a rate limit (or make it internal and trigger it from a guarded path).
3022
+ *
3023
+ * Runs only when the codegen feeder supplies procedure-protection evidence
3024
+ * (`context.procedureProtections`); a runtime caller flags nothing. One finding
3025
+ * per unguarded public fan-out procedure.
3026
+ */
3027
+ declare const privilegedFanoutFromPublicProcedure: Lint;
3028
+ /**
1179
3029
  * Flags a `v.any()` argument on a public procedure.
1180
3030
  *
1181
3031
  * `v.any()` disables validation: the field accepts arbitrary, untyped,
@@ -1206,10 +3056,55 @@ declare const publicArgumentUsesAny: Lint;
1206
3056
  */
1207
3057
  declare const publicMutationWithoutRatelimit: Lint;
1208
3058
  /**
3059
+ * Flags a `.public()` table that carries ownership/tenancy- or PII-named
3060
+ * columns, on a schema that requires RLS (`.rls("required")`).
3061
+ *
3062
+ * `.public()`'s name is misleading: it does NOT mean "this table holds public
3063
+ * data" — it means the OPPOSITE of that from an enforcement standpoint. It opts
3064
+ * one table OUT of the schema-wide `.rls("required")` enforcement, so its
3065
+ * `ctx.db` write path is never denied for missing RLS coverage. A table named
3066
+ * `.public()` that also carries `userId` / `email` / `ssn`-shaped columns reads
3067
+ * as "safe to expose" but is actually "exempt from the row-security guard" —
3068
+ * exactly the confusion the method name invites.
3069
+ *
3070
+ * **Low-FP gate**: only flagged when (1) the schema opted into
3071
+ * `.rls("required")` at all (`.public()` is a documented no-op otherwise — see
3072
+ * {@link https://lunora.sh}'s `.public()` docs), and (2) the table's declared
3073
+ * columns match the ownership/PII heuristic ({@link ownershipOrPiiColumns}). A
3074
+ * genuinely public lookup table (e.g. `emojis`, `countries`) with no such
3075
+ * columns is not flagged.
3076
+ *
3077
+ * **Pure schema evidence**: reads only `context.schema` — both `isPublic` and
3078
+ * `rlsMode` are forwarded by the runtime `fromServerSchema` and the codegen
3079
+ * `toAdvisorSchema` paths, so this lint runs identically from a live shard and
3080
+ * from codegen, with no feeder required.
3081
+ */
3082
+ declare const publicTableRlsOptoutConfusion: Lint;
3083
+ /**
3084
+ * Flags a declared queue — push or pull — that has no dead-letter queue.
3085
+ *
3086
+ * A Cloudflare Queues consumer retries a failing message up to `maxRetries`
3087
+ * times (default 3 — roughly four total delivery attempts); once that budget is
3088
+ * exhausted, a message with no `deadLetterQueue` is **deleted permanently** with
3089
+ * no record an operator can inspect. Routing exhausted messages to a DLQ turns
3090
+ * silent data loss into a backlog you can inspect, alert on, and replay. Hence
3091
+ * `WARN`/`INTERNAL`: an operator-facing reliability nudge, not a hard error — a
3092
+ * genuinely fire-and-forget queue may accept the loss.
3093
+ *
3094
+ * A queue that is itself some other queue's `deadLetterQueue` target is skipped:
3095
+ * a DLQ is a terminal sink and requiring it to have its own DLQ would recurse
3096
+ * forever (and mis-flag the best-practice scaffold, which pairs a queue with a
3097
+ * dedicated DLQ consumer).
3098
+ *
3099
+ * Only runs when the declaration feeder supplied evidence (`context.queues`
3100
+ * present); a runtime caller flags nothing.
3101
+ */
3102
+ declare const queueWithoutDlq: Lint;
3103
+ /**
1209
3104
  * Flags an R2 SQL `ctx.r2sql` access inside a `query(...)` or `mutation(...)`
1210
3105
  * handler body.
1211
3106
  *
1212
- * R2 SQL (`@lunora/r2sql`) queries Apache Iceberg tables over an **external**
3107
+ * R2 SQL (`@lunora/bindings/r2sql`) queries Apache Iceberg tables over an **external**
1213
3108
  * REST endpoint Lunora does not own — there is no Workers binding, every query
1214
3109
  * is an HTTPS round-trip. A `ctx.r2sql` query is therefore non-deterministic
1215
3110
  * (exactly like `fetch`), which breaks the determinism the coordinator relies on
@@ -1231,6 +3126,62 @@ declare const publicMutationWithoutRatelimit: Lint;
1231
3126
  */
1232
3127
  declare const r2sqlOutsideAction: Lint;
1233
3128
  /**
3129
+ * Flags a `new RateLimiter({...})` constructed without an explicit `store`.
3130
+ *
3131
+ * The default store is per-instance in-memory. On Cloudflare Workers each request
3132
+ * can land on a different isolate, so an in-memory counter never sums across
3133
+ * them: the limiter silently under-counts and, under real traffic, is close to a
3134
+ * no-op. A rate limit that doesn't actually limit gives a false sense of
3135
+ * protection against brute-force, enumeration, and cost-abuse — exactly the
3136
+ * attacks it was added to stop. The fix is a shared, durable store (a Durable
3137
+ * Object or KV-backed one) so every isolate reads and writes the same bucket.
3138
+ *
3139
+ * Runs only when the codegen feeder supplies config-call evidence
3140
+ * (`context.configCalls`); a runtime caller flags nothing. Skips calls whose
3141
+ * config wasn't a static object literal. One finding per limiter.
3142
+ */
3143
+ declare const ratelimitDefaultMemoryStore: Lint;
3144
+ /**
3145
+ * Flags a `rateLimit`/`dbRateLimit` middleware call (`@lunora/ratelimit`) whose
3146
+ * `key` selector is derived from the handler's `args` with no server-side
3147
+ * scoping.
3148
+ *
3149
+ * The middleware's `key` is `(ctx) => string | undefined` — a sub-key that
3150
+ * isolates the limit per caller. When the selector reads straight from `args`
3151
+ * (an email, a client-supplied id, …) instead of a server-trusted identity
3152
+ * (`ctx.auth.userId`) or the server-trusted `ctx.ip`, an attacker can rotate the
3153
+ * key on every request and never share a bucket with themselves, defeating the
3154
+ * limit entirely. A selector with no `args` reference at all — a fixed/global
3155
+ * bucket, including simply omitting `key` — is a *different*, fuzzier problem
3156
+ * (one caller can still exhaust a shared global bucket for everyone) and is
3157
+ * deliberately **not** flagged here, to keep this lint's false-positive rate
3158
+ * low: a global bucket is a legitimate choice for some limits (e.g. a
3159
+ * deployment-wide cost cap), so its absence alone is not a reliable signal.
3160
+ *
3161
+ * Runs only when the codegen feeder supplies rate-limit key-selector evidence
3162
+ * (`context.ratelimitKeySelectors`); a runtime caller flags nothing. One finding
3163
+ * per arg-derived, unscoped selector.
3164
+ */
3165
+ declare const ratelimitKeySpoofableOrGlobal: Lint;
3166
+ /**
3167
+ * Flags a `rateLimit`/`dbRateLimit`/`verifyTurnstileMiddleware` guard configured
3168
+ * `failOpen: true` on an auth/payment-sensitive procedure.
3169
+ *
3170
+ * `@lunora/ratelimit`'s `rateLimit`/`dbRateLimit` and `@lunora/auth`'s
3171
+ * `verifyTurnstileMiddleware` fail **closed** by default — a store outage or a
3172
+ * failed Turnstile siteverify rejects the request (503). Passing `failOpen: true`
3173
+ * inverts that: the middleware swallows the failure and admits the request. On a
3174
+ * sign-in / account-creation / password-reset / OTP / payment endpoint that turns
3175
+ * a transient limiter outage into an unthrottled brute-force / abuse window.
3176
+ *
3177
+ * Runs only when the codegen feeder supplies fail-open-guard evidence
3178
+ * (`context.failOpenGuards`); a runtime caller flags nothing. Deliberately narrow
3179
+ * — fires only when the options literal provably set `failOpen: true` AND the
3180
+ * guarded procedure's export name or rate-limit `name` matches an auth/payment
3181
+ * token, keeping the false-positive rate low. One finding per guard.
3182
+ */
3183
+ declare const ratelimitMiddlewareFailOpen: Lint;
3184
+ /**
1234
3185
  * A correctness lint covering the columns a relation wires together: the FK
1235
3186
  * `field` and the `references` column must each exist on their respective
1236
3187
  * tables, or the join can never resolve. Caught here at codegen time rather
@@ -1285,6 +3236,70 @@ declare const relationReferencesUnknownTable: Lint;
1285
3236
  */
1286
3237
  declare const rlsUncoveredTable: Lint;
1287
3238
  /**
3239
+ * Flags a replication shape whose `table` is a `.global()` table.
3240
+ *
3241
+ * Poke-live replication is a per-shard-DO property: the shard owns its SQLite
3242
+ * and a monotonic `__cdc_log`, so a write produces an ordered op the DO pokes to
3243
+ * every subscriber at the next flush. A `.global()` table lives outside the
3244
+ * shard DO's SQLite op-log (in a global backend — D1, or Hyperdrive-fronted
3245
+ * Postgres/MySQL) — so a shape over a global table cannot be poke-live. It is
3246
+ * served through the cross-shard tier: **coordinator/poll-refreshed, latency-
3247
+ * tiered**, not live. That is a real and supported tier (it is the recommended
3248
+ * answer for cross-shard reads — denormalize, or move the joined table to
3249
+ * `.global()` and read through the global backend), but its freshness semantics
3250
+ * differ from a sharded shape's, so the boundary is surfaced rather than hidden.
3251
+ *
3252
+ * `WARN`, not `ERROR`: a global-table shape is a legitimate design once you
3253
+ * accept the poll-refresh latency; the lint just makes the tier explicit so a
3254
+ * developer does not assume poke-live freshness.
3255
+ *
3256
+ * **Evidence supply**: runs only when the codegen feeder supplies
3257
+ * `context.shapes`; the table's tier comes from the schema's `shardKind`. A
3258
+ * shape whose table is unknown (caught by `shape_unknown_table`) or whose tier
3259
+ * the feeder didn't supply is skipped.
3260
+ */
3261
+ declare const shapeTargetsGlobalTable: Lint;
3262
+ /**
3263
+ * Flags a replication shape whose `table` names a table that does not exist in
3264
+ * the schema.
3265
+ *
3266
+ * `defineShape({ table: "messages", … })` binds a shape to a table by a plain
3267
+ * string. A live `subscribeShape("…")` resolves that shape server-side and runs
3268
+ * its membership query against the named table — so a typo, a stale name after a
3269
+ * rename, or a copy-paste mistake produces a shape that can never resolve a
3270
+ * rowset: the subscription seeds empty and then errors at the first flush
3271
+ * (`no such table`). This is a definite, build-time-detectable break, so it is
3272
+ * an `ERROR` — surfaced before the broken shape ever ships.
3273
+ *
3274
+ * **Evidence supply**: runs only when the codegen feeder supplies
3275
+ * `context.shapes`. A shape whose `table` wasn't a static string literal (no
3276
+ * resolvable name) is skipped rather than guessed at, so the lint under-reports
3277
+ * rather than raising false alarms.
3278
+ */
3279
+ declare const shapeUnknownTable: Lint;
3280
+ /**
3281
+ * Flags a public read that resurfaces soft-deleted rows via `includeDeleted` —
3282
+ * either hardcoded `true` or wired from the handler's `args`.
3283
+ *
3284
+ * A `.softDelete()` table hides deleted rows from list reads (`findMany` /
3285
+ * `findFirst`) unless the call passes `includeDeleted: true`. That opt-out is a
3286
+ * deliberate, privileged escape hatch (an admin trash view, a restore flow). On
3287
+ * a `.public()` read it becomes a leak: `includeDeleted: true` returns
3288
+ * soft-deleted rows to *every* caller, and `includeDeleted: args.showDeleted`
3289
+ * lets *any* caller flip the toggle per request — either way the "deleted" rows
3290
+ * a user believes are gone (and that your UI hides) are served straight back.
3291
+ *
3292
+ * INFO, near-zero false positives by construction: it fires only when all of
3293
+ * (1) the enclosing procedure is public, (2) the read's target is a schema table
3294
+ * that actually declares `.softDelete()`, and (3) `includeDeleted` is a hardcoded
3295
+ * `true` or arg-derived. A literal `false`, or an `includeDeleted` gated by a
3296
+ * server-trusted `ctx.*` value, is never recorded by the feeder, so a correct
3297
+ * admin-gated read is not flagged. Runs only when the codegen feeder supplies
3298
+ * `context.softDeleteReads`; a runtime caller flags nothing. One finding per
3299
+ * matching read.
3300
+ */
3301
+ declare const softDeleteIncludeDeletedFromArgs: Lint;
3302
+ /**
1288
3303
  * Flags a `ctx.sql` tagged-template that splices an unparameterized
1289
3304
  * string-building expression into the query.
1290
3305
  *
@@ -1301,6 +3316,107 @@ declare const rlsUncoveredTable: Lint;
1301
3316
  */
1302
3317
  declare const sqlInjectionRisk: Lint;
1303
3318
  /**
3319
+ * Flags a `ctx.storage.generateUploadUrl(key, …)` call whose options argument
3320
+ * omits `contentType`.
3321
+ *
3322
+ * `generateUploadUrl` mints a signed `PUT` URL the *client* uploads directly
3323
+ * to R2, bypassing `upload()`/`store()` entirely — including their
3324
+ * `allowedContentTypes`/`maxSize` guards, which this alias never sees. The one
3325
+ * guard `generateUploadUrl` itself offers is `contentType`: passing it pins
3326
+ * the `Content-Type` into the signature, so the signed URL only authorizes a
3327
+ * PUT with exactly that content-type. Omit it and the minted URL accepts any
3328
+ * content-type/size the client chooses, entirely unchecked server-side.
3329
+ *
3330
+ * Runs only when the codegen feeder supplies storage-upload evidence
3331
+ * (`context.storageUploads`); a runtime caller flags nothing. Skips calls
3332
+ * whose options argument wasn't statically analyzable (a variable, call
3333
+ * result, or a spread) — the key may be set on an object built elsewhere. One
3334
+ * finding per unpinned call.
3335
+ */
3336
+ declare const storageGenerateUploadUrlNoContentTypePin: Lint;
3337
+ /**
3338
+ * Flags a `ctx.storage.&lt;bucket>.&lt;method>(key, …)` whose R2 object key is derived
3339
+ * from the handler's `args` with no server-side scoping — an object-level IDOR.
3340
+ *
3341
+ * The bucket read/write/URL/delete methods (`get`, `put`, `delete`, `download`,
3342
+ * `store`, `getSignedUrl`, …) take the object key as their first argument. When
3343
+ * that key comes straight from request input (`ctx.storage.docs.get(args.key)`, or
3344
+ * a key built one hop earlier from `args`), any caller can name any object — reading,
3345
+ * overwriting, or deleting another user's file. The fix is to prefix the key with a
3346
+ * server-trusted identity (`` `${ctx.auth.userId}/…` ``) or to resolve the object
3347
+ * through a record the caller is known to own; a key that references `ctx` is treated
3348
+ * as scoped and is not flagged.
3349
+ *
3350
+ * Runs only when the codegen feeder supplies storage-key evidence
3351
+ * (`context.storageKeyAccesses`); a runtime caller flags nothing. One finding per
3352
+ * offending call.
3353
+ */
3354
+ declare const storageKeyFromUserArgs: Lint;
3355
+ /**
3356
+ * Flags a `ctx.storage.getPresignedUrl(...)` call, or a `getPresignedUrl`/
3357
+ * `getSignedUrl` call whose `expiresInSeconds` sits near the shared 7-day
3358
+ * signing ceiling.
3359
+ *
3360
+ * `getPresignedUrl` mints a native S3 SigV4 URL that resolves directly
3361
+ * against R2's S3 endpoint — the holder reaches the object straight off R2,
3362
+ * **bypassing the Worker entirely**, so any auth/RLS/rate-limit gate the app
3363
+ * enforces in its own handlers never runs for that request. That's the right
3364
+ * trade for genuinely public or bulk content where the app has no per-request
3365
+ * gating to apply; it's the wrong choice for private, per-user, or
3366
+ * policy-gated content, where `getSignedUrl` (worker-signed, resolves back
3367
+ * through the app) is the fit. Separately, either signer minting a long TTL
3368
+ * near the shared 7-day ceiling hands out a bearer credential that stays
3369
+ * valid almost as long as the platform allows — a leaked link (referrer,
3370
+ * logs, browser history) then grants access for nearly a week.
3371
+ *
3372
+ * Runs only when the codegen feeder supplies storage-upload evidence
3373
+ * (`context.storageUploads`); a runtime caller flags nothing. The
3374
+ * near-ceiling check only fires on a statically-known numeric
3375
+ * `expiresInSeconds` literal — a variable or computed expression is not
3376
+ * evaluated, to keep the false-positive rate low. One finding per matching
3377
+ * call.
3378
+ */
3379
+ declare const storagePresignedUrlForPrivateContent: Lint;
3380
+ /**
3381
+ * Flags a `ctx.storage.upload`/`store` call whose options argument omits
3382
+ * `allowedContentTypes`.
3383
+ *
3384
+ * `@lunora/storage`'s `upload`/`store` accept an `allowedContentTypes`
3385
+ * allowlist that, when set, rejects a mismatched (or missing) `contentType` —
3386
+ * the control that stops an uploader from storing `text/html` or
3387
+ * `image/svg+xml` and having it served back from `publicBaseUrl`, a classic
3388
+ * stored-XSS path against your own origin. Omitting the option leaves any
3389
+ * content-type acceptable. `generateUploadUrl`'s signed PUT has no
3390
+ * `allowedContentTypes` option at all (it bypasses `upload()`'s guards
3391
+ * entirely) — that gap is `storage_generate_upload_url_no_content_type_pin`'s
3392
+ * concern, not this lint's.
3393
+ *
3394
+ * Runs only when the codegen feeder supplies storage-upload evidence
3395
+ * (`context.storageUploads`); a runtime caller flags nothing. Skips calls
3396
+ * whose options argument wasn't statically analyzable (a variable, call
3397
+ * result, or a spread) — the key may be set on an object built elsewhere. One
3398
+ * finding per unguarded call.
3399
+ */
3400
+ declare const storageUploadWithoutContentTypeAllowlist: Lint;
3401
+ /**
3402
+ * Flags a `ctx.storage.upload`/`store` call whose options argument omits
3403
+ * `maxSize`.
3404
+ *
3405
+ * `@lunora/storage`'s `upload`/`store` accept a `maxSize` byte ceiling that
3406
+ * rejects an oversized `ArrayBuffer`/`Blob` up front, and pipes a
3407
+ * `ReadableStream` through a counting `TransformStream` that aborts once the
3408
+ * limit is exceeded — without it, a caller can push an unbounded body through
3409
+ * the Worker straight into R2, exhausting storage/billing (and, for a
3410
+ * streamed body, worker CPU/time) with no cap.
3411
+ *
3412
+ * Runs only when the codegen feeder supplies storage-upload evidence
3413
+ * (`context.storageUploads`); a runtime caller flags nothing. Skips calls
3414
+ * whose options argument wasn't statically analyzable (a variable, call
3415
+ * result, or a spread) — the key may be set on an object built elsewhere. One
3416
+ * finding per unbounded call.
3417
+ */
3418
+ declare const storageUploadWithoutMaxSize: Lint;
3419
+ /**
1304
3420
  * Flags a declared table that no function inserts into.
1305
3421
  *
1306
3422
  * Using `@lunora/codegen`'s write-side discovery (the analog of the read
@@ -1387,6 +3503,44 @@ declare const unindexedRelationTarget: Lint;
1387
3503
  */
1388
3504
  declare const userCreatingMutationWithoutCaptcha: Lint;
1389
3505
  /**
3506
+ * Flags a `ctx.vectors.query`/`upsert`/`upsertMany` call whose `namespace`
3507
+ * input is derived from the handler's `args` with no server-side scoping — a
3508
+ * tenant-partition escape.
3509
+ *
3510
+ * Vectorize namespaces partition a single index into isolated sub-collections
3511
+ * (typically one per tenant/user). When a namespace comes straight from
3512
+ * request input (`ctx.vectors.query(idx, { namespace: args.tenant })`, or a
3513
+ * value built one hop earlier from `args`), any caller can hand in another
3514
+ * tenant's namespace and read or poison that tenant's vectors. The fix is to
3515
+ * derive the namespace from a server-trusted identity (`` `${ctx.auth.orgId}` ``)
3516
+ * so a caller can only ever address their own partition — a namespace that
3517
+ * references `ctx` is treated as scoped and is not flagged.
3518
+ *
3519
+ * Runs only when the codegen feeder supplies vector-namespace evidence
3520
+ * (`context.vectorNamespaceAccesses`); a runtime caller flags nothing. One
3521
+ * finding per arg-derived, unscoped `ctx.vectors` call.
3522
+ */
3523
+ declare const vectorsNamespaceFromUserInput: Lint;
3524
+ /**
3525
+ * Flags a durable step name reused within one workflow.
3526
+ *
3527
+ * Cloudflare Workflows memoizes every `step.do` / `step.sleep` / `step.sleepUntil`
3528
+ * / `step.waitForEvent` call by its name: on replay the runtime returns the cached
3529
+ * result for a name it has already seen. Two distinct steps that share a name are
3530
+ * therefore a silent bug — the second call never runs its body and instead yields
3531
+ * the first's result, skipping the work (a charge, a write, an external wait)
3532
+ * without error. Hence `ERROR`/`INTERNAL`: it is a developer-facing correctness
3533
+ * defect in the workflow's own code, not a runtime-data nit.
3534
+ *
3535
+ * Only the first string-literal argument of each step call is compared; a step
3536
+ * named dynamically (`step.do(\`load-${id}\`, …)`) is omitted by the feeder, so a
3537
+ * deliberately-parameterized fan-out is never flagged. `ctx.runStep(stepDef, …)`
3538
+ * names (which come from `defineStep` in another file) are out of scope here.
3539
+ * Only runs when the declaration feeder supplied step evidence
3540
+ * (`workflow.steps` present); a runtime caller flags nothing.
3541
+ */
3542
+ declare const workflowDuplicateStepName: Lint;
3543
+ /**
1390
3544
  * A correctness lint: every `ctx.workflows.get("name")` call must reference a
1391
3545
  * workflow that exists — i.e. a `defineWorkflow` export in `lunora/workflows.ts`.
1392
3546
  * A `.get("x")` whose `"x"` resolves to no declared workflow is a typo or a
@@ -1448,4 +3602,4 @@ interface RunAdvisorOptions {
1448
3602
  * `static` lints at build time and defer `runtime` lints to a live shard.
1449
3603
  */
1450
3604
  declare const runAdvisor: (context: LintContext, options?: RunAdvisorOptions) => Finding[];
1451
- export { AE_METRIC_EVENTS, ALL_LINTS, type AdvisorAdminRoute, type AdvisorArgumentValidator, type AdvisorAuthApiCall, type AdvisorContainer, type AdvisorHyperdriveCall, type AdvisorIndex, type AdvisorIndexHit, type AdvisorInsertWrite, type AdvisorMaskProcedure, type AdvisorNondeterministicCall, type AdvisorProcedureProtection, type AdvisorQueryRead, type AdvisorR2sqlCall, type AdvisorRelation, type AdvisorRlsProcedure, type AdvisorSchema, type AdvisorSecretLiteral, type AdvisorShardTraffic, type AdvisorSqlInterpolation, type AdvisorTable, type AdvisorTableSample, type AdvisorTableScan, type AdvisorWorkflow, type AdvisorWorkflowCall, type AnalyticsMetricsOptions, type AnalyticsMetricsSource, type AnalyticsRuntimeMetrics, type Category, type Facing, type Finding, type Level, type Lint, type LintContext, type LintSource, RUNTIME_LINTS, RunAdvisorOptions, STATIC_LINTS, adminRouteWithoutGuard, authApiCallWithoutHeaders, circularFk, constraintValidator, containerOversizedInstance, containerPublicInternet, duplicateIndex, emptyIndex, filterWithoutIndex, fromServerSchema, hardcodedSecret, hotShard, hyperdriveOutsideAction, indexReferencesUnknownField, indexUtilization, loadAnalyticsRuntimeMetrics, maskUncoveredPiiColumn, nondeterministicQueryMutation, policyReferencesUnknownTable, publicArgumentUsesAny, publicMutationWithoutRatelimit, r2sqlOutsideAction, relationReferencesUnknownField, relationReferencesUnknownTable, rlsUncoveredTable, runAdvisor, sqlInjectionRisk, tableWithoutInsert, unboundedStringArgument, unindexedForeignKey, unindexedRelationTarget, userCreatingMutationWithoutCaptcha, workflowUnknownTarget, workflowUnused };
3605
+ export { AE_METRIC_EVENTS, ALL_LINTS, type AdvisorAdminRoute, type AdvisorAiRawRun, type AdvisorAiToolSideEffect, type AdvisorArgumentDerivedFetch, type AdvisorArgumentValidator, type AdvisorAuthApiCall, type AdvisorAuthConfig, type AdvisorBrowserUrlAccess, type AdvisorConfigCall, type AdvisorContainer, type AdvisorContainerKeyAccess, type AdvisorContainerOverride, type AdvisorFailOpenGuard, type AdvisorFlagSecurityDefault, type AdvisorHttpActionGuard, type AdvisorHttpHeaderWrite, type AdvisorHyperdriveCall, type AdvisorIdentityClaimRead, type AdvisorImageDeliveryUrlAccess, type AdvisorIndex, type AdvisorIndexHit, type AdvisorInsertWrite, type AdvisorKvKeyAccess, type AdvisorMailRecipientAccess, type AdvisorMaskProcedure, type AdvisorMaskStrategy, type AdvisorMutatorWrite, type AdvisorNondeterministicCall, type AdvisorNormalizeIdAuthorization, type AdvisorOwnerFieldWrite, type AdvisorPaymentWebhook, type AdvisorPrivilegedDispatch, type AdvisorProcedureProtection, type AdvisorQueryRead, type AdvisorQueue, type AdvisorQueueTuning, type AdvisorR2sqlCall, type AdvisorRatelimitKeySelector, type AdvisorRawRowReturn, type AdvisorRelation, type AdvisorRelationLoad, type AdvisorRlsProcedure, type AdvisorSchema, type AdvisorSecretLiteral, type AdvisorShape, type AdvisorShardTraffic, type AdvisorSoftDeleteRead, type AdvisorSqlInterpolation, type AdvisorStorageKeyAccess, type AdvisorStorageUpload, type AdvisorTable, type AdvisorTableSample, type AdvisorTableScan, type AdvisorVectorNamespaceAccess, type AdvisorWorkflow, type AdvisorWorkflowCall, type AdvisorWranglerVariable, type AnalyticsMetricsOptions, type AnalyticsMetricsSource, type AnalyticsRuntimeMetrics, type Category, type Facing, type Finding, type Level, type Lint, type LintContext, type LintSource, RUNTIME_LINTS, RunAdvisorOptions, STATIC_LINTS, actionFetchSsrf, adminRouteWithoutGuard, aiRawRunEscapeHatch, aiToolSideEffectPromptInjection, aiUnboundedGenerationPublic, allowUnauthenticatedShardAccessEnabled, authApiCallWithoutHeaders, authCsrfCheckDisabled, authEmailVerificationDisabled, authSecureCookiesDisabled, authSessionFreshageZero, authTrustedOriginsWildcard, browserAllowPrivateTargets, browserUserUrlWithoutAllowlist, circularFk, constraintValidator, containerInstanceKeyFromUserInput, containerOversizedInstance, containerPublicInternet, containerRuntimeEgressRelaxation, containerStartEnableInternetOverride, duplicateIndex, emptyIndex, externalSourceOnGlobal, externalSourceUnscoped, filterWithoutIndex, flagGatesSecurityWithUnsafeDefault, fromServerSchema, hardcodedSecret, hotShard, httpActionMissingAuthGuard, httpActionResponseHeaderInjection, hyperdriveOutsideAction, identityUndeclaredClaimTrusted, imagesUrlSourceFromUserInput, indexReferencesUnknownField, indexUtilization, insertManyUnsafeUserData, kvUnscopedUserKeyIdor, loadAnalyticsRuntimeMetrics, mailInboundDispatchWithoutVerify, mailRecipientFromRequestInput, maskUncoveredPiiColumn, maskWeakHashStrategyOnPii, maskedRelationLeakViaWith, mutatorFullRowReplace, nondeterministicQueryMutation, normalizeIdUsedAsAuthorization, outputProjectionMissingOnPublicRead, ownerFieldFromArgsNotAuth, paymentCreateWithoutAuthorize, paymentWebhookWideTolerance, plaintextSecretInWranglerVariables, policyReferencesUnknownTable, privilegedDispatchUnvalidatedPayload, privilegedFanoutFromPublicProcedure, publicArgumentUsesAny, publicMutationWithoutRatelimit, publicTableRlsOptoutConfusion, queueWithoutDlq, r2sqlOutsideAction, ratelimitDefaultMemoryStore, ratelimitKeySpoofableOrGlobal, ratelimitMiddlewareFailOpen, relationReferencesUnknownField, relationReferencesUnknownTable, rlsUncoveredTable, runAdvisor, shapeTargetsGlobalTable, shapeUnknownTable, softDeleteIncludeDeletedFromArgs, sqlInjectionRisk, storageGenerateUploadUrlNoContentTypePin, storageKeyFromUserArgs, storagePresignedUrlForPrivateContent, storageUploadWithoutContentTypeAllowlist, storageUploadWithoutMaxSize, tableWithoutInsert, unboundedStringArgument, unindexedForeignKey, unindexedRelationTarget, userCreatingMutationWithoutCaptcha, vectorsNamespaceFromUserInput, workflowDuplicateStepName, workflowUnknownTarget, workflowUnused };