@lunora/advisor 1.0.0-alpha.291 → 1.0.0-alpha.292

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 (98) hide show
  1. package/dist/index.d.mts +22 -0
  2. package/dist/index.d.ts +22 -0
  3. package/dist/index.mjs +1 -1
  4. package/dist/packem_shared/{actionFetchSsrf-BK-kvOPO.mjs → actionFetchSsrf-B7FqsLWm.mjs} +1 -1
  5. package/dist/packem_shared/actionWithoutErrorHandling-DK3rB5c-.mjs +1 -0
  6. package/dist/packem_shared/adminRouteWithoutGuard-CcdlN75o.mjs +1 -0
  7. package/dist/packem_shared/{aiRawRunEscapeHatch-BW7a8kZC.mjs → aiRawRunEscapeHatch-CzIaQf_v.mjs} +1 -1
  8. package/dist/packem_shared/aiRunWithoutLogging-Ct5MeKWe.mjs +1 -0
  9. package/dist/packem_shared/{aiToolSideEffectPromptInjection-9eJXRlKt.mjs → aiToolSideEffectPromptInjection-Ck_h8tFx.mjs} +1 -1
  10. package/dist/packem_shared/aiUnboundedGenerationPublic-CzF3xBc3.mjs +1 -0
  11. package/dist/packem_shared/{authApiCallWithoutHeaders-CReJRsGW.mjs → authApiCallWithoutHeaders-9PpziIB9.mjs} +1 -1
  12. package/dist/packem_shared/{authCsrfCheckDisabled-CRIVsvb9.mjs → authCsrfCheckDisabled-DYTzZFpp.mjs} +1 -1
  13. package/dist/packem_shared/{authEmailVerificationDisabled-BjFlnHr2.mjs → authEmailVerificationDisabled-OiNes7Dz.mjs} +1 -1
  14. package/dist/packem_shared/{authScimWithoutTransactions-B5ATiz5A.mjs → authScimWithoutTransactions-CajXH24D.mjs} +1 -1
  15. package/dist/packem_shared/{authSecureCookiesDisabled-By8PVum3.mjs → authSecureCookiesDisabled-CA5zyqDZ.mjs} +1 -1
  16. package/dist/packem_shared/{authSessionFreshageZero-DuxX3Ln9.mjs → authSessionFreshageZero-C3IYlYft.mjs} +1 -1
  17. package/dist/packem_shared/{authTrustedOriginsWildcard-BKIh6788.mjs → authTrustedOriginsWildcard-661FRsGe.mjs} +1 -1
  18. package/dist/packem_shared/{browserUserUrlWithoutAllowlist-CzDEraJB.mjs → browserUserUrlWithoutAllowlist-Bi5ZWTF7.mjs} +1 -1
  19. package/dist/packem_shared/{containerInstanceKeyFromUserInput-Bl-tAzKV.mjs → containerInstanceKeyFromUserInput-DHQ2JL4x.mjs} +1 -1
  20. package/dist/packem_shared/containerLongSleepAfter-DSGnfpfl.mjs +1 -0
  21. package/dist/packem_shared/containerOversizedInstance-INKmy3-D.mjs +1 -0
  22. package/dist/packem_shared/containerPublicInternet-Csh5_RwX.mjs +1 -0
  23. package/dist/packem_shared/{containerRuntimeEgressRelaxation-4tMrhq1k.mjs → containerRuntimeEgressRelaxation-J6rpfvr8.mjs} +1 -1
  24. package/dist/packem_shared/{containerStartEnableInternetOverride-mN_kuRtk.mjs → containerStartEnableInternetOverride-Bxbmrpwe.mjs} +1 -1
  25. package/dist/packem_shared/{countWithoutIndex-DjQFNBrw.mjs → countWithoutIndex-CTbdpLyE.mjs} +1 -1
  26. package/dist/packem_shared/cronEveryMinute-BjdRdTEz.mjs +1 -0
  27. package/dist/packem_shared/errorWithoutCatalog-Dib0sdSD.mjs +1 -0
  28. package/dist/packem_shared/{filterAfterIndexScan-CV8aPq7v.mjs → filterAfterIndexScan-BTHjxkNi.mjs} +1 -1
  29. package/dist/packem_shared/{filterOnPrimaryKey-CAhFiqp_.mjs → filterOnPrimaryKey-DeRYfLa7.mjs} +1 -1
  30. package/dist/packem_shared/{filterWithoutIndex-BGv3jbgg.mjs → filterWithoutIndex-8VrXwbq5.mjs} +1 -1
  31. package/dist/packem_shared/{flagGatesSecurityWithUnsafeDefault-B5FBDF8c.mjs → flagGatesSecurityWithUnsafeDefault-CJK9sKcH.mjs} +1 -1
  32. package/dist/packem_shared/{geoIndexFieldNotGeopoint-BMQuok2-.mjs → geoIndexFieldNotGeopoint-Cx_9INob.mjs} +1 -1
  33. package/dist/packem_shared/{helpers-DdZ_pyR3.mjs → helpers-YAAwOBMH.mjs} +1 -1
  34. package/dist/packem_shared/{httpActionMissingAuthGuard-DhMIs1EI.mjs → httpActionMissingAuthGuard-D58Vnjr0.mjs} +1 -1
  35. package/dist/packem_shared/{httpActionResponseHeaderInjection-mcRYd3Zw.mjs → httpActionResponseHeaderInjection-Yn1pbKZ8.mjs} +1 -1
  36. package/dist/packem_shared/{identityUndeclaredClaimTrusted-D1sEd5lr.mjs → identityUndeclaredClaimTrusted-Z-9ob8F2.mjs} +1 -1
  37. package/dist/packem_shared/{imagesUrlSourceFromUserInput-BJXotuyO.mjs → imagesUrlSourceFromUserInput-a2CZ-Xnj.mjs} +1 -1
  38. package/dist/packem_shared/{indexReferencesUnknownField-DKz4-bla.mjs → indexReferencesUnknownField-CV8STvk0.mjs} +1 -1
  39. package/dist/packem_shared/insertManyUnsafeUserData-CSvy65sr.mjs +1 -0
  40. package/dist/packem_shared/{kvUnscopedUserKeyIdor-DhymglIq.mjs → kvUnscopedUserKeyIdor-D0O2alyn.mjs} +1 -1
  41. package/dist/packem_shared/{mailRecipientFromRequestInput-BVXsZ4Xf.mjs → mailRecipientFromRequestInput-BMrAJjNK.mjs} +1 -1
  42. package/dist/packem_shared/{maskWeakHashStrategyOnPii-DJasagzX.mjs → maskWeakHashStrategyOnPii-CwgAXFSx.mjs} +1 -1
  43. package/dist/packem_shared/{outputProjectionMissingOnPublicRead-DWSeo7oC.mjs → outputProjectionMissingOnPublicRead-BPS-eg2q.mjs} +1 -1
  44. package/dist/packem_shared/{ownerFieldFromArgsNotAuth-J8Xbz5uI.mjs → ownerFieldFromArgsNotAuth-BmKLZxrX.mjs} +1 -1
  45. package/dist/packem_shared/{paymentWebhookWideTolerance-CqMcZOb2.mjs → paymentWebhookWideTolerance-D9i3Vb1n.mjs} +1 -1
  46. package/dist/packem_shared/policyReferencesUnknownTable-DiQYFRFY.mjs +1 -0
  47. package/dist/packem_shared/{privilegedDispatchUnvalidatedPayload-BM3NtT57.mjs → privilegedDispatchUnvalidatedPayload-BJL0JNzG.mjs} +1 -1
  48. package/dist/packem_shared/privilegedFanoutFromPublicProcedure-Byw3Prsi.mjs +1 -0
  49. package/dist/packem_shared/procedureWithoutStructuredEvent-na08a0M1.mjs +1 -0
  50. package/dist/packem_shared/publicMutationWithoutRatelimit-DAxh8tL0.mjs +1 -0
  51. package/dist/packem_shared/{publicTableRlsOptoutConfusion-CbNk75Xo.mjs → publicTableRlsOptoutConfusion-W_jAkKFR.mjs} +1 -1
  52. package/dist/packem_shared/queueWithoutDlq-CF_xUgE_.mjs +1 -0
  53. package/dist/packem_shared/{ratelimitKeySpoofableOrGlobal-DHMl74hR.mjs → ratelimitKeySpoofableOrGlobal-VSGOuu5X.mjs} +1 -1
  54. package/dist/packem_shared/{ratelimitMiddlewareFailOpen-Di2t8pDc.mjs → ratelimitMiddlewareFailOpen-bweBVZ4J.mjs} +1 -1
  55. package/dist/packem_shared/{relationReferencesUnknownField-Cl6mik8w.mjs → relationReferencesUnknownField-hVsgaUKy.mjs} +1 -1
  56. package/dist/packem_shared/rlsUncoveredTable-e2FhD6Nr.mjs +1 -0
  57. package/dist/packem_shared/selfRescheduleWithoutProgress-HoknmezK.mjs +1 -0
  58. package/dist/packem_shared/shapeTargetsGlobalTable-CYRV8OvU.mjs +1 -0
  59. package/dist/packem_shared/shapeUnknownTable-6virkUOz.mjs +1 -0
  60. package/dist/packem_shared/signupMutationWithoutDisposableGating-nopEfEEK.mjs +1 -0
  61. package/dist/packem_shared/{sqlInjectionRisk-BBWvOBtw.mjs → sqlInjectionRisk-CSKho3Vk.mjs} +1 -1
  62. package/dist/packem_shared/{storageGenerateUploadUrlNoContentTypePin-CrwFuo83.mjs → storageGenerateUploadUrlNoContentTypePin-BlOPGwhZ.mjs} +1 -1
  63. package/dist/packem_shared/{storageKeyFromUserArgs-3vkxmI3v.mjs → storageKeyFromUserArgs-BuoTsz-h.mjs} +1 -1
  64. package/dist/packem_shared/{storagePresignedUrlForPrivateContent-C3KeV5tV.mjs → storagePresignedUrlForPrivateContent-l-EwrAfj.mjs} +1 -1
  65. package/dist/packem_shared/{storageUploadWithoutContentTypeAllowlist-BXoK_QWE.mjs → storageUploadWithoutContentTypeAllowlist-JmITAazT.mjs} +1 -1
  66. package/dist/packem_shared/{storageUploadWithoutMaxSize-CW7uKvSi.mjs → storageUploadWithoutMaxSize-DlhE1I98.mjs} +1 -1
  67. package/dist/packem_shared/sweeps-DYG_FnlQ.mjs +1 -0
  68. package/dist/packem_shared/{ttlFieldNotTimestamp-lnb5nmM6.mjs → ttlFieldNotTimestamp-C8zgHJjp.mjs} +1 -1
  69. package/dist/packem_shared/{unboundedCollectOnOpenRange-DHy2RUL7.mjs → unboundedCollectOnOpenRange-DDGNuKks.mjs} +1 -1
  70. package/dist/packem_shared/{unboundedLoop-DxN3_apu.mjs → unboundedLoop-CUF9Wdxa.mjs} +1 -1
  71. package/dist/packem_shared/userCreatingMutationWithoutCaptcha-8mtYqiGy.mjs +1 -0
  72. package/dist/packem_shared/{vectorsNamespaceFromUserInput-CFa2qhFU.mjs → vectorsNamespaceFromUserInput-537Bt2vT.mjs} +1 -1
  73. package/dist/packem_shared/{workflowUnknownTarget-DEKB5H0g.mjs → workflowUnknownTarget-DdG3cUPH.mjs} +1 -1
  74. package/dist/packem_shared/workflowUnused-CSKRWTd_.mjs +1 -0
  75. package/package.json +1 -1
  76. package/dist/packem_shared/actionWithoutErrorHandling-4GCBT0_z.mjs +0 -1
  77. package/dist/packem_shared/adminRouteWithoutGuard-DPE7LuNh.mjs +0 -1
  78. package/dist/packem_shared/aiRunWithoutLogging-DT665z-w.mjs +0 -1
  79. package/dist/packem_shared/aiUnboundedGenerationPublic-C17h6sMV.mjs +0 -1
  80. package/dist/packem_shared/containerLongSleepAfter-CVvHEGYC.mjs +0 -1
  81. package/dist/packem_shared/containerOversizedInstance-Bx89uR7E.mjs +0 -1
  82. package/dist/packem_shared/containerPublicInternet-BFfZf_P4.mjs +0 -1
  83. package/dist/packem_shared/cronEveryMinute-CtpEAbxs.mjs +0 -1
  84. package/dist/packem_shared/errorWithoutCatalog-BTfvaXHR.mjs +0 -1
  85. package/dist/packem_shared/insertManyUnsafeUserData-DWE8d_DF.mjs +0 -1
  86. package/dist/packem_shared/policyReferencesUnknownTable-CIKuRZ5Y.mjs +0 -1
  87. package/dist/packem_shared/privilegedFanoutFromPublicProcedure-DV188gHQ.mjs +0 -1
  88. package/dist/packem_shared/procedureWithoutStructuredEvent-BcOE0mFx.mjs +0 -1
  89. package/dist/packem_shared/publicMutationWithoutRatelimit-Bd-rRxnz.mjs +0 -1
  90. package/dist/packem_shared/queueWithoutDlq-BvHz3Opg.mjs +0 -1
  91. package/dist/packem_shared/rlsUncoveredTable-CZ4ie4gX.mjs +0 -1
  92. package/dist/packem_shared/selfRescheduleWithoutProgress-CQNZI4FA.mjs +0 -1
  93. package/dist/packem_shared/shapeTargetsGlobalTable-Bu3eEDic.mjs +0 -1
  94. package/dist/packem_shared/shapeUnknownTable-CREfNnWi.mjs +0 -1
  95. package/dist/packem_shared/signupMutationWithoutDisposableGating-BdKwtxDP.mjs +0 -1
  96. package/dist/packem_shared/sweeps-JWMwcakB.mjs +0 -1
  97. package/dist/packem_shared/userCreatingMutationWithoutCaptcha-D4TZEpgz.mjs +0 -1
  98. package/dist/packem_shared/workflowUnused-DHwwE-1P.mjs +0 -1
@@ -1 +1 @@
1
- import{e as i}from"./finding-NrKO8idM.mjs";import{a as d,c as r}from"./helpers-DdZ_pyR3.mjs";const n={categories:["SECURITY"],description:"An authorization read of `auth.identity.<key>` for a claim outside the declared `defineIdentity({ ... })` contract. `defineIdentity` validates only declared claims and forwards undeclared ones verbatim, so the value the policy trusts was never validated — an attacker's token can forge it.",facing:"EXTERNAL",level:"WARN",name:"identity_undeclared_claim_trusted",remediation:"Declare the claim in `defineIdentity({ ... })` (e.g. `role: v.optional(v.string())`) so the worker validates it at the trust boundary before a policy reads it, or stop trusting it for authorization. Declared claims (and `userId`) are validated; undeclared claims are forwarded unchecked.",run:t=>t.identityClaimReads===void 0?[]:t.identityClaimReads.filter(e=>!e.declared).map(e=>{const a=d(e);return i(n,{cacheKey:`identity_undeclared_claim_trusted:${e.file}:${e.line.toString()}:${e.key}`,detail:`\`${e.key}\` in ${a} is read off \`identity\` but is not declared in \`defineIdentity({ ... })\`. Undeclared claims are forwarded unvalidated, so this authorization decision trusts a forgeable value.`,metadata:{...r(e),key:e.key}})}),source:"static",title:"Authorization trusts an undeclared identity claim"};export{n as default};
1
+ import{e as i}from"./finding-NrKO8idM.mjs";import{a as d,c as r}from"./helpers-YAAwOBMH.mjs";const n={categories:["SECURITY"],description:"An authorization read of `auth.identity.<key>` for a claim outside the declared `defineIdentity({ ... })` contract. `defineIdentity` validates only declared claims and forwards undeclared ones verbatim, so the value the policy trusts was never validated — an attacker's token can forge it.",facing:"EXTERNAL",level:"WARN",name:"identity_undeclared_claim_trusted",remediation:"Declare the claim in `defineIdentity({ ... })` (e.g. `role: v.optional(v.string())`) so the worker validates it at the trust boundary before a policy reads it, or stop trusting it for authorization. Declared claims (and `userId`) are validated; undeclared claims are forwarded unchecked.",run:t=>t.identityClaimReads===void 0?[]:t.identityClaimReads.filter(e=>!e.declared).map(e=>{const a=d(e);return i(n,{cacheKey:`identity_undeclared_claim_trusted:${e.file}:${e.line.toString()}:${e.key}`,detail:`\`${e.key}\` in ${a} is read off \`identity\` but is not declared in \`defineIdentity({ ... })\`. Undeclared claims are forwarded unvalidated, so this authorization decision trusts a forgeable value.`,metadata:{...r(e),key:e.key}})}),source:"static",title:"Authorization trusts an undeclared identity claim"};export{n as default};
@@ -1 +1 @@
1
- import{m as r}from"./argument-derived-sink-DLXFC79t.mjs";import{c as a,a as i}from"./helpers-DdZ_pyR3.mjs";const o=r({cacheKey:e=>`images_url_source_from_user_input:${e.file}:${e.line.toString()}`,categories:["SECURITY"],description:"A `buildImageDeliveryUrl({ key, … })` call's `key` — the CDN transform's source image, an absolute URL or an origin-relative key — is derived from the handler's `args` with no server-side scoping, so any caller can point the CDN's on-the-fly transform at an attacker-chosen origin (SSRF / open proxy) or an arbitrary key under the account's own store.",detail:e=>`\`buildImageDeliveryUrl\` in ${i(e)} builds its delivery URL from a \`key\` derived from \`args\` with no server-side scoping — any caller can point the CDN's on-the-fly transform at an attacker-chosen origin or store key. Validate \`key\` against an allowlist, or derive it from server-trusted state.`,facing:"EXTERNAL",getAccesses:e=>e.imageDeliveryUrlAccesses,level:"WARN",metadata:e=>({...a(e)}),name:"images_url_source_from_user_input",remediation:"Validate `key` against an allowlist of known origins/prefixes before calling `buildImageDeliveryUrl`, or derive it from server-trusted state (a stored record's own image key) rather than passing `args` straight through.",title:"Image delivery URL built from unscoped user input"});export{o as default};
1
+ import{m as r}from"./argument-derived-sink-DLXFC79t.mjs";import{c as a,a as i}from"./helpers-YAAwOBMH.mjs";const o=r({cacheKey:e=>`images_url_source_from_user_input:${e.file}:${e.line.toString()}`,categories:["SECURITY"],description:"A `buildImageDeliveryUrl({ key, … })` call's `key` — the CDN transform's source image, an absolute URL or an origin-relative key — is derived from the handler's `args` with no server-side scoping, so any caller can point the CDN's on-the-fly transform at an attacker-chosen origin (SSRF / open proxy) or an arbitrary key under the account's own store.",detail:e=>`\`buildImageDeliveryUrl\` in ${i(e)} builds its delivery URL from a \`key\` derived from \`args\` with no server-side scoping — any caller can point the CDN's on-the-fly transform at an attacker-chosen origin or store key. Validate \`key\` against an allowlist, or derive it from server-trusted state.`,facing:"EXTERNAL",getAccesses:e=>e.imageDeliveryUrlAccesses,level:"WARN",metadata:e=>({...a(e)}),name:"images_url_source_from_user_input",remediation:"Validate `key` against an allowlist of known origins/prefixes before calling `buildImageDeliveryUrl`, or derive it from server-trusted state (a stored record's own image key) rather than passing `args` straight through.",title:"Image delivery URL built from unscoped user input"});export{o as default};
@@ -1 +1 @@
1
- import{e as i}from"./finding-NrKO8idM.mjs";import{t as r}from"./helpers-DdZ_pyR3.mjs";const c={categories:["SCHEMA"],description:"An index references a column that is not declared on its table. The index can never match, and the typo would otherwise surface only at runtime.",facing:"INTERNAL",level:"ERROR",name:"index_references_unknown_field",remediation:"Fix the column name in the index declaration, or add the column to the table.",run:a=>a.schema.tables.flatMap(e=>{const o=r(e);return e.indexes.flatMap(n=>n.fields.filter(t=>!o.has(t)).map(t=>i(c,{cacheKey:`index_references_unknown_field:${e.name}:${n.name}:${t}`,detail:`Index "${n.name}" on table "${e.name}" references column "${t}", which is not declared on the table.`,metadata:{field:t,index:n.name,indexKind:n.kind,table:e.name}})))}),source:"static",title:"Index references unknown field"};export{c as default};
1
+ import{e as i}from"./finding-NrKO8idM.mjs";import{t as r}from"./helpers-YAAwOBMH.mjs";const c={categories:["SCHEMA"],description:"An index references a column that is not declared on its table. The index can never match, and the typo would otherwise surface only at runtime.",facing:"INTERNAL",level:"ERROR",name:"index_references_unknown_field",remediation:"Fix the column name in the index declaration, or add the column to the table.",run:a=>a.schema.tables.flatMap(e=>{const o=r(e);return e.indexes.flatMap(n=>n.fields.filter(t=>!o.has(t)).map(t=>i(c,{cacheKey:`index_references_unknown_field:${e.name}:${n.name}:${t}`,detail:`Index "${n.name}" on table "${e.name}" references column "${t}", which is not declared on the table.`,metadata:{field:t,index:n.name,indexKind:n.kind,table:e.name}})))}),source:"static",title:"Index references unknown field"};export{c as default};
@@ -0,0 +1 @@
1
+ import{e as s}from"./finding-NrKO8idM.mjs";import{m as i}from"./procedure-protections-DRQotu9I.mjs";import{d as r}from"./helpers-YAAwOBMH.mjs";const a={categories:["SECURITY"],description:"A public procedure calls `ctx.db.insertManyUnsafe(...)`, which writes rows straight to storage and bypasses both the per-row validators and the schema's insert triggers (server-trusted columns, ownership stamping, RLS write checks). On a public entry point the rows are request-shaped, so a caller can write columns they shouldn't control and skip every trigger-enforced invariant.",facing:"EXTERNAL",level:"WARN",name:"insert_many_unsafe_user_data",remediation:"Use the validated `ctx.db.insert(...)` path in public procedures so validators and insert triggers run. If you need the unsafe bulk write, move it into an internal function (`internalMutation`/`internalAction`) that is fed only server-constructed rows, never request input.",run:t=>t.procedureProtections===void 0?[]:t.procedureProtections.filter(e=>i(e.usesInsertManyUnsafe)&&e.visibility==="public").map(e=>s(a,{cacheKey:`insert_many_unsafe_user_data:${e.file}:${e.exportName}`,detail:`\`${e.exportName}\` (${e.file}) is public and calls \`ctx.db.insertManyUnsafe(...)\`, bypassing validators and insert triggers on request-shaped rows. Switch to \`ctx.db.insert(...)\`, or move the bulk write into an internal function fed server-built rows.`,metadata:{exportName:e.exportName,...r(e),kind:e.kind}})),source:"static",title:"Public procedure uses insertManyUnsafe (bypasses validators and triggers)"};export{a as default};
@@ -1 +1 @@
1
- import{e as s}from"./finding-NrKO8idM.mjs";import{a as o,c as a}from"./helpers-DdZ_pyR3.mjs";const n={categories:["SECURITY"],description:"A `ctx.kv` read/write uses a namespace key derived from the handler's `args` with no server-side scoping. Workers KV is a flat namespace, so an unscoped key lets any caller read, overwrite, or delete another user's entry — an insecure direct object reference (IDOR).",facing:"EXTERNAL",level:"ERROR",name:"kv_unscoped_user_key_idor",remediation:"Prefix every `ctx.kv` key with a server-trusted identity (e.g. `${ctx.auth.userId}:${args.id}`) so a caller can only address their own entries. Never pass request input straight to `ctx.kv.get`/`put`/`delete`.",run:r=>r.kvKeyAccesses===void 0?[]:r.kvKeyAccesses.map(e=>{const t=`\`ctx.kv.${e.method}\` in ${o(e)}`,i={...a(e),method:e.method,visibility:e.visibility??"unknown"};return e.visibility==="internal"?s(n,{cacheKey:`kv_unscoped_user_key_idor:${e.file}:${e.line.toString()}`,detail:`${t} uses a KV key derived from \`args\` with no server-side scoping. This is expected for an \`internal\` procedure — no caller can reach it directly, so the key is only ever supplied by trusted server code. Audit the PUBLIC procedures that dispatch to it: if one forwards \`args\` straight through, the IDOR is there.`,facing:"INTERNAL",level:"INFO",metadata:i}):s(n,{cacheKey:`kv_unscoped_user_key_idor:${e.file}:${e.line.toString()}`,detail:`${t} uses a KV key derived from \`args\` with no server-side scoping — any caller can read/overwrite/delete another user's entry (IDOR). Prefix the key with a server-trusted identity (e.g. \`\${ctx.auth.userId}:…\`).`,metadata:i})}),source:"static",title:"Possible IDOR from arg-derived unscoped KV key"};export{n as default};
1
+ import{e as s}from"./finding-NrKO8idM.mjs";import{a as o,c as a}from"./helpers-YAAwOBMH.mjs";const n={categories:["SECURITY"],description:"A `ctx.kv` read/write uses a namespace key derived from the handler's `args` with no server-side scoping. Workers KV is a flat namespace, so an unscoped key lets any caller read, overwrite, or delete another user's entry — an insecure direct object reference (IDOR).",facing:"EXTERNAL",level:"ERROR",name:"kv_unscoped_user_key_idor",remediation:"Prefix every `ctx.kv` key with a server-trusted identity (e.g. `${ctx.auth.userId}:${args.id}`) so a caller can only address their own entries. Never pass request input straight to `ctx.kv.get`/`put`/`delete`.",run:r=>r.kvKeyAccesses===void 0?[]:r.kvKeyAccesses.map(e=>{const t=`\`ctx.kv.${e.method}\` in ${o(e)}`,i={...a(e),method:e.method,visibility:e.visibility??"unknown"};return e.visibility==="internal"?s(n,{cacheKey:`kv_unscoped_user_key_idor:${e.file}:${e.line.toString()}`,detail:`${t} uses a KV key derived from \`args\` with no server-side scoping. This is expected for an \`internal\` procedure — no caller can reach it directly, so the key is only ever supplied by trusted server code. Audit the PUBLIC procedures that dispatch to it: if one forwards \`args\` straight through, the IDOR is there.`,facing:"INTERNAL",level:"INFO",metadata:i}):s(n,{cacheKey:`kv_unscoped_user_key_idor:${e.file}:${e.line.toString()}`,detail:`${t} uses a KV key derived from \`args\` with no server-side scoping — any caller can read/overwrite/delete another user's entry (IDOR). Prefix the key with a server-trusted identity (e.g. \`\${ctx.auth.userId}:…\`).`,metadata:i})}),source:"static",title:"Possible IDOR from arg-derived unscoped KV key"};export{n as default};
@@ -1 +1 @@
1
- import{e as i}from"./finding-NrKO8idM.mjs";import{c as r,a}from"./helpers-DdZ_pyR3.mjs";const n={categories:["SECURITY"],description:"A `ctx.mail`/`ctx.email` `send`/`queue` call sets a recipient field (to/cc/bcc) from the handler's `args` with no server-side scoping. Sending to an address taken straight from request input turns the deployment into an open relay / spam amplifier.",facing:"EXTERNAL",level:"WARN",name:"mail_recipient_from_request_input",remediation:"Derive recipients from server-trusted state (e.g. the authenticated user's own record via `ctx.auth`), never straight from `args`. If user-chosen recipients are intended, gate the path behind authentication and rate limiting.",run:t=>t.mailRecipientAccesses===void 0?[]:t.mailRecipientAccesses.map(e=>i(n,{cacheKey:`mail_recipient_from_request_input:${e.file}:${e.line.toString()}`,detail:`\`ctx.mail.${e.method}\` in ${a(e)} sets a recipient field (to/cc/bcc) derived from \`args\` with no server-side scoping — any caller can direct mail to an arbitrary address (open relay / spam amplifier). Derive the recipient from server-trusted state instead (e.g. \`ctx.auth.user.email\`).`,metadata:{...r(e),method:e.method}})),source:"static",title:"Mail recipient derived from request input"};export{n as default};
1
+ import{e as i}from"./finding-NrKO8idM.mjs";import{c as r,a}from"./helpers-YAAwOBMH.mjs";const n={categories:["SECURITY"],description:"A `ctx.mail`/`ctx.email` `send`/`queue` call sets a recipient field (to/cc/bcc) from the handler's `args` with no server-side scoping. Sending to an address taken straight from request input turns the deployment into an open relay / spam amplifier.",facing:"EXTERNAL",level:"WARN",name:"mail_recipient_from_request_input",remediation:"Derive recipients from server-trusted state (e.g. the authenticated user's own record via `ctx.auth`), never straight from `args`. If user-chosen recipients are intended, gate the path behind authentication and rate limiting.",run:t=>t.mailRecipientAccesses===void 0?[]:t.mailRecipientAccesses.map(e=>i(n,{cacheKey:`mail_recipient_from_request_input:${e.file}:${e.line.toString()}`,detail:`\`ctx.mail.${e.method}\` in ${a(e)} sets a recipient field (to/cc/bcc) derived from \`args\` with no server-side scoping — any caller can direct mail to an arbitrary address (open relay / spam amplifier). Derive the recipient from server-trusted state instead (e.g. \`ctx.auth.user.email\`).`,metadata:{...r(e),method:e.method}})),source:"static",title:"Mail recipient derived from request input"};export{n as default};
@@ -1 +1 @@
1
- import{e as i}from"./finding-NrKO8idM.mjs";import{d as s}from"./helpers-DdZ_pyR3.mjs";const o={categories:["SECURITY"],description:'A `mask(policies)` column named like PII (email, SSN, phone, …) uses the `"hash"` strategy. `"hash"` is an unsalted 32-bit FNV-1a digest — brute-force-recoverable and cross-row-correlatable — not a confidentiality control, so it does not actually hide the value.',facing:"EXTERNAL",level:"WARN",name:"mask_weak_hash_strategy_on_pii",remediation:'Use `"redact"` instead of `"hash"` for this column — e.g. `mask({ <table>: { <column>: "redact" } })`. Reserve `"hash"` for columns where a stable, joinable pseudonym is the goal and the value itself is not sensitive.',run:a=>a.maskStrategies===void 0?[]:a.maskStrategies.filter(e=>e.strategy==="hash"&&s(e.column)).map(e=>i(o,{cacheKey:`mask_weak_hash_strategy_on_pii:${e.file}:${e.line.toString()}`,detail:`\`${e.exportName}\` in ${e.file} masks \`${e.table===""?e.column:`${e.table}.${e.column}`}\` with \`"hash"\` — its name suggests PII, and \`"hash"\` is brute-force-recoverable and leaks cross-row equality. Use \`"redact"\` instead.`,metadata:{column:e.column,exportName:e.exportName,file:e.file,table:e.table}})),source:"static",title:'Weak "hash" mask strategy on a PII column'};export{o as default};
1
+ import{e as i}from"./finding-NrKO8idM.mjs";import{e as s}from"./helpers-YAAwOBMH.mjs";const o={categories:["SECURITY"],description:'A `mask(policies)` column named like PII (email, SSN, phone, …) uses the `"hash"` strategy. `"hash"` is an unsalted 32-bit FNV-1a digest — brute-force-recoverable and cross-row-correlatable — not a confidentiality control, so it does not actually hide the value.',facing:"EXTERNAL",level:"WARN",name:"mask_weak_hash_strategy_on_pii",remediation:'Use `"redact"` instead of `"hash"` for this column — e.g. `mask({ <table>: { <column>: "redact" } })`. Reserve `"hash"` for columns where a stable, joinable pseudonym is the goal and the value itself is not sensitive.',run:a=>a.maskStrategies===void 0?[]:a.maskStrategies.filter(e=>e.strategy==="hash"&&s(e.column)).map(e=>i(o,{cacheKey:`mask_weak_hash_strategy_on_pii:${e.file}:${e.line.toString()}`,detail:`\`${e.exportName}\` in ${e.file} masks \`${e.table===""?e.column:`${e.table}.${e.column}`}\` with \`"hash"\` — its name suggests PII, and \`"hash"\` is brute-force-recoverable and leaks cross-row equality. Use \`"redact"\` instead.`,metadata:{column:e.column,exportName:e.exportName,file:e.file,table:e.table}})),source:"static",title:'Weak "hash" mask strategy on a PII column'};export{o as default};
@@ -1 +1 @@
1
- import{e as r}from"./finding-NrKO8idM.mjs";import{d as s}from"./helpers-DdZ_pyR3.mjs";const l={categories:["SECURITY"],description:"A `.public()` `query` returns raw table rows (no `.output(...)` projection, no `.use(mask(...))`) from a table carrying PII-named columns (`email`, `phone`, `ssn`, …). Every column ships to the caller, and a column added to the table later leaks by default.",facing:"EXTERNAL",level:"INFO",name:"output_projection_missing_on_public_read",remediation:"Add an explicit return projection to the public query — `.output(v.object({ … }).strip())` listing only the fields a client needs — or apply a `.use(mask(...))` policy to the PII columns. This makes the exposed shape intentional and stops a newly-added column from leaking through this query by default.",run:o=>{if(o.rawRowReturns===void 0)return[];const i=new Map;for(const e of o.schema.tables){const t=e.fields.filter(a=>s(a));t.length>0&&i.set(e.name,t)}const n=[];for(const e of o.rawRowReturns){if(e.visibility!=="public"||e.usesOutput||e.usesMask||e.table==="")continue;const t=i.get(e.table);t!==void 0&&n.push(r(l,{cacheKey:`output_projection_missing_on_public_read:${e.file}:${e.line.toString()}`,detail:`Public query \`${e.exportName}\` (${e.file}:${e.line.toString()}) returns raw \`${e.table}\` rows with no \`.output(...)\` projection — shipping PII column(s) ${t.join(", ")} to every caller, and any column added to \`${e.table}\` later leaks by default. Project the return with \`.output(v.object({ … }).strip())\` or mask the PII columns.`,metadata:{columns:t,exportName:e.exportName,file:e.file,line:e.line,table:e.table}}))}return n},source:"static",title:"Public query returns raw rows with PII and no output projection"};export{l as default};
1
+ import{e as r}from"./finding-NrKO8idM.mjs";import{e as s}from"./helpers-YAAwOBMH.mjs";const l={categories:["SECURITY"],description:"A `.public()` `query` returns raw table rows (no `.output(...)` projection, no `.use(mask(...))`) from a table carrying PII-named columns (`email`, `phone`, `ssn`, …). Every column ships to the caller, and a column added to the table later leaks by default.",facing:"EXTERNAL",level:"INFO",name:"output_projection_missing_on_public_read",remediation:"Add an explicit return projection to the public query — `.output(v.object({ … }).strip())` listing only the fields a client needs — or apply a `.use(mask(...))` policy to the PII columns. This makes the exposed shape intentional and stops a newly-added column from leaking through this query by default.",run:o=>{if(o.rawRowReturns===void 0)return[];const i=new Map;for(const e of o.schema.tables){const t=e.fields.filter(a=>s(a));t.length>0&&i.set(e.name,t)}const n=[];for(const e of o.rawRowReturns){if(e.visibility!=="public"||e.usesOutput||e.usesMask||e.table==="")continue;const t=i.get(e.table);t!==void 0&&n.push(r(l,{cacheKey:`output_projection_missing_on_public_read:${e.file}:${e.line.toString()}`,detail:`Public query \`${e.exportName}\` (${e.file}:${e.line.toString()}) returns raw \`${e.table}\` rows with no \`.output(...)\` projection — shipping PII column(s) ${t.join(", ")} to every caller, and any column added to \`${e.table}\` later leaks by default. Project the return with \`.output(v.object({ … }).strip())\` or mask the PII columns.`,metadata:{columns:t,exportName:e.exportName,file:e.file,line:e.line,table:e.table}}))}return n},source:"static",title:"Public query returns raw rows with PII and no output projection"};export{l as default};
@@ -1 +1 @@
1
- import{e as n}from"./finding-NrKO8idM.mjs";import{a as o,c as s}from"./helpers-DdZ_pyR3.mjs";const a={categories:["SECURITY"],description:"A `ctx.db` write sets an ownership/identity column (`userId`, `ownerId`, `tenantId`, …) from the handler's `args`. The caller controls who the row belongs to, so any caller can write rows owned by another user or tenant — an act-as-any-user / cross-tenant IDOR.",facing:"EXTERNAL",level:"ERROR",name:"owner_field_from_args_not_auth",remediation:"Stamp the ownership column from the server-trusted identity (`ctx.auth.userId` / `ctx.identity`), never from request input. Drop the field from the accepted `args` so a caller cannot supply it. In an `owner`-scoped `defineMutator`, `args[owner]` is verified only while the `server` impl leaves `args` untouched: a `server` impl that uses `this` or refers to itself (its own name, or `<mutator>.server`) is reported, because it could re-enter with unverified args. Handing `args` to a function codegen cannot read (an imported validator) also counts as touching it; validate in a function declared in the same file that only reads its argument, or validate a copy (`{ ...args }`).",run:i=>i.ownerFieldWrites===void 0?[]:i.ownerFieldWrites.flatMap(e=>{if(e.ownerScoped)return[];if(e.guarded)return[];const t=`\`${e.method}\` in ${o(e)}`,r={...s(e),field:e.field,method:e.method,visibility:e.visibility??"unknown"};return e.adminOnly?[n(a,{cacheKey:`owner_field_from_args_not_auth:${e.file}:${e.line.toString()}:${e.field}`,detail:`${t} sets the ownership field \`${e.field}\` from \`args\`. Expected for a platform-admin procedure: only an admin can reach it, and the admin gate is the trust boundary, not the subject field.`,facing:"INTERNAL",level:"INFO",metadata:r})]:e.visibility==="internal"?[n(a,{cacheKey:`owner_field_from_args_not_auth:${e.file}:${e.line.toString()}:${e.field}`,detail:`${t} sets the ownership field \`${e.field}\` from \`args\`. This is expected for an \`internal\` procedure — no caller can reach it directly, and the trusted caller passes the subject along. Audit the PUBLIC procedures that dispatch to it: if one forwards \`args.${e.field}\` straight through, the IDOR is there.`,facing:"INTERNAL",level:"INFO",metadata:r})]:[n(a,{cacheKey:`owner_field_from_args_not_auth:${e.file}:${e.line.toString()}:${e.field}`,detail:`${t} sets the ownership field \`${e.field}\` from \`args\` instead of the server-trusted identity — any caller can write rows owned by another user/tenant (IDOR). Stamp \`${e.field}\` from \`ctx.auth\`/\`ctx.identity\`, never from request input.`,metadata:r})]}),source:"static",title:"Ownership field written from args, not server identity"};export{a as default};
1
+ import{e as n}from"./finding-NrKO8idM.mjs";import{a as o,c as s}from"./helpers-YAAwOBMH.mjs";const a={categories:["SECURITY"],description:"A `ctx.db` write sets an ownership/identity column (`userId`, `ownerId`, `tenantId`, …) from the handler's `args`. The caller controls who the row belongs to, so any caller can write rows owned by another user or tenant — an act-as-any-user / cross-tenant IDOR.",facing:"EXTERNAL",level:"ERROR",name:"owner_field_from_args_not_auth",remediation:"Stamp the ownership column from the server-trusted identity (`ctx.auth.userId` / `ctx.identity`), never from request input. Drop the field from the accepted `args` so a caller cannot supply it. In an `owner`-scoped `defineMutator`, `args[owner]` is verified only while the `server` impl leaves `args` untouched: a `server` impl that uses `this` or refers to itself (its own name, or `<mutator>.server`) is reported, because it could re-enter with unverified args. Handing `args` to a function codegen cannot read (an imported validator) also counts as touching it; validate in a function declared in the same file that only reads its argument, or validate a copy (`{ ...args }`).",run:i=>i.ownerFieldWrites===void 0?[]:i.ownerFieldWrites.flatMap(e=>{if(e.ownerScoped)return[];if(e.guarded)return[];const t=`\`${e.method}\` in ${o(e)}`,r={...s(e),field:e.field,method:e.method,visibility:e.visibility??"unknown"};return e.adminOnly?[n(a,{cacheKey:`owner_field_from_args_not_auth:${e.file}:${e.line.toString()}:${e.field}`,detail:`${t} sets the ownership field \`${e.field}\` from \`args\`. Expected for a platform-admin procedure: only an admin can reach it, and the admin gate is the trust boundary, not the subject field.`,facing:"INTERNAL",level:"INFO",metadata:r})]:e.visibility==="internal"?[n(a,{cacheKey:`owner_field_from_args_not_auth:${e.file}:${e.line.toString()}:${e.field}`,detail:`${t} sets the ownership field \`${e.field}\` from \`args\`. This is expected for an \`internal\` procedure — no caller can reach it directly, and the trusted caller passes the subject along. Audit the PUBLIC procedures that dispatch to it: if one forwards \`args.${e.field}\` straight through, the IDOR is there.`,facing:"INTERNAL",level:"INFO",metadata:r})]:[n(a,{cacheKey:`owner_field_from_args_not_auth:${e.file}:${e.line.toString()}:${e.field}`,detail:`${t} sets the ownership field \`${e.field}\` from \`args\` instead of the server-trusted identity — any caller can write rows owned by another user/tenant (IDOR). Stamp \`${e.field}\` from \`ctx.auth\`/\`ctx.identity\`, never from request input.`,metadata:r})]}),source:"static",title:"Ownership field written from args, not server identity"};export{a as default};
@@ -1 +1 @@
1
- import{e as n}from"./finding-NrKO8idM.mjs";import{a as i,c as l}from"./helpers-DdZ_pyR3.mjs";const r=3600,s={categories:["SECURITY"],description:"A payment webhook adapter configured with an implausibly wide `webhookToleranceSeconds` (over an hour). The timestamp tolerance is the webhook replay window; widening it far past the 300s default keeps captured signed events replayable long after capture, defeating the replay check.",facing:"EXTERNAL",level:"WARN",name:"payment_webhook_wide_tolerance",remediation:"Keep `webhookToleranceSeconds` at or near the 300s default — just enough for clock skew. If a wide window was set to work around retries or backfills, handle those with idempotency on the event id instead, not by loosening the replay-window guard.",run:t=>{if(t.paymentWebhooks===void 0)return[];const a=e=>e.toleranceSeconds!==void 0&&e.toleranceSeconds>r;return t.paymentWebhooks.filter(e=>a(e)).map(e=>{const o=i(e);return n(s,{cacheKey:`payment_webhook_wide_tolerance:${e.file}:${e.line.toString()}`,detail:`\`${e.callee}\` in ${o} sets \`webhookToleranceSeconds\` to ${(e.toleranceSeconds??0).toString()}s (default 300s). That replay window keeps captured signed events valid long after capture.`,metadata:{callee:e.callee,...l(e),toleranceSeconds:e.toleranceSeconds}})})},source:"static",title:"Payment webhook replay-tolerance window is implausibly wide"};export{s as default};
1
+ import{e as n}from"./finding-NrKO8idM.mjs";import{a as i,c as l}from"./helpers-YAAwOBMH.mjs";const r=3600,s={categories:["SECURITY"],description:"A payment webhook adapter configured with an implausibly wide `webhookToleranceSeconds` (over an hour). The timestamp tolerance is the webhook replay window; widening it far past the 300s default keeps captured signed events replayable long after capture, defeating the replay check.",facing:"EXTERNAL",level:"WARN",name:"payment_webhook_wide_tolerance",remediation:"Keep `webhookToleranceSeconds` at or near the 300s default — just enough for clock skew. If a wide window was set to work around retries or backfills, handle those with idempotency on the event id instead, not by loosening the replay-window guard.",run:t=>{if(t.paymentWebhooks===void 0)return[];const a=e=>e.toleranceSeconds!==void 0&&e.toleranceSeconds>r;return t.paymentWebhooks.filter(e=>a(e)).map(e=>{const o=i(e);return n(s,{cacheKey:`payment_webhook_wide_tolerance:${e.file}:${e.line.toString()}`,detail:`\`${e.callee}\` in ${o} sets \`webhookToleranceSeconds\` to ${(e.toleranceSeconds??0).toString()}s (default 300s). That replay window keeps captured signed events valid long after capture.`,metadata:{callee:e.callee,...l(e),toleranceSeconds:e.toleranceSeconds}})})},source:"static",title:"Payment webhook replay-tolerance window is implausibly wide"};export{s as default};
@@ -0,0 +1 @@
1
+ import{e as s}from"./finding-NrKO8idM.mjs";import{d as i}from"./helpers-YAAwOBMH.mjs";const l={categories:["SECURITY"],description:"An RLS policy is bound to a `table` name that does not exist in the schema. The `rls()` middleware never matches it, so the table the policy was meant to protect is left ungated — reads return unrestricted rows and writes are allowed.",facing:"EXTERNAL",level:"WARN",name:"policy_references_unknown_table",remediation:"Fix the policy's `table` to a real table name (check for a typo or a table that was renamed/removed). If the table is gone, delete the dead policy.",run:a=>{if(a.rlsProcedures===void 0)return[];const r=new Set(a.schema.tables.map(t=>t.name)),o=new Set,n=[];for(const t of a.rlsProcedures)for(const e of t.rlsTables)e===""||r.has(e)||o.has(e)||(o.add(e),n.push(s(l,{cacheKey:`policy_references_unknown_table:${e}`,detail:`An RLS policy in \`${t.exportName}\` (${t.file}) is bound to table \`${e}\`, which is not declared in the schema. The policy never matches, so \`${e}\` — if it exists under another name — is left ungated.`,metadata:{exportName:t.exportName,...i(t),table:e}})));return n},source:"static",title:"RLS policy bound to an unknown table"};export{l as default};
@@ -1 +1 @@
1
- import{s as i}from"./dispatch-namespace-BE_LxN7Z.mjs";import{callSiteMetadata as n}from"./callSiteCallers-DArHfQSU.mjs";import{e as l}from"./finding-NrKO8idM.mjs";import{a as d}from"./helpers-DdZ_pyR3.mjs";const u={categories:["SECURITY"],description:"A `defineQueue`/`defineWorkflow` handler forwards its untrusted payload (queue body / workflow params) straight into a `ctx.run` dispatch whose target is RLS-gated. The handler runs under the system identity with RLS disabled, so the target's row policy — the only thing guarding it — is bypassed, letting a caller act as any user / write across tenants.",facing:"EXTERNAL",level:"ERROR",name:"privileged_dispatch_unvalidated_payload",remediation:"Don't forward an unchecked queue body / workflow param into an RLS-gated function. Re-derive the ownership/identity keys from server-trusted state (or an argument you validate against it) before dispatching, or route the work through a function that re-checks the caller's identity rather than relying on the row policy the privileged handler skips.",run:r=>{if(r.privilegedDispatches===void 0)return[];const s=r.rlsProcedures??[],o=(e,a)=>s.some(t=>t.usesRls&&i(t.file)===i(e)&&t.exportName===a);return r.privilegedDispatches.filter(e=>o(e.targetFile,e.targetExport)).map(e=>{const a=e.dispatchKind==="queue"?"queue":"workflow",t=e.dispatchKind==="queue"?"queue message body":"workflow params";return l(u,{cacheKey:`privileged_dispatch_unvalidated_payload:${e.file}:${e.line.toString()}`,detail:`The ${a} handler ${d(e)} forwards its untrusted ${t} straight into \`${e.targetFile}.${e.targetExport}\`, which is guarded by \`.use(rls(...))\`. The handler runs under the system identity with RLS disabled, so the target's row policy is bypassed — any ownership/identity field the payload controls lets a caller act as another user or write across tenants. Re-derive the identity keys from server-trusted state before dispatching, or route through a function that re-checks the caller.`,metadata:{dispatchKind:e.dispatchKind,file:e.file,...n(e.scope),line:e.line,targetExport:e.targetExport,targetFile:e.targetFile}})})},source:"static",title:"Privileged handler forwards untrusted payload into an RLS-gated function"};export{u as default};
1
+ import{s as i}from"./dispatch-namespace-BE_LxN7Z.mjs";import{callSiteMetadata as n}from"./callSiteCallers-DArHfQSU.mjs";import{e as l}from"./finding-NrKO8idM.mjs";import{a as d}from"./helpers-YAAwOBMH.mjs";const u={categories:["SECURITY"],description:"A `defineQueue`/`defineWorkflow` handler forwards its untrusted payload (queue body / workflow params) straight into a `ctx.run` dispatch whose target is RLS-gated. The handler runs under the system identity with RLS disabled, so the target's row policy — the only thing guarding it — is bypassed, letting a caller act as any user / write across tenants.",facing:"EXTERNAL",level:"ERROR",name:"privileged_dispatch_unvalidated_payload",remediation:"Don't forward an unchecked queue body / workflow param into an RLS-gated function. Re-derive the ownership/identity keys from server-trusted state (or an argument you validate against it) before dispatching, or route the work through a function that re-checks the caller's identity rather than relying on the row policy the privileged handler skips.",run:r=>{if(r.privilegedDispatches===void 0)return[];const s=r.rlsProcedures??[],o=(e,a)=>s.some(t=>t.usesRls&&i(t.file)===i(e)&&t.exportName===a);return r.privilegedDispatches.filter(e=>o(e.targetFile,e.targetExport)).map(e=>{const a=e.dispatchKind==="queue"?"queue":"workflow",t=e.dispatchKind==="queue"?"queue message body":"workflow params";return l(u,{cacheKey:`privileged_dispatch_unvalidated_payload:${e.file}:${e.line.toString()}`,detail:`The ${a} handler ${d(e)} forwards its untrusted ${t} straight into \`${e.targetFile}.${e.targetExport}\`, which is guarded by \`.use(rls(...))\`. The handler runs under the system identity with RLS disabled, so the target's row policy is bypassed — any ownership/identity field the payload controls lets a caller act as another user or write across tenants. Re-derive the identity keys from server-trusted state before dispatching, or route through a function that re-checks the caller.`,metadata:{dispatchKind:e.dispatchKind,file:e.file,...n(e.scope),line:e.line,targetExport:e.targetExport,targetFile:e.targetFile}})})},source:"static",title:"Privileged handler forwards untrusted payload into an RLS-gated function"};export{u as default};
@@ -0,0 +1 @@
1
+ import{e as i}from"./finding-NrKO8idM.mjs";import{m as a}from"./procedure-protections-DRQotu9I.mjs";import{d as r}from"./helpers-YAAwOBMH.mjs";const o={categories:["SECURITY"],description:"A public procedure fans work out to a privileged dispatch surface (`ctx.scheduler.runAfter`/`runAt`, a `ctx.queues.<name>` send, a `ctx.topics.<name>.publish`, or `ctx.workflows.<name>.create`) with no rate-limit guard. Each dispatch runs later under the system identity and bills the account, so an anonymous caller can amplify cost and flood the async surface in a loop.",facing:"EXTERNAL",level:"WARN",name:"privileged_fanout_from_public_procedure",remediation:"Gate the public entry point with a rate limit (`.use(rateLimit(...))` or a `protectPublic({ rateLimit })` bundle), or make the fan-out procedure internal and trigger it only from an authenticated, guarded path. Never expose an unbounded scheduler/queue/topic/workflow dispatch to anonymous callers.",run:t=>t.procedureProtections===void 0?[]:t.procedureProtections.filter(e=>a(e.fanOut)&&e.visibility==="public"&&!e.usesRateLimit).map(e=>i(o,{cacheKey:`privileged_fanout_from_public_procedure:${e.file}:${e.exportName}`,detail:`\`${e.exportName}\` (${e.file}) is public and fans work out to a privileged dispatch surface (scheduler/queue/topic/workflow) with no rate limit — an anonymous caller can drive that billable, system-identity dispatch in a loop. Add a rate-limit guard, or make it internal and trigger it from an authenticated path.`,metadata:{exportName:e.exportName,...r(e),kind:e.kind}})),source:"static",title:"Public procedure fans out to a privileged dispatch surface"};export{o as default};
@@ -0,0 +1 @@
1
+ import{e as i}from"./finding-NrKO8idM.mjs";import{d as a}from"./helpers-YAAwOBMH.mjs";const n={categories:["SCHEMA"],description:"A public `mutation`/`action` emits no structured event. When it fails you get a stack trace with no request context — no ids, no tenant, no outcome — so the failure is visible but not searchable.",facing:"INTERNAL",level:"INFO",name:"procedure_without_structured_event",remediation:'Emit one event on the primary path: `ctx.log.info("<verb>", { … })`, or attach the facts to the request\'s span with `ctx.span.setAttributes({ … })`, and time a step with `ctx.trace("<name>", …)`.',run:e=>e.procedureProtections===void 0?[]:e.procedureProtections.filter(t=>t.visibility==="public"&&t.kind!=="query"&&t.emitsEvent===!1).map(t=>i(n,{cacheKey:`procedure_without_structured_event:${t.file}:${t.exportName}`,detail:`Public ${t.kind} \`${t.exportName}\` (${t.file}) emits no structured event. Add a \`ctx.log\` line or a \`ctx.span\` so a failure carries its request context.`,metadata:{exportName:t.exportName,...a(t),kind:t.kind}})),source:"static",title:"Public write emits no structured event"};export{n as default};
@@ -0,0 +1 @@
1
+ import{e as a}from"./finding-NrKO8idM.mjs";import{f as r,m as s,d as n}from"./helpers-YAAwOBMH.mjs";const o=["contact","forgot","login","logIn","magic","otp","register","reset","signin","signIn","signup","signUp","subscribe","verify"],l={categories:["SECURITY"],description:"A public `mutation`/`action` has no `rateLimit` middleware. Publicly-callable writes are flood and brute-force targets — an attacker can exhaust writes, mail quota, or credits, or guess credentials on auth-shaped endpoints.",facing:"EXTERNAL",level:"WARN",name:"public_mutation_without_ratelimit",remediation:'Attach a rate limit: `.use(rateLimit(limiter, "<bucket>"))` from `@lunora/ratelimit`, or wrap the recommended public-procedure guards with `.use(protectPublic({ rateLimit, captcha }))` from `@lunora/server`. Genuinely-open writes can be acknowledged by adding a permissive limiter.',run:i=>i.procedureProtections===void 0?[]:i.procedureProtections.filter(t=>r(t)&&!t.usesRateLimit).map(t=>{const e=s(t.exportName,o);return a(l,{cacheKey:`public_mutation_without_ratelimit:${t.file}:${t.exportName}`,detail:`Public ${t.kind} \`${t.exportName}\` (${t.file}) has no rate limit${e?" — its name suggests an auth/abuse-sensitive endpoint, so this is high-risk":""}. Add \`.use(rateLimit(...))\` or \`.use(protectPublic({ rateLimit }))\`.`,metadata:{exportName:t.exportName,...n(t),kind:t.kind,sensitive:e}})}),source:"static",title:"Public write without a rate limit"};export{l as default};
@@ -1 +1 @@
1
- import{e as i}from"./finding-NrKO8idM.mjs";import{o as a}from"./helpers-DdZ_pyR3.mjs";const n={categories:["SECURITY"],description:'`.public()` opts a table OUT of the schema\'s `.rls("required")` enforcement — it does not mean the table holds public data. A `.public()` table whose columns look ownership- or PII-shaped (`userId`, `email`, `ssn`, …) is exempt from the row-security guard, not "safe to expose".',facing:"EXTERNAL",level:"WARN",name:"public_table_rls_optout_confusion",remediation:'Double-check this table actually needs the RLS opt-out. If it does not, remove `.public()` so `.rls("required")` covers it like every other table. If it genuinely must stay open (a shared lookup table, for instance), rename or comment it so the exemption is intentional rather than a name-implies-safety mistake, and make sure no procedure trusts `.public()` as an authorization boundary.',run:o=>{if(o.schema.rlsMode!=="required")return[];const s=[];for(const e of o.schema.tables){if(!e.isPublic)continue;const t=a(e);t.length!==0&&s.push(i(n,{cacheKey:`public_table_rls_optout_confusion:${e.name}`,detail:`Table "${e.name}" is \`.public()\` (opted OUT of the schema's \`.rls("required")\` enforcement) but carries ownership/PII-shaped column(s): ${t.join(", ")}. \`.public()\` means "exempt from RLS", not "safe to expose" — confirm this table really needs the opt-out.`,metadata:{columns:t,table:e.name}}))}return s},source:"static",title:"Public table opts out of RLS but carries sensitive columns"};export{n as default};
1
+ import{e as i}from"./finding-NrKO8idM.mjs";import{o as a}from"./helpers-YAAwOBMH.mjs";const n={categories:["SECURITY"],description:'`.public()` opts a table OUT of the schema\'s `.rls("required")` enforcement — it does not mean the table holds public data. A `.public()` table whose columns look ownership- or PII-shaped (`userId`, `email`, `ssn`, …) is exempt from the row-security guard, not "safe to expose".',facing:"EXTERNAL",level:"WARN",name:"public_table_rls_optout_confusion",remediation:'Double-check this table actually needs the RLS opt-out. If it does not, remove `.public()` so `.rls("required")` covers it like every other table. If it genuinely must stay open (a shared lookup table, for instance), rename or comment it so the exemption is intentional rather than a name-implies-safety mistake, and make sure no procedure trusts `.public()` as an authorization boundary.',run:o=>{if(o.schema.rlsMode!=="required")return[];const s=[];for(const e of o.schema.tables){if(!e.isPublic)continue;const t=a(e);t.length!==0&&s.push(i(n,{cacheKey:`public_table_rls_optout_confusion:${e.name}`,detail:`Table "${e.name}" is \`.public()\` (opted OUT of the schema's \`.rls("required")\` enforcement) but carries ownership/PII-shaped column(s): ${t.join(", ")}. \`.public()\` means "exempt from RLS", not "safe to expose" — confirm this table really needs the opt-out.`,metadata:{columns:t,table:e.name}}))}return s},source:"static",title:"Public table opts out of RLS but carries sensitive columns"};export{n as default};
@@ -0,0 +1 @@
1
+ import{e as n}from"./finding-NrKO8idM.mjs";import{d as r}from"./helpers-YAAwOBMH.mjs";const o={categories:["SCHEMA"],description:"A queue consumer drops a message once it exhausts `maxRetries` (default 3) delivery attempts. Without a `deadLetterQueue`, that message is deleted permanently with no record — route exhausted messages to a DLQ so you can inspect, alert on, and replay them.",facing:"INTERNAL",level:"WARN",name:"queue_without_dlq",remediation:'Add `deadLetterQueue: "<name>-dlq"` to the `defineQueue({...})` options and declare a consumer for that queue so exhausted messages are inspectable (an unconsumed DLQ still expires at the retention window). `vis generate lunora-queue` with the best-practice setup scaffolds both. If the queue is fire-and-forget and message loss is acceptable, this advisory can be ignored.',run:t=>{if(t.queues===void 0)return[];const i=new Set(t.queues.map(e=>e.tuning.deadLetterQueue).filter(e=>e!==void 0&&e!=="")),s=[];for(const e of t.queues){const u=e.tuning.deadLetterQueue;if(u!==void 0&&u!==""||i.has(e.name))continue;const a=typeof e.tuning.maxRetries=="number"?e.tuning.maxRetries:3;s.push(n(o,{cacheKey:`queue_without_dlq:${e.exportName}`,detail:`Queue "${e.exportName}" declares no \`deadLetterQueue\`, so a message that exhausts its retries (\`maxRetries\` = ${String(a)}, ~${String(a+1)} delivery attempts) is dropped and permanently lost.`,metadata:{...r({file:e.filePath,line:e.line}),maxRetries:a,mode:e.mode,queue:e.exportName}}))}return s},source:"static",title:"Queue has no dead-letter queue"};export{o as default};
@@ -1 +1 @@
1
- import{e as a}from"./finding-NrKO8idM.mjs";import{c as i,a as r}from"./helpers-DdZ_pyR3.mjs";const l={categories:["SECURITY"],description:"A `rateLimit`/`dbRateLimit` middleware call's `key` selector is derived from the handler's `args` with no server-side scoping, so an attacker can rotate the key on every request (e.g. by resubmitting a different email/id) and never share a bucket with themselves — the limit never actually limits them.",facing:"EXTERNAL",level:"WARN",name:"ratelimit_key_spoofable_or_global",remediation:'Derive the rate-limit `key` from a server-trusted value — `ctx.auth.userId` for authenticated callers, `ctx.ip` for anonymous ones (e.g. `key: (ctx) => ctx.auth.userId ?? ctx.ip ?? "anon"`) — instead of an `args` field the caller controls.',run:t=>t.ratelimitKeySelectors===void 0?[]:t.ratelimitKeySelectors.map(e=>a(l,{cacheKey:`ratelimit_key_spoofable_or_global:${e.file}:${e.line.toString()}`,detail:`\`${e.callee}(…, "${e.limitName}", { key })\` in ${r(e)} derives its \`key\` from \`args\` with no server-side scoping — an attacker can rotate the key per request and bypass the limit. Derive \`key\` from \`ctx.auth.userId\` / \`ctx.ip\` instead.`,metadata:{callee:e.callee,...i(e),limitName:e.limitName}})),source:"static",title:"Rate-limit key derived from spoofable user input"};export{l as default};
1
+ import{e as a}from"./finding-NrKO8idM.mjs";import{c as i,a as r}from"./helpers-YAAwOBMH.mjs";const l={categories:["SECURITY"],description:"A `rateLimit`/`dbRateLimit` middleware call's `key` selector is derived from the handler's `args` with no server-side scoping, so an attacker can rotate the key on every request (e.g. by resubmitting a different email/id) and never share a bucket with themselves — the limit never actually limits them.",facing:"EXTERNAL",level:"WARN",name:"ratelimit_key_spoofable_or_global",remediation:'Derive the rate-limit `key` from a server-trusted value — `ctx.auth.userId` for authenticated callers, `ctx.ip` for anonymous ones (e.g. `key: (ctx) => ctx.auth.userId ?? ctx.ip ?? "anon"`) — instead of an `args` field the caller controls.',run:t=>t.ratelimitKeySelectors===void 0?[]:t.ratelimitKeySelectors.map(e=>a(l,{cacheKey:`ratelimit_key_spoofable_or_global:${e.file}:${e.line.toString()}`,detail:`\`${e.callee}(…, "${e.limitName}", { key })\` in ${r(e)} derives its \`key\` from \`args\` with no server-side scoping — an attacker can rotate the key per request and bypass the limit. Derive \`key\` from \`ctx.auth.userId\` / \`ctx.ip\` instead.`,metadata:{callee:e.callee,...i(e),limitName:e.limitName}})),source:"static",title:"Rate-limit key derived from spoofable user input"};export{l as default};
@@ -1 +1 @@
1
- import{callSiteLabel as r,callSiteCallers as l}from"./callSiteCallers-DArHfQSU.mjs";import{e as n}from"./finding-NrKO8idM.mjs";import{c as s,a as o,m as t}from"./helpers-DdZ_pyR3.mjs";const a=["signin","signIn","signup","signUp","login","logIn","register","reset","password","otp","verify","payment","checkout"],m=i=>[r(i.scope),...l(i.scope)].some(e=>t(e,a))||t(i.limitName,a),u={categories:["SECURITY"],description:"A rate-limit or Turnstile middleware guarding a sensitive auth/payment procedure is configured `failOpen: true`, so a limiter store outage or a failed Turnstile siteverify silently admits every request — turning a transient failure into an unthrottled brute-force / abuse window.",facing:"EXTERNAL",level:"WARN",name:"ratelimit_middleware_fail_open",remediation:"Drop `failOpen: true` (the default is fail-closed) on the rate-limit / Turnstile guard for auth and payment flows, or move the escape hatch to a non-sensitive procedure. Prefer rejecting traffic with a 503 over admitting unlimited unauthenticated attempts when the limiter or siteverify is unavailable.",run:i=>i.failOpenGuards===void 0?[]:i.failOpenGuards.filter(e=>e.failOpen&&m(e)).map(e=>n(u,{cacheKey:`ratelimit_middleware_fail_open:${e.file}:${e.line.toString()}`,detail:`\`${e.callee}(...)\` in ${o(e)} sets \`failOpen: true\` while guarding a sensitive flow — a limiter/siteverify outage then admits every request instead of rejecting it.`,metadata:{callee:e.callee,...s(e),limitName:e.limitName}})),source:"static",title:"Fail-open rate-limit / CAPTCHA guard on a sensitive procedure"};export{u as default};
1
+ import{callSiteLabel as r,callSiteCallers as l}from"./callSiteCallers-DArHfQSU.mjs";import{e as n}from"./finding-NrKO8idM.mjs";import{c as s,a as o,m as t}from"./helpers-YAAwOBMH.mjs";const a=["signin","signIn","signup","signUp","login","logIn","register","reset","password","otp","verify","payment","checkout"],m=i=>[r(i.scope),...l(i.scope)].some(e=>t(e,a))||t(i.limitName,a),u={categories:["SECURITY"],description:"A rate-limit or Turnstile middleware guarding a sensitive auth/payment procedure is configured `failOpen: true`, so a limiter store outage or a failed Turnstile siteverify silently admits every request — turning a transient failure into an unthrottled brute-force / abuse window.",facing:"EXTERNAL",level:"WARN",name:"ratelimit_middleware_fail_open",remediation:"Drop `failOpen: true` (the default is fail-closed) on the rate-limit / Turnstile guard for auth and payment flows, or move the escape hatch to a non-sensitive procedure. Prefer rejecting traffic with a 503 over admitting unlimited unauthenticated attempts when the limiter or siteverify is unavailable.",run:i=>i.failOpenGuards===void 0?[]:i.failOpenGuards.filter(e=>e.failOpen&&m(e)).map(e=>n(u,{cacheKey:`ratelimit_middleware_fail_open:${e.file}:${e.line.toString()}`,detail:`\`${e.callee}(...)\` in ${o(e)} sets \`failOpen: true\` while guarding a sensitive flow — a limiter/siteverify outage then admits every request instead of rejecting it.`,metadata:{callee:e.callee,...s(e),limitName:e.limitName}})),source:"static",title:"Fail-open rate-limit / CAPTCHA guard on a sensitive procedure"};export{u as default};
@@ -1 +1 @@
1
- import{e as m}from"./finding-NrKO8idM.mjs";import{t as d}from"./helpers-DdZ_pyR3.mjs";const u=(o,r,a,n)=>{if(n.through!==void 0){const c=o.get(n.through.table);return c===void 0?[]:[n.through.from,n.through.to].filter(f=>!r(c).has(f)).map(f=>({column:f,owner:c.name,side:"field"}))}const e=o.get(n.table);if(!e)return[];const s=n.kind==="one"?a:e,t=n.kind==="one"?e:a,i=[];return r(s).has(n.field)||i.push({column:n.field,owner:s.name,side:"field"}),r(t).has(n.references)||i.push({column:n.references,owner:t.name,side:"references"}),i},l={categories:["SCHEMA"],description:"A relation references a foreign-key or referenced column that is not declared on its table, so the join can never resolve.",facing:"INTERNAL",level:"ERROR",name:"relation_references_unknown_field",remediation:"Fix the `field` / `references` column name in the relation, or add the missing column.",run:o=>{const r=new Map(o.schema.tables.map(e=>[e.name,e])),a=new Map,n=e=>{let s=a.get(e);return s||(s=d(e),a.set(e,s)),s};return o.schema.tables.flatMap(e=>e.relations.flatMap(s=>u(r,n,e,s).map(t=>m(l,{cacheKey:`relation_references_unknown_field:${e.name}:${s.name}:${t.side}`,detail:`Relation "${s.name}" on table "${e.name}" uses ${t.side} "${t.column}", which is not declared on table "${t.owner}".`,metadata:{column:t.column,owner:t.owner,relation:s.name,side:t.side,table:e.name}}))))},source:"static",title:"Relation references unknown field"};export{l as default};
1
+ import{e as m}from"./finding-NrKO8idM.mjs";import{t as d}from"./helpers-YAAwOBMH.mjs";const u=(o,r,a,n)=>{if(n.through!==void 0){const c=o.get(n.through.table);return c===void 0?[]:[n.through.from,n.through.to].filter(f=>!r(c).has(f)).map(f=>({column:f,owner:c.name,side:"field"}))}const e=o.get(n.table);if(!e)return[];const s=n.kind==="one"?a:e,t=n.kind==="one"?e:a,i=[];return r(s).has(n.field)||i.push({column:n.field,owner:s.name,side:"field"}),r(t).has(n.references)||i.push({column:n.references,owner:t.name,side:"references"}),i},l={categories:["SCHEMA"],description:"A relation references a foreign-key or referenced column that is not declared on its table, so the join can never resolve.",facing:"INTERNAL",level:"ERROR",name:"relation_references_unknown_field",remediation:"Fix the `field` / `references` column name in the relation, or add the missing column.",run:o=>{const r=new Map(o.schema.tables.map(e=>[e.name,e])),a=new Map,n=e=>{let s=a.get(e);return s||(s=d(e),a.set(e,s)),s};return o.schema.tables.flatMap(e=>e.relations.flatMap(s=>u(r,n,e,s).map(t=>m(l,{cacheKey:`relation_references_unknown_field:${e.name}:${s.name}:${t.side}`,detail:`Relation "${s.name}" on table "${e.name}" uses ${t.side} "${t.column}", which is not declared on table "${t.owner}".`,metadata:{column:t.column,owner:t.owner,relation:s.name,side:t.side,table:e.name}}))))},source:"static",title:"Relation references unknown field"};export{l as default};
@@ -0,0 +1 @@
1
+ import{e as a}from"./finding-NrKO8idM.mjs";import{d as l}from"./helpers-YAAwOBMH.mjs";const n={categories:["SECURITY"],description:"A public procedure reads or writes a table that is covered by an RLS policy elsewhere in the app, but this procedure's builder chain does not include `.use(rls(...))`. The raw, unwrapped `ctx.db` silently bypasses every policy in the list.",facing:"EXTERNAL",level:"WARN",name:"rls_uncovered_table",remediation:"Add `.use(rls(policies))` to the procedure's builder chain — e.g. `c.use(rls(myPolicies)).query(...)` — so its `ctx.db` is wrapped by the same policy evaluator as the rest of the app. If this procedure is intentionally privileged (e.g. a background job), declare it with `internalQuery` / `internalMutation` / `internalAction` instead of the public builder so the intent is explicit.",run:r=>{if(r.rlsProcedures===void 0)return[];const s=new Set;for(const e of r.rlsProcedures)for(const i of e.rlsTables)i!==""&&s.add(i);if(s.size===0)return[];const o=[];for(const e of r.rlsProcedures){if(e.usesRls||e.visibility==="internal")continue;const i=new Set;for(const t of[...e.tablesRead,...e.tablesWritten])t!==""&&s.has(t)&&i.add(t);for(const t of i)o.push(a(n,{cacheKey:`rls_uncovered_table:${e.file}:${e.exportName}:${t}`,detail:`\`${e.exportName}\` in ${e.file} accesses table \`${t}\` without \`.use(rls(...))\` — the table is policy-gated elsewhere in the app but this procedure bypasses those policies entirely.`,metadata:{exportName:e.exportName,...l(e),table:t}}))}return o},source:"static",title:"RLS-gated table accessed without rls() middleware"};export{n as default};
@@ -0,0 +1 @@
1
+ import{callSiteCallers as l}from"./callSiteCallers-DArHfQSU.mjs";import{e as c}from"./finding-NrKO8idM.mjs";import{r as d,g as u,h}from"./helpers-YAAwOBMH.mjs";const f=1e3,p=6e4,m=new Set(["patch","patchIf","patchMany","patchWhere"]),w=e=>new Map([...e].map(([n,o])=>[n,o.filter(t=>!m.has(t.method))])),g=/^(?:continue|next|page)?_?cursor$/iu,v=e=>{if(!(e.kind!=="schedule"||e.conditional!==!0||e.target===void 0||e.scope.kind!=="export"))return e.target===u(e.file,e.scope.name)?e.scope.name:void 0},y=e=>{const n=e.schedule?.delayMs,o=e.schedule?.argKeys;if(!(n===void 0||n>=p||o===void 0||o.some(t=>g.test(t))))return n},R=(e,n,o)=>e.some(t=>t.kind==="call"&&t.file===n&&t.scope.kind==="export"&&t.scope.name===o),E=(e,n,o,t)=>{const s=(e.queries??[]).filter(r=>r.file===n&&r.table!==""&&l(r.scope).includes(o));return s.length===0||s.some(r=>h(t,r,void 0,[o]))},S={categories:["PERFORMANCE"],description:"A function re-arms itself with `ctx.scheduler.runAfter` on a delay under a minute, and the re-arming passes no cursor and nothing in the function removes the rows it reads. Each run finds the same rows and does the same work again; a delay under a second is a spin, and a longer one is a poll that rewrites a row on every tick.",facing:"EXTERNAL",level:"WARN",name:"self_reschedule_without_progress",remediation:"Carry the progress forward: pass a cursor (or the last processed id) in the dispatch args, or delete or update the rows the function handled so the next run selects only what is left. Re-arm only while work remains, and use a longer delay or a `cron` for periodic work.",run:e=>{if(e.callEdges===void 0)return[];const{callEdges:n}=e,o=d(e.tableWrites,e.rowEffects),t=[];for(const s of n){const r=v(s),i=y(s);if(r===void 0||i===void 0)continue;const a=i>=f;R(n,s.file,r)||E(e,s.file,r,a?w(o):o)||t.push(c(S,{cacheKey:`self_reschedule_without_progress:${s.file}:${s.line.toString()}:${r}`,detail:a?`\`${r}\` (${s.file}:${s.line.toString()}) polls itself every ${i.toString()} ms with no cursor in its args, and it removes none of the rows it reads. Each tick re-reads the same rows and rewrites in place, and each run is billed.`:`\`${r}\` (${s.file}:${s.line.toString()}) re-arms itself after ${i.toString()} ms with no cursor in its args, and it removes none of the rows it reads. The next run finds the same rows and starts the same work again.`,level:a?"INFO":"WARN",metadata:{delayMs:i,file:s.file,function:r,line:s.line,tier:a?"poll":"spin"}}))}return t},source:"static",title:"Self-reschedule without progress"};export{S as default};
@@ -0,0 +1 @@
1
+ import{e as l}from"./finding-NrKO8idM.mjs";import{d as r}from"./helpers-YAAwOBMH.mjs";const s={categories:["PERFORMANCE"],description:"A `defineShape` replicates from a `.global()` table. Global tables live outside the shard DO's SQLite op-log, so the shape is served through the cross-shard tier — coordinator/poll-refreshed and latency-tiered, not poke-live like a sharded shape.",facing:"EXTERNAL",level:"WARN",name:"shape_targets_global_table",remediation:"Expected if you want the cross-shard tier — just don't assume poke-live freshness; global shapes refresh on a poll. For live updates, replicate from a sharded table instead (denormalize the columns you need into the shard).",run:a=>{if(a.shapes===void 0)return[];const t=new Set(a.schema.tables.filter(e=>e.shardKind==="global").map(e=>e.name));return a.shapes.filter(e=>e.table!==void 0&&t.has(e.table)).map(e=>l(s,{cacheKey:`shape_targets_global_table:${e.exportName}`,detail:`Shape \`${e.exportName}\` (${e.file}) replicates from the \`.global()\` table \`${e.table}\`. It is served through the cross-shard global tier — poll-refreshed and latency-tiered, not poke-live.`,metadata:{exportName:e.exportName,...r(e),table:e.table}}))},source:"static",title:"Shape replicates from a global (cross-shard) table"};export{s as default};
@@ -0,0 +1 @@
1
+ import{e as n}from"./finding-NrKO8idM.mjs";import{d as o}from"./helpers-YAAwOBMH.mjs";const r={categories:["SCHEMA"],description:"A `defineShape` is bound to a `table` name that does not exist in the schema. The shape can never resolve a rowset — its subscription seeds empty and errors at the first flush.",facing:"INTERNAL",level:"ERROR",name:"shape_unknown_table",remediation:"Fix the shape's `table` to a real table name (check for a typo or a table that was renamed/removed).",run:a=>{if(a.shapes===void 0)return[];const t=new Set(a.schema.tables.map(e=>e.name));return a.shapes.filter(e=>e.table!==void 0&&!t.has(e.table)).map(e=>n(r,{cacheKey:`shape_unknown_table:${e.exportName}`,detail:`Shape \`${e.exportName}\` (${e.file}) replicates from table \`${e.table}\`, which is not declared in the schema. The shape can never resolve a rowset.`,metadata:{exportName:e.exportName,...o(e),table:e.table}}))},source:"static",title:"Shape bound to an unknown table"};export{r as default};
@@ -0,0 +1 @@
1
+ import{e as s}from"./finding-NrKO8idM.mjs";import{m as i}from"./procedure-protections-DRQotu9I.mjs";import{f as o,d as r}from"./helpers-YAAwOBMH.mjs";const n={categories:["SECURITY"],description:"A public `mutation`/`action` that creates a user/session/account row has no disposable-email gate. Throwaway mailboxes farm free trials, evade bans, and pollute the user table.",facing:"EXTERNAL",level:"WARN",name:"signup_mutation_without_disposable_gating",remediation:"Add `.use(emailGateMiddleware({ email: (ctx) => ctx.args.email }))` from `@lunora/auth/email-guard` to reject disposable domains at signup, or gate better-auth's native signup with `withEmailGate(...)` / `emailGateDatabaseHooks(...)`.",run:a=>{if(a.procedureProtections===void 0)return[];const t=[];for(const e of a.procedureProtections)!o(e)||!i(e.writesUserTable)||e.usesEmailGate||i(e.hasEmailArg)&&e.hasEmailArg!==!1&&t.push(s(n,{cacheKey:`signup_mutation_without_disposable_gating:${e.file}:${e.exportName}`,detail:`Public ${e.kind} \`${e.exportName}\` (${e.file}) writes a user/session/account table but has no disposable-email gate. Add \`.use(emailGateMiddleware(...))\` from \`@lunora/auth/email-guard\`.`,metadata:{exportName:e.exportName,...r(e),kind:e.kind,writesUserTable:e.writesUserTable}}));return t},source:"static",title:"Account-creating write without a disposable-email gate"};export{n as default};
@@ -1 +1 @@
1
- import{e as s}from"./finding-NrKO8idM.mjs";import{c as i,a}from"./helpers-DdZ_pyR3.mjs";const n={categories:["SECURITY"],description:"A `ctx.sql.query(text, params)` / `ctx.sql.unsafe(text, params)` call builds its SQL `text` from non-constant values. The driver binds only `params` and runs `text` verbatim, so request input in the text reopens SQL injection.",facing:"EXTERNAL",level:"ERROR",name:"sql_injection_risk",remediation:"Keep the SQL text constant and pass every value through the `params` array (`$1`, `$2`, …) so the driver binds it. Never build SQL text from request input.",run:e=>e.sqlInterpolations===void 0?[]:e.sqlInterpolations.map(t=>s(n,{cacheKey:`sql_injection_risk:${t.file}:${t.line.toString()}`,detail:`\`ctx.sql\` in ${a(t)} builds its SQL text from a non-constant value instead of passing it in \`params\` — a SQL-injection vector. Keep the text constant and bind the value through \`params\`.`,metadata:{...i(t)}})),source:"static",title:"Possible SQL injection in ctx.sql text"};export{n as default};
1
+ import{e as s}from"./finding-NrKO8idM.mjs";import{c as i,a}from"./helpers-YAAwOBMH.mjs";const n={categories:["SECURITY"],description:"A `ctx.sql.query(text, params)` / `ctx.sql.unsafe(text, params)` call builds its SQL `text` from non-constant values. The driver binds only `params` and runs `text` verbatim, so request input in the text reopens SQL injection.",facing:"EXTERNAL",level:"ERROR",name:"sql_injection_risk",remediation:"Keep the SQL text constant and pass every value through the `params` array (`$1`, `$2`, …) so the driver binds it. Never build SQL text from request input.",run:e=>e.sqlInterpolations===void 0?[]:e.sqlInterpolations.map(t=>s(n,{cacheKey:`sql_injection_risk:${t.file}:${t.line.toString()}`,detail:`\`ctx.sql\` in ${a(t)} builds its SQL text from a non-constant value instead of passing it in \`params\` — a SQL-injection vector. Keep the text constant and bind the value through \`params\`.`,metadata:{...i(t)}})),source:"static",title:"Possible SQL injection in ctx.sql text"};export{n as default};
@@ -1 +1 @@
1
- import{e as n}from"./finding-NrKO8idM.mjs";import{c as o,a}from"./helpers-DdZ_pyR3.mjs";const r={categories:["SECURITY"],description:"A `ctx.storage.generateUploadUrl(key, …)` call has no `contentType` pin, so the signed PUT URL it mints declares no expected content-type for the serving route to check — `upload()`'s `allowedContentTypes`/`maxSize` guards never run for a client-side PUT against this URL.",facing:"EXTERNAL",level:"WARN",name:"storage_generate_upload_url_no_content_type_pin",remediation:"Pass `contentType` to `ctx.storage.generateUploadUrl(key, { contentType })` so the signature is scoped to that content-type, and have your PUT route reject a request whose `Content-Type` differs from `verifySignedUrl`'s returned `contentType` — the pin is bound into the signature, but nothing in `@lunora/storage` compares it to the upload for you. If the size also needs bounding, prefer `upload()`/`store()` (with `allowedContentTypes`/`maxSize`) over a client-side signed PUT.",run:t=>t.storageUploads===void 0?[]:t.storageUploads.filter(e=>e.method==="generateUploadUrl"&&e.analyzable&&!e.presentKeys.includes("contentType")).map(e=>n(r,{cacheKey:`storage_generate_upload_url_no_content_type_pin:${e.file}:${e.line.toString()}`,detail:`\`ctx.storage.generateUploadUrl\` in ${a(e)} has no \`contentType\` pin — the signed PUT it mints declares no expected type for the serving route to check, and bypasses \`upload()\`'s \`allowedContentTypes\`/\`maxSize\` guards.`,metadata:{...o(e)}})),source:"static",title:"generateUploadUrl signed PUT with no content-type pin"};export{r as default};
1
+ import{e as n}from"./finding-NrKO8idM.mjs";import{c as o,a}from"./helpers-YAAwOBMH.mjs";const r={categories:["SECURITY"],description:"A `ctx.storage.generateUploadUrl(key, …)` call has no `contentType` pin, so the signed PUT URL it mints declares no expected content-type for the serving route to check — `upload()`'s `allowedContentTypes`/`maxSize` guards never run for a client-side PUT against this URL.",facing:"EXTERNAL",level:"WARN",name:"storage_generate_upload_url_no_content_type_pin",remediation:"Pass `contentType` to `ctx.storage.generateUploadUrl(key, { contentType })` so the signature is scoped to that content-type, and have your PUT route reject a request whose `Content-Type` differs from `verifySignedUrl`'s returned `contentType` — the pin is bound into the signature, but nothing in `@lunora/storage` compares it to the upload for you. If the size also needs bounding, prefer `upload()`/`store()` (with `allowedContentTypes`/`maxSize`) over a client-side signed PUT.",run:t=>t.storageUploads===void 0?[]:t.storageUploads.filter(e=>e.method==="generateUploadUrl"&&e.analyzable&&!e.presentKeys.includes("contentType")).map(e=>n(r,{cacheKey:`storage_generate_upload_url_no_content_type_pin:${e.file}:${e.line.toString()}`,detail:`\`ctx.storage.generateUploadUrl\` in ${a(e)} has no \`contentType\` pin — the signed PUT it mints declares no expected type for the serving route to check, and bypasses \`upload()\`'s \`allowedContentTypes\`/\`maxSize\` guards.`,metadata:{...o(e)}})),source:"static",title:"generateUploadUrl signed PUT with no content-type pin"};export{r as default};
@@ -1 +1 @@
1
- import{e as i}from"./finding-NrKO8idM.mjs";import{a,c as n}from"./helpers-DdZ_pyR3.mjs";const s={categories:["SECURITY"],description:"A `ctx.storage.*` call uses an R2 object key taken directly from the handler's `args` with no server-side scoping. The bucket methods key by the caller-supplied string, so any caller can read, overwrite, or delete another user's object — object-level IDOR.",facing:"EXTERNAL",level:"ERROR",name:"storage_key_from_user_args",remediation:"Prefix the object key with a server-trusted identity (e.g. `${ctx.auth.userId}/…`) or resolve the object through a record the caller is known to own. Never pass request input straight through as an R2 object key.",run:r=>r.storageKeyAccesses===void 0?[]:r.storageKeyAccesses.map(e=>{const t=`\`ctx.storage.*.${e.method}\` in ${a(e)}`,o={...n(e),method:e.method,visibility:e.visibility??"unknown"};return e.visibility==="internal"?i(s,{cacheKey:`storage_key_from_user_args:${e.file}:${e.line.toString()}`,detail:`${t} uses an object key derived from \`args\` with no server-side scoping. This is expected for an \`internal\` procedure — no caller can reach it directly, so the key is only ever supplied by trusted server code. Audit the PUBLIC procedures that dispatch to it: if one forwards \`args\` straight through, the IDOR is there.`,facing:"INTERNAL",level:"INFO",metadata:o}):i(s,{cacheKey:`storage_key_from_user_args:${e.file}:${e.line.toString()}`,detail:`${t} uses an object key derived from \`args\` with no server-side scoping — any caller can read/overwrite/delete another user's object (IDOR). Prefix the key with a server-trusted identity (e.g. \`\${ctx.auth.userId}/…\`) or resolve the object through an owned record.`,metadata:o})}),source:"static",title:"R2 object key taken directly from user args (IDOR)"};export{s as default};
1
+ import{e as i}from"./finding-NrKO8idM.mjs";import{a,c as n}from"./helpers-YAAwOBMH.mjs";const s={categories:["SECURITY"],description:"A `ctx.storage.*` call uses an R2 object key taken directly from the handler's `args` with no server-side scoping. The bucket methods key by the caller-supplied string, so any caller can read, overwrite, or delete another user's object — object-level IDOR.",facing:"EXTERNAL",level:"ERROR",name:"storage_key_from_user_args",remediation:"Prefix the object key with a server-trusted identity (e.g. `${ctx.auth.userId}/…`) or resolve the object through a record the caller is known to own. Never pass request input straight through as an R2 object key.",run:r=>r.storageKeyAccesses===void 0?[]:r.storageKeyAccesses.map(e=>{const t=`\`ctx.storage.*.${e.method}\` in ${a(e)}`,o={...n(e),method:e.method,visibility:e.visibility??"unknown"};return e.visibility==="internal"?i(s,{cacheKey:`storage_key_from_user_args:${e.file}:${e.line.toString()}`,detail:`${t} uses an object key derived from \`args\` with no server-side scoping. This is expected for an \`internal\` procedure — no caller can reach it directly, so the key is only ever supplied by trusted server code. Audit the PUBLIC procedures that dispatch to it: if one forwards \`args\` straight through, the IDOR is there.`,facing:"INTERNAL",level:"INFO",metadata:o}):i(s,{cacheKey:`storage_key_from_user_args:${e.file}:${e.line.toString()}`,detail:`${t} uses an object key derived from \`args\` with no server-side scoping — any caller can read/overwrite/delete another user's object (IDOR). Prefix the key with a server-trusted identity (e.g. \`\${ctx.auth.userId}/…\`) or resolve the object through an owned record.`,metadata:o})}),source:"static",title:"R2 object key taken directly from user args (IDOR)"};export{s as default};
@@ -1 +1 @@
1
- import{e as l}from"./finding-NrKO8idM.mjs";import{a as g,c as d}from"./helpers-DdZ_pyR3.mjs";const c=new Set(["getPresignedUrl","getSignedUrl"]),h=8640*60,s=t=>t.method==="getPresignedUrl",a=t=>c.has(t.method)&&t.expiresInSeconds!==void 0&&t.expiresInSeconds>=h,S={categories:["SECURITY"],description:"`ctx.storage.getPresignedUrl(...)` mints a native S3 SigV4 URL that resolves directly against R2, so the request never reaches the Worker and cannot be gated at all — the wrong choice for private or policy-gated content. Either signer minting an `expiresInSeconds` near the shared 7-day ceiling also hands out a long-lived bearer credential.",facing:"EXTERNAL",level:"WARN",name:"storage_presigned_url_for_private_content",remediation:"For private/per-user/policy-gated content, use `getSignedUrl` instead of `getPresignedUrl`: it mints the URL at your own `publicBaseUrl` origin, so the request reaches a route you control. You still have to write that route — validate the URL with `verifySignedUrl` and run your auth/policy/rate-limit checks there; the framework ships no serving handler. On either signer, keep `expiresInSeconds` as short as the use case allows — well under the 7-day ceiling — rather than minting a near-maximum-lifetime URL.",run:t=>t.storageUploads===void 0?[]:t.storageUploads.filter(e=>s(e)||a(e)).map(e=>{const r=s(e),o=a(e),i=g(e);let n;return r&&o?n=`\`ctx.storage.getPresignedUrl\` in ${i} mints a native S3 SigV4 URL — resolves straight off R2, so the request never reaches the Worker to be gated — with an \`expiresInSeconds\` of ${(e.expiresInSeconds??0).toString()}s, near the 7-day signing ceiling.`:r?n=`\`ctx.storage.getPresignedUrl\` in ${i} mints a native S3 SigV4 URL that resolves directly against R2, so the request never reaches the Worker and cannot be gated. Use \`getSignedUrl\` and serve it from a route that calls \`verifySignedUrl\` and runs your checks.`:n=`\`ctx.storage.${e.method}\` in ${i} requests an \`expiresInSeconds\` of ${(e.expiresInSeconds??0).toString()}s, near the 7-day signing ceiling — a leaked link stays valid for almost a week.`,l(S,{cacheKey:`storage_presigned_url_for_private_content:${e.file}:${e.line.toString()}`,detail:n,metadata:{expiresInSeconds:e.expiresInSeconds,...d(e),method:e.method}})}),source:"static",title:"Native presigned URL or near-max-TTL signed URL for private content"};export{S as default};
1
+ import{e as l}from"./finding-NrKO8idM.mjs";import{a as g,c as d}from"./helpers-YAAwOBMH.mjs";const c=new Set(["getPresignedUrl","getSignedUrl"]),h=8640*60,s=t=>t.method==="getPresignedUrl",a=t=>c.has(t.method)&&t.expiresInSeconds!==void 0&&t.expiresInSeconds>=h,S={categories:["SECURITY"],description:"`ctx.storage.getPresignedUrl(...)` mints a native S3 SigV4 URL that resolves directly against R2, so the request never reaches the Worker and cannot be gated at all — the wrong choice for private or policy-gated content. Either signer minting an `expiresInSeconds` near the shared 7-day ceiling also hands out a long-lived bearer credential.",facing:"EXTERNAL",level:"WARN",name:"storage_presigned_url_for_private_content",remediation:"For private/per-user/policy-gated content, use `getSignedUrl` instead of `getPresignedUrl`: it mints the URL at your own `publicBaseUrl` origin, so the request reaches a route you control. You still have to write that route — validate the URL with `verifySignedUrl` and run your auth/policy/rate-limit checks there; the framework ships no serving handler. On either signer, keep `expiresInSeconds` as short as the use case allows — well under the 7-day ceiling — rather than minting a near-maximum-lifetime URL.",run:t=>t.storageUploads===void 0?[]:t.storageUploads.filter(e=>s(e)||a(e)).map(e=>{const r=s(e),o=a(e),i=g(e);let n;return r&&o?n=`\`ctx.storage.getPresignedUrl\` in ${i} mints a native S3 SigV4 URL — resolves straight off R2, so the request never reaches the Worker to be gated — with an \`expiresInSeconds\` of ${(e.expiresInSeconds??0).toString()}s, near the 7-day signing ceiling.`:r?n=`\`ctx.storage.getPresignedUrl\` in ${i} mints a native S3 SigV4 URL that resolves directly against R2, so the request never reaches the Worker and cannot be gated. Use \`getSignedUrl\` and serve it from a route that calls \`verifySignedUrl\` and runs your checks.`:n=`\`ctx.storage.${e.method}\` in ${i} requests an \`expiresInSeconds\` of ${(e.expiresInSeconds??0).toString()}s, near the 7-day signing ceiling — a leaked link stays valid for almost a week.`,l(S,{cacheKey:`storage_presigned_url_for_private_content:${e.file}:${e.line.toString()}`,detail:n,metadata:{expiresInSeconds:e.expiresInSeconds,...d(e),method:e.method}})}),source:"static",title:"Native presigned URL or near-max-TTL signed URL for private content"};export{S as default};
@@ -1 +1 @@
1
- import{e as a}from"./finding-NrKO8idM.mjs";import{c as o,a as l}from"./helpers-DdZ_pyR3.mjs";const s=new Set(["store","upload"]),n={categories:["SECURITY"],description:"A `ctx.storage.upload`/`store` call has no `allowedContentTypes` allowlist, so an uploader can store any content-type — including `text/html` or `image/svg+xml` — which, served back from `publicBaseUrl`, is a stored-XSS vector against your own origin.",facing:"EXTERNAL",level:"WARN",name:"storage_upload_without_content_type_allowlist",remediation:'Pass `allowedContentTypes: ["image/png", "image/jpeg", …]` to `ctx.storage.upload`/`store` so an uploaded object\'s `contentType` must match an approved list. Reject anything HTML/SVG/script-executable unless the app genuinely needs to serve it.',run:t=>t.storageUploads===void 0?[]:t.storageUploads.filter(e=>s.has(e.method)&&e.analyzable&&!e.presentKeys.includes("allowedContentTypes")).map(e=>a(n,{cacheKey:`storage_upload_without_content_type_allowlist:${e.file}:${e.line.toString()}`,detail:`\`ctx.storage.${e.method}\` in ${l(e)} has no \`allowedContentTypes\` allowlist — any content-type is accepted, including \`text/html\`/\`image/svg+xml\`, a stored-XSS risk if the object is served from \`publicBaseUrl\`.`,metadata:{...o(e),method:e.method}})),source:"static",title:"Storage upload with no content-type allowlist"};export{n as default};
1
+ import{e as a}from"./finding-NrKO8idM.mjs";import{c as o,a as l}from"./helpers-YAAwOBMH.mjs";const s=new Set(["store","upload"]),n={categories:["SECURITY"],description:"A `ctx.storage.upload`/`store` call has no `allowedContentTypes` allowlist, so an uploader can store any content-type — including `text/html` or `image/svg+xml` — which, served back from `publicBaseUrl`, is a stored-XSS vector against your own origin.",facing:"EXTERNAL",level:"WARN",name:"storage_upload_without_content_type_allowlist",remediation:'Pass `allowedContentTypes: ["image/png", "image/jpeg", …]` to `ctx.storage.upload`/`store` so an uploaded object\'s `contentType` must match an approved list. Reject anything HTML/SVG/script-executable unless the app genuinely needs to serve it.',run:t=>t.storageUploads===void 0?[]:t.storageUploads.filter(e=>s.has(e.method)&&e.analyzable&&!e.presentKeys.includes("allowedContentTypes")).map(e=>a(n,{cacheKey:`storage_upload_without_content_type_allowlist:${e.file}:${e.line.toString()}`,detail:`\`ctx.storage.${e.method}\` in ${l(e)} has no \`allowedContentTypes\` allowlist — any content-type is accepted, including \`text/html\`/\`image/svg+xml\`, a stored-XSS risk if the object is served from \`publicBaseUrl\`.`,metadata:{...o(e),method:e.method}})),source:"static",title:"Storage upload with no content-type allowlist"};export{n as default};
@@ -1 +1 @@
1
- import{e as t}from"./finding-NrKO8idM.mjs";import{c as o,a as i}from"./helpers-DdZ_pyR3.mjs";const s=new Set(["store","upload"]),r={categories:["SECURITY"],description:"A `ctx.storage.upload`/`store` call has no `maxSize` cap, so a caller can push an unbounded body straight into R2 through the Worker — unbounded storage/billing exhaustion, and for a streamed body, unbounded worker time.",facing:"EXTERNAL",level:"WARN",name:"storage_upload_without_max_size",remediation:"Pass a `maxSize` (bytes) to `ctx.storage.upload`/`store` sized to the largest legitimate object the app accepts. `ArrayBuffer`/`Blob` bodies are rejected up front when oversized; a `ReadableStream` body is read only as far as the cap and refused once it is exceeded, so nothing oversized reaches the bucket. A streamed body must be buffered to be capped, so `maxSize` is also the per-request memory ceiling and is itself capped at 16 MiB on that path — if the app legitimately accepts objects larger than that, upload them with `ctx.storage.createMultipartUpload()` or a presigned `createUploadHandler()` (neither is flagged by this lint, and neither holds the whole object) rather than dropping the cap.",run:a=>a.storageUploads===void 0?[]:a.storageUploads.filter(e=>s.has(e.method)&&e.analyzable&&!e.presentKeys.includes("maxSize")).map(e=>t(r,{cacheKey:`storage_upload_without_max_size:${e.file}:${e.line.toString()}`,detail:`\`ctx.storage.${e.method}\` in ${i(e)} has no \`maxSize\` cap — a caller can push an unbounded body into R2, exhausting storage/billing.`,metadata:{...o(e),method:e.method}})),source:"static",title:"Storage upload with no size cap"};export{r as default};
1
+ import{e as t}from"./finding-NrKO8idM.mjs";import{c as o,a as i}from"./helpers-YAAwOBMH.mjs";const s=new Set(["store","upload"]),r={categories:["SECURITY"],description:"A `ctx.storage.upload`/`store` call has no `maxSize` cap, so a caller can push an unbounded body straight into R2 through the Worker — unbounded storage/billing exhaustion, and for a streamed body, unbounded worker time.",facing:"EXTERNAL",level:"WARN",name:"storage_upload_without_max_size",remediation:"Pass a `maxSize` (bytes) to `ctx.storage.upload`/`store` sized to the largest legitimate object the app accepts. `ArrayBuffer`/`Blob` bodies are rejected up front when oversized; a `ReadableStream` body is read only as far as the cap and refused once it is exceeded, so nothing oversized reaches the bucket. A streamed body must be buffered to be capped, so `maxSize` is also the per-request memory ceiling and is itself capped at 16 MiB on that path — if the app legitimately accepts objects larger than that, upload them with `ctx.storage.createMultipartUpload()` or a presigned `createUploadHandler()` (neither is flagged by this lint, and neither holds the whole object) rather than dropping the cap.",run:a=>a.storageUploads===void 0?[]:a.storageUploads.filter(e=>s.has(e.method)&&e.analyzable&&!e.presentKeys.includes("maxSize")).map(e=>t(r,{cacheKey:`storage_upload_without_max_size:${e.file}:${e.line.toString()}`,detail:`\`ctx.storage.${e.method}\` in ${i(e)} has no \`maxSize\` cap — a caller can push an unbounded body into R2, exhausting storage/billing.`,metadata:{...o(e),method:e.method}})),source:"static",title:"Storage upload with no size cap"};export{r as default};
@@ -0,0 +1 @@
1
+ import{callSiteCallers as u}from"./callSiteCallers-DArHfQSU.mjs";import{j as d,r as f,i as h,h as g,g as m}from"./helpers-YAAwOBMH.mjs";const p=new Set(["lt","lte"]),w=s=>{const o=d(s.callEdges,s.cronTargets),t=f(s.tableWrites,s.rowEffects),i=h(s.schema);return(s.queries??[]).filter(e=>{if(e.terminal!=="collect"||e.table===""||e.index?.bounds===void 0)return!1;const{bounds:l}=e.index;if(l.some(n=>p.has(n)))return!1;const r=l.length>0&&l.every(n=>n==="eq"),c=n=>o.has(m(e.file,n))||e.visibility==="internal"&&!r,a=i(e);return u(e.scope).some(n=>c(n)&&!g(t,e,a,[n]))})},b=(s,o)=>{const t=new Set(o);return(s.filterFields??[]).filter(i=>i!=="_id"&&!t.has(i))};export{w as o,b as u};
@@ -1 +1 @@
1
- import{e as o}from"./finding-NrKO8idM.mjs";import{b as l}from"./helpers-DdZ_pyR3.mjs";const m=new Set(["date","number","timestamp"]),s={categories:["SCHEMA"],description:"A `.ttl(field)` policy points at a column that is not an epoch-millisecond timestamp, so the alarm sweep's `field < now` comparison can't decide expiry correctly.",facing:"INTERNAL",level:"ERROR",name:"ttl_field_not_timestamp",remediation:"Point `.ttl(field)` at a `v.timestamp()` / `v.date()` / `v.number()` (epoch-ms) column, or add such a column.",run:n=>{const a=[];for(const e of n.schema.tables){const{ttl:t}=e;if(!t)continue;const i=l(e,t.field);i===void 0||m.has(i)||a.push(o(s,{cacheKey:`ttl_field_not_timestamp:${e.name}:${t.field}`,detail:`Table "${e.name}" declares \`.ttl("${t.field}")\`, but "${t.field}" is a ${i} column, not an epoch-millisecond timestamp.`,metadata:{field:t.field,kind:i,table:e.name}}))}return a},source:"static",title:"TTL field is not a timestamp"};export{s as default};
1
+ import{e as o}from"./finding-NrKO8idM.mjs";import{b as l}from"./helpers-YAAwOBMH.mjs";const m=new Set(["date","number","timestamp"]),s={categories:["SCHEMA"],description:"A `.ttl(field)` policy points at a column that is not an epoch-millisecond timestamp, so the alarm sweep's `field < now` comparison can't decide expiry correctly.",facing:"INTERNAL",level:"ERROR",name:"ttl_field_not_timestamp",remediation:"Point `.ttl(field)` at a `v.timestamp()` / `v.date()` / `v.number()` (epoch-ms) column, or add such a column.",run:n=>{const a=[];for(const e of n.schema.tables){const{ttl:t}=e;if(!t)continue;const i=l(e,t.field);i===void 0||m.has(i)||a.push(o(s,{cacheKey:`ttl_field_not_timestamp:${e.name}:${t.field}`,detail:`Table "${e.name}" declares \`.ttl("${t.field}")\`, but "${t.field}" is a ${i} column, not an epoch-millisecond timestamp.`,metadata:{field:t.field,kind:i,table:e.name}}))}return a},source:"static",title:"TTL field is not a timestamp"};export{s as default};
@@ -1 +1 @@
1
- import{e as s}from"./finding-NrKO8idM.mjs";import{i as l,c,q as d}from"./helpers-DdZ_pyR3.mjs";import{o as h,u}from"./sweeps-JWMwcakB.mjs";const p={categories:["PERFORMANCE"],description:"A server-driven function (an internal procedure, or one a scheduled dispatch or cron job runs) calls `.collect()` on an open index range, with no upper bound and no take/paginate, and nothing it runs removes the rows it selects. Each run reads the whole range again, and the cost grows with the table.",facing:"EXTERNAL",level:"WARN",name:"unbounded_collect_on_open_range",remediation:"Bound the range from above (`.withIndex(…, (q) => q.eq(…).lt(…, cutoff))`), cap it with `.take(n)`, or page it with `.paginate(…)` and carry the cursor to the next run. A sweep that never removes the rows it selects keeps selecting them, so delete or update the rows it has handled, or move the cursor past them.",run:t=>{const a=l(t.schema);return h(t).map(e=>{const o=e.index?.name??"(computed)",n=u(e,a(e)),r=n.length===0?"":` It also filters on ${n.map(i=>`"${i}"`).join(", ")}, which the index does not cover.`;return s(p,{cacheKey:`unbounded_collect_on_open_range:${e.file}:${e.line.toString()}:${e.table}`,detail:`Server-driven read of "${e.table}" at ${d(e)} collects the open range of index "${o}" with no upper bound. Nothing it runs removes the rows it selects, so every run reads the whole range again.${r}`,metadata:{...c(e),filteredFields:n,indexName:o,table:e.table}})})},source:"static",title:"Unbounded collect on an open index range"};export{p as default};
1
+ import{e as s}from"./finding-NrKO8idM.mjs";import{i as l,c,q as d}from"./helpers-YAAwOBMH.mjs";import{o as h,u}from"./sweeps-DYG_FnlQ.mjs";const p={categories:["PERFORMANCE"],description:"A server-driven function (an internal procedure, or one a scheduled dispatch or cron job runs) calls `.collect()` on an open index range, with no upper bound and no take/paginate, and nothing it runs removes the rows it selects. Each run reads the whole range again, and the cost grows with the table.",facing:"EXTERNAL",level:"WARN",name:"unbounded_collect_on_open_range",remediation:"Bound the range from above (`.withIndex(…, (q) => q.eq(…).lt(…, cutoff))`), cap it with `.take(n)`, or page it with `.paginate(…)` and carry the cursor to the next run. A sweep that never removes the rows it selects keeps selecting them, so delete or update the rows it has handled, or move the cursor past them.",run:t=>{const a=l(t.schema);return h(t).map(e=>{const o=e.index?.name??"(computed)",n=u(e,a(e)),r=n.length===0?"":` It also filters on ${n.map(i=>`"${i}"`).join(", ")}, which the index does not cover.`;return s(p,{cacheKey:`unbounded_collect_on_open_range:${e.file}:${e.line.toString()}:${e.table}`,detail:`Server-driven read of "${e.table}" at ${d(e)} collects the open range of index "${o}" with no upper bound. Nothing it runs removes the rows it selects, so every run reads the whole range again.${r}`,metadata:{...c(e),filteredFields:n,indexName:o,table:e.table}})})},source:"static",title:"Unbounded collect on an open index range"};export{p as default};
@@ -1 +1 @@
1
- import{isReachableSite as r,callSiteLabel as i}from"./callSiteCallers-DArHfQSU.mjs";import{e as n}from"./finding-NrKO8idM.mjs";import{c as o,a}from"./helpers-DdZ_pyR3.mjs";const l={do:"`do { … } while (true)`",for:"`for (;;)`",while:"`while (true)`"},d={categories:["PERFORMANCE"],description:"A literal-infinite loop (`while (true)`, `for (;;)`, `do … while (true)`) has no `break`, `return` or `throw` that can leave it. Once entered it never ends: inside a Durable Object it holds the object forever, and every storage read or write in its body is billed on every turn.",facing:"EXTERNAL",level:"ERROR",name:"unbounded_loop",remediation:"Give the loop an exit: loop on a real condition (`while (cursor !== null)`), `break` when the work runs out, or cap it with an iteration budget. An `await` is not an exit: a long-polling `while (true)` worker is rejected unless it can still leave — check `signal.throwIfAborted()` each turn, `break` when the source closes, or stop at a deadline. For recurring work, do one batch per invocation and re-arm with `ctx.scheduler.runAfter(…)` behind a guard that stops when nothing is left.",run:t=>t.unboundedLoops===void 0?[]:t.unboundedLoops.filter(e=>e.scope.kind==="module"||r(e.scope)).map(e=>n(d,{cacheKey:`unbounded_loop:${e.file}:${i(e.scope)}:${e.kind}`,detail:`${l[e.kind]} in ${a(e)} has no \`break\`, \`return\` or \`throw\` that can leave it — once entered it never ends, and every storage call in its body is billed on every turn.`,metadata:{...o(e),loop:e.kind}})),source:"static",title:"Infinite loop with no exit"};export{d as default};
1
+ import{isReachableSite as r,callSiteLabel as i}from"./callSiteCallers-DArHfQSU.mjs";import{e as n}from"./finding-NrKO8idM.mjs";import{c as o,a}from"./helpers-YAAwOBMH.mjs";const l={do:"`do { … } while (true)`",for:"`for (;;)`",while:"`while (true)`"},d={categories:["PERFORMANCE"],description:"A literal-infinite loop (`while (true)`, `for (;;)`, `do … while (true)`) has no `break`, `return` or `throw` that can leave it. Once entered it never ends: inside a Durable Object it holds the object forever, and every storage read or write in its body is billed on every turn.",facing:"EXTERNAL",level:"ERROR",name:"unbounded_loop",remediation:"Give the loop an exit: loop on a real condition (`while (cursor !== null)`), `break` when the work runs out, or cap it with an iteration budget. An `await` is not an exit: a long-polling `while (true)` worker is rejected unless it can still leave — check `signal.throwIfAborted()` each turn, `break` when the source closes, or stop at a deadline. For recurring work, do one batch per invocation and re-arm with `ctx.scheduler.runAfter(…)` behind a guard that stops when nothing is left.",run:t=>t.unboundedLoops===void 0?[]:t.unboundedLoops.filter(e=>e.scope.kind==="module"||r(e.scope)).map(e=>n(d,{cacheKey:`unbounded_loop:${e.file}:${i(e.scope)}:${e.kind}`,detail:`${l[e.kind]} in ${a(e)} has no \`break\`, \`return\` or \`throw\` that can leave it — once entered it never ends, and every storage call in its body is billed on every turn.`,metadata:{...o(e),loop:e.kind}})),source:"static",title:"Infinite loop with no exit"};export{d as default};
@@ -0,0 +1 @@
1
+ import{e as i}from"./finding-NrKO8idM.mjs";import{m as a}from"./procedure-protections-DRQotu9I.mjs";import{f as s,d as r}from"./helpers-YAAwOBMH.mjs";const n=t=>t.writesUserTable===!0?"writes a user/session table":t.callsMail===!0?"sends mail":t.analyzableBody===!1?"may write a user/session table or send mail — its handler body could not be read":"may write a user/session table or send mail — at least one could not be determined",o={categories:["SECURITY"],description:"A public `mutation`/`action` that creates a user/session or sends mail has no CAPTCHA / bot check. Account-creating and mail-sending endpoints are prime automated-abuse targets (credential stuffing, mailbox flooding, disposable-account farming).",facing:"EXTERNAL",level:"WARN",name:"user_creating_mutation_without_captcha",remediation:"Add a server-verified human check: `.use(verifyTurnstileMiddleware({ secret, token: (c) => c.args.captchaToken }))` from `@lunora/auth`, or wrap it with `.use(protectPublic({ rateLimit, captcha }))` from `@lunora/server`. Pair with a rate limit for defense in depth. Note it is `verifyTurnstileMiddleware`, not the bare `verifyTurnstile` verdict function — that one returns a Promise and verifies nothing when placed in a `.use()` chain.",run:t=>t.procedureProtections===void 0?[]:t.procedureProtections.filter(e=>s(e)&&(a(e.writesUserTable)||a(e.callsMail))&&!e.usesCaptcha).map(e=>i(o,{cacheKey:`user_creating_mutation_without_captcha:${e.file}:${e.exportName}`,detail:`Public ${e.kind} \`${e.exportName}\` (${e.file}) ${n(e)} but has no CAPTCHA check. Add \`.use(verifyTurnstileMiddleware(...))\` or \`.use(protectPublic({ captcha }))\`.`,metadata:{callsMail:e.callsMail,exportName:e.exportName,...r(e),kind:e.kind,writesUserTable:e.writesUserTable}})),source:"static",title:"Account-creating / mail-sending write without a CAPTCHA"};export{o as default};
@@ -1 +1 @@
1
- import{m as r}from"./argument-derived-sink-DLXFC79t.mjs";import{c as t,a}from"./helpers-DdZ_pyR3.mjs";const n=r({cacheKey:e=>`vectors_namespace_from_user_input:${e.file}:${e.line.toString()}`,categories:["SECURITY"],description:"A `ctx.vectors.query`/`upsert`/`upsertMany`/`upsertNow` call uses a `namespace` derived from the handler's `args` with no server-side scoping. A Vectorize namespace partitions one index into isolated sub-collections, so an unscoped namespace lets any caller read or poison another tenant's vectors.",detail:e=>`\`ctx.vectors.${e.method}\` in ${a(e)} uses a Vectorize namespace derived from \`args\` with no server-side scoping — any caller can read or poison another tenant's vectors. Derive the namespace from a server-trusted identity (e.g. \`\${ctx.auth.orgId}\`), never from \`args\`.`,facing:"EXTERNAL",getAccesses:e=>e.vectorNamespaceAccesses,level:"WARN",metadata:e=>({...t(e),method:e.method}),name:"vectors_namespace_from_user_input",remediation:"Derive the `namespace` from a server-trusted identity (e.g. `${ctx.auth.orgId}`), never from `args`.",title:"Vectorize namespace derived from unscoped user input"});export{n as default};
1
+ import{m as r}from"./argument-derived-sink-DLXFC79t.mjs";import{c as t,a}from"./helpers-YAAwOBMH.mjs";const n=r({cacheKey:e=>`vectors_namespace_from_user_input:${e.file}:${e.line.toString()}`,categories:["SECURITY"],description:"A `ctx.vectors.query`/`upsert`/`upsertMany`/`upsertNow` call uses a `namespace` derived from the handler's `args` with no server-side scoping. A Vectorize namespace partitions one index into isolated sub-collections, so an unscoped namespace lets any caller read or poison another tenant's vectors.",detail:e=>`\`ctx.vectors.${e.method}\` in ${a(e)} uses a Vectorize namespace derived from \`args\` with no server-side scoping — any caller can read or poison another tenant's vectors. Derive the namespace from a server-trusted identity (e.g. \`\${ctx.auth.orgId}\`), never from \`args\`.`,facing:"EXTERNAL",getAccesses:e=>e.vectorNamespaceAccesses,level:"WARN",metadata:e=>({...t(e),method:e.method}),name:"vectors_namespace_from_user_input",remediation:"Derive the `namespace` from a server-trusted identity (e.g. `${ctx.auth.orgId}`), never from `args`.",title:"Vectorize namespace derived from unscoped user input"});export{n as default};
@@ -1 +1 @@
1
- import{callSiteDescription as w,callSiteLabel as t}from"./callSiteCallers-DArHfQSU.mjs";import{e as l}from"./finding-NrKO8idM.mjs";import{c as f}from"./helpers-DdZ_pyR3.mjs";const n={categories:["SCHEMA"],description:'A `ctx.workflows.get("<name>")` call references a workflow that is not declared by any `defineWorkflow` export in `lunora/workflows.ts`. The name is a typo or points at a removed/renamed workflow — the call throws at runtime.',facing:"INTERNAL",level:"ERROR",name:"workflow_unknown_target",remediation:'Fix the workflow name in the `ctx.workflows.get("…")` call, or add the missing `defineWorkflow` export to `lunora/workflows.ts`.',run:e=>{if(e.workflows===void 0||e.workflowCalls===void 0)return[];const r=new Set(e.workflows.map(o=>o.exportName));return e.workflowCalls.filter(o=>o.workflow!==""&&!r.has(o.workflow)).map(o=>l(n,{cacheKey:`workflow_unknown_target:${o.file}:${t(o.scope)}:${o.workflow}`,detail:`\`ctx.workflows.get("${o.workflow}")\` in ${w(o.scope)} (${o.file}) references workflow "${o.workflow}", which is not declared in lunora/workflows.ts.`,metadata:{...f(o),workflow:o.workflow}}))},source:"static",title:"Workflow call references unknown workflow"};export{n as default};
1
+ import{callSiteDescription as w,callSiteLabel as t}from"./callSiteCallers-DArHfQSU.mjs";import{e as l}from"./finding-NrKO8idM.mjs";import{c as f}from"./helpers-YAAwOBMH.mjs";const n={categories:["SCHEMA"],description:'A `ctx.workflows.get("<name>")` call references a workflow that is not declared by any `defineWorkflow` export in `lunora/workflows.ts`. The name is a typo or points at a removed/renamed workflow — the call throws at runtime.',facing:"INTERNAL",level:"ERROR",name:"workflow_unknown_target",remediation:'Fix the workflow name in the `ctx.workflows.get("…")` call, or add the missing `defineWorkflow` export to `lunora/workflows.ts`.',run:e=>{if(e.workflows===void 0||e.workflowCalls===void 0)return[];const r=new Set(e.workflows.map(o=>o.exportName));return e.workflowCalls.filter(o=>o.workflow!==""&&!r.has(o.workflow)).map(o=>l(n,{cacheKey:`workflow_unknown_target:${o.file}:${t(o.scope)}:${o.workflow}`,detail:`\`ctx.workflows.get("${o.workflow}")\` in ${w(o.scope)} (${o.file}) references workflow "${o.workflow}", which is not declared in lunora/workflows.ts.`,metadata:{...f(o),workflow:o.workflow}}))},source:"static",title:"Workflow call references unknown workflow"};export{n as default};
@@ -0,0 +1 @@
1
+ import{isReachableSite as a}from"./callSiteCallers-DArHfQSU.mjs";import{e as i}from"./finding-NrKO8idM.mjs";import{d as s}from"./helpers-YAAwOBMH.mjs";const l={categories:["SCHEMA"],description:'No function starts this workflow via `ctx.workflows.get("<name>")`. It may be triggered through a path the advisor can\'t see (the Cloudflare API, a wrangler invocation, a cross-service binding) — or it may be dead code that still deploys as a billable WorkflowEntrypoint.',facing:"INTERNAL",level:"INFO",name:"workflow_unused",remediation:'If the workflow should be triggered in-app, start it from a mutation/action with `ctx.workflows.get("<name>").create({ params })`. If it is started externally or is no longer needed, this advisory can be ignored (or remove the `defineWorkflow` export).',run:o=>{if(o.workflows===void 0||o.workflowCalls===void 0)return[];const t=o.workflowCalls.filter(e=>a(e.scope));if(t.some(e=>e.workflow===""))return[];const r=new Set(t.map(e=>e.workflow));return o.workflows.filter(e=>!r.has(e.exportName)).map(e=>i(l,{cacheKey:`workflow_unused:${e.exportName}`,detail:`No function calls \`ctx.workflows.get("${e.exportName}")\` — workflow "${e.exportName}" is declared but never started in app code.`,metadata:{...s(e),workflow:e.exportName}}))},source:"static",title:"Workflow is never started"};export{l as default};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lunora/advisor",
3
- "version": "1.0.0-alpha.291",
3
+ "version": "1.0.0-alpha.292",
4
4
  "description": "Schema & query lints (splinter-style advisors) for Lunora, feeding the Studio Advisors view",
5
5
  "keywords": [
6
6
  "advisor",
@@ -1 +0,0 @@
1
- import{e as a}from"./finding-NrKO8idM.mjs";const n={categories:["SCHEMA"],description:"An `action` calls an outbound surface (fetch, mail, queues, storage, sql, ai) with no `try`/`catch`. Those fail routinely, and an uncaught rejection reaches the caller with no indication of which dependency broke.",facing:"EXTERNAL",level:"WARN",name:"action_without_error_handling",remediation:"Wrap the outbound call in `try`/`catch`, then either degrade or rethrow a coded `LunoraError` naming the dependency that failed.",run:t=>t.procedureProtections===void 0?[]:t.procedureProtections.filter(e=>e.kind==="action"&&e.reachesOutbound===!0&&e.handlesErrors===!1).map(e=>a(n,{cacheKey:`action_without_error_handling:${e.file}:${e.exportName}`,detail:`Action \`${e.exportName}\` (${e.file}) calls an outbound surface with no \`try\`/\`catch\`. A dependency failure will surface to the caller unexplained.`,metadata:{exportName:e.exportName,file:e.file,kind:e.kind}})),source:"static",title:"Action performs outbound I/O with no error handling"};export{n as default};
@@ -1 +0,0 @@
1
- import{e as t}from"./finding-NrKO8idM.mjs";const i={categories:["SECURITY"],description:"An `httpRoute` on an admin/privileged path has no visible auth/admin guard. REST routes aren't covered by RLS, so an unguarded `/admin/*` route is callable by anyone who reaches the URL.",facing:"EXTERNAL",level:"WARN",name:"admin_route_without_guard",remediation:"Assert an authenticated, authorized caller at the top of the handler — check `ctx.auth` / `getSession(...)`, or a `requireAdmin`-style guard — and reject (401/403) before doing privileged work. For machine callers, verify a secret with a timing-safe compare.",run:a=>a.adminRoutes===void 0?[]:a.adminRoutes.filter(e=>!e.usesGuard).map(e=>t(i,{cacheKey:`admin_route_without_guard:${e.file}:${e.method}:${e.path}`,detail:`Route \`${e.method} ${e.path}\` (\`${e.exportName}\` in ${e.file}) is on an admin/privileged path but its handler shows no auth/admin guard. Assert an authorized caller before doing privileged work.`,metadata:{exportName:e.exportName,file:e.file,method:e.method,path:e.path}})),source:"static",title:"Admin route without an auth guard"};export{i as default};
@@ -1 +0,0 @@
1
- import{e as n}from"./finding-NrKO8idM.mjs";const i={categories:["PERFORMANCE"],description:"A procedure runs an AI generation but emits no structured event. Model calls bill per invocation and are not reproducible, so without one there is no way to attribute spend or trace a bad answer back to its prompt.",facing:"INTERNAL",level:"INFO",name:"ai_run_without_logging",remediation:'Emit an event around the generation — `ctx.trace("<name>", …)`, or a `ctx.log` line carrying the model and token usage.',run:e=>e.procedureProtections===void 0?[]:e.procedureProtections.filter(t=>t.runsAiGeneration===!0&&t.emitsEvent===!1).map(t=>n(i,{cacheKey:`ai_run_without_logging:${t.file}:${t.exportName}`,detail:`${t.kind} \`${t.exportName}\` (${t.file}) runs an AI generation with no structured event, so its cost and output cannot be attributed later.`,metadata:{exportName:t.exportName,file:t.file,kind:t.kind}})),source:"static",title:"AI generation with no structured event"};export{i as default};
@@ -1 +0,0 @@
1
- import{e as t}from"./finding-NrKO8idM.mjs";import{m as i}from"./procedure-protections-DRQotu9I.mjs";const a={categories:["SECURITY"],description:"A public procedure runs an AI generation (`generateText`/`streamText`/`generateObject`/`streamObject`) with no `maxOutputTokens` bound. Generation bills per output token, so an anonymous caller can request arbitrarily long completions in a loop — a denial-of-wallet vector that also ties up worker time on long streams.",facing:"EXTERNAL",level:"WARN",name:"ai_unbounded_generation_public",remediation:"Cap the completion with `maxOutputTokens` in the generation config, and rate-limit the public entry point (`.use(rateLimit(...))`). For expensive models, prefer running generation from an internal, authenticated path rather than exposing it directly to anonymous callers.",run:n=>n.procedureProtections===void 0?[]:n.procedureProtections.filter(e=>i(e.unboundedAiGeneration)&&e.visibility==="public").map(e=>t(a,{cacheKey:`ai_unbounded_generation_public:${e.file}:${e.exportName}`,detail:`\`${e.exportName}\` (${e.file}) is public and runs an AI generation with no \`maxOutputTokens\` bound — an anonymous caller can drive unbounded, billable completions in a loop. Add a \`maxOutputTokens\` cap and rate-limit the entry point.`,metadata:{exportName:e.exportName,file:e.file,kind:e.kind}})),source:"static",title:"Public procedure runs unbounded AI generation (no maxOutputTokens)"};export{a as default};
@@ -1 +0,0 @@
1
- import{e as d}from"./finding-NrKO8idM.mjs";const l=3600,f={h:3600,m:60,s:1},p=/^(\d+)([smh])$/u,c=n=>{if(typeof n=="number")return n;const o=p.exec(n);if(o===null)return;const[,e="0",t="s"]=o;return Number(e)*(f[t]??1)},u={categories:["PERFORMANCE"],description:"A container's idle window (its `sleepAfter`, capped by any `hardTimeout`) is longer than an hour, so every idle instance keeps running, and billed, for that whole window.",facing:"INTERNAL",level:"WARN",name:"container_long_sleep_after",remediation:"Lower `sleepAfter` to the idle window the workload needs (the default is 10m), or add a `hardTimeout` that caps how long an instance may live.",run:n=>{const o=[];for(const e of n.containers??[]){const{hardTimeout:t,sleepAfter:i}=e;if(i===void 0)continue;const r=c(i);if(r===void 0)continue;const a=t===void 0?void 0:c(t),s=a===void 0?r:Math.min(r,a);s<=l||o.push(d(u,{cacheKey:`container_long_sleep_after:${e.exportName}`,detail:`Container "${e.exportName}" can sit idle for ${s.toString()} s before it sleeps (sleepAfter ${String(i)}${a===void 0?"":`, capped by hardTimeout ${String(t)}`}); every idle instance is billed for that whole window.`,metadata:{container:e.exportName,effectiveIdleSeconds:s,hardTimeout:t,sleepAfter:i}}))}return o},source:"static",title:"Long container idle window"};export{u as default};
@@ -1 +0,0 @@
1
- import{e as a}from"./finding-NrKO8idM.mjs";const r=new Set(["standard-3","standard-4"]),o=2,c=4096,d=e=>typeof e=="string"?r.has(e):(e.vcpu??0)>o||(e.memoryMib??0)>c,l={categories:["PERFORMANCE"],description:"A container is declared on a large instance type, whose provisioned memory and disk are billed for the lifetime of every running instance.",facing:"INTERNAL",level:"INFO",name:"container_oversized_instance",remediation:"Confirm the workload needs this size; a smaller instanceType (lite/basic/standard-1) costs less while idle-but-running.",run:e=>{const t=[];for(const i of e.containers??[]){const{instanceType:n}=i;if(n===void 0||!d(n))continue;const s=typeof n=="string"?n:JSON.stringify(n);t.push(a(l,{cacheKey:`container_oversized_instance:${i.exportName}`,detail:`Container "${i.exportName}" uses a large instance type (${s}); its memory + disk are billed while any instance runs.`,metadata:{container:i.exportName,instanceType:n}}))}return t},source:"static",title:"Oversized container instance"};export{l as default};
@@ -1 +0,0 @@
1
- import{e as n}from"./finding-NrKO8idM.mjs";const a={categories:["SECURITY"],description:"A container leaves outbound internet access at the default (enabled), which is billed per GB of egress and widens the attack surface.",facing:"INTERNAL",level:"INFO",name:"container_public_internet",remediation:"Set `enableInternet: false` on the container if it doesn't call external services, or `true` to opt in deliberately.",run:t=>(t.containers??[]).filter(e=>e.enableInternet===void 0).map(e=>n(a,{cacheKey:`container_public_internet:${e.exportName}`,detail:`Container "${e.exportName}" doesn't set enableInternet, so outbound internet is on by default (egress is billed).`,metadata:{container:e.exportName}})),source:"static",title:"Container egress enabled by default"};export{a as default};
@@ -1 +0,0 @@
1
- import{parse as c}from"@visulima/cron-parser/cloudflare";import{e as h}from"./finding-NrKO8idM.mjs";const d=/\s+/,l=t=>{const e=t.trim();if(e.split(d).length===5)try{const{dayOfMonth:r,dayOfWeek:n,hour:a,minute:i,month:s}=c(e).fields;return i.values.length!==60?void 0:a.values.length===24&&r.values.length===31&&s.values.length===12&&n.values.length===7?"always":"windowed"}catch{return}},o=t=>t.workflow===void 0?t.functionPath??"its target":`a new instance of workflow "${t.workflow.exportName}"`,u={categories:["PERFORMANCE"],description:"A cron job fires every minute, the fastest cadence Cloudflare Cron Triggers allow. Each fire is a Worker invocation (shared by jobs on the same schedule) plus a dispatch to its target (a Durable Object request, or a new workflow instance), billed whether or not there was work to do.",facing:"INTERNAL",level:"INFO",name:"cron_every_minute",remediation:"Confirm the cadence is needed. If the job only reacts to new work, drop it to a coarser interval, or replace the poll with `ctx.scheduler.runAfter(…)` armed by the write that creates the work. Whatever the cadence, make the target return early on an indexed read when there is nothing to do.",run:t=>(t.crons??[]).flatMap(e=>{const r=l(e.cron);if(r===void 0)return[];const n=r==="always"?`fires every minute — about 43,200 dispatches a month of ${o(e)}`:`fires every minute while its window is open, dispatching ${o(e)} once a minute`;return[h(u,{cacheKey:`cron_every_minute:${e.name}`,detail:`Cron job "${e.name}" (\`${e.cron}\`) ${n}, whether or not there is work. Jobs on the same schedule share one Worker invocation.`,metadata:{cron:e.cron,job:e.name,window:r==="windowed"}})]}),source:"static",title:"Cron job fires every minute"};export{u as default};
@@ -1 +0,0 @@
1
- import{e as t}from"./finding-NrKO8idM.mjs";const o={categories:["SCHEMA"],description:"A procedure throws a bare `new Error(...)`. It reaches the client as an opaque message the caller cannot branch on, and error grouping cannot fingerprint it into a stable issue.",facing:"EXTERNAL",level:"WARN",name:"error_without_catalog",remediation:'Throw a coded error instead: `throw new LunoraError("<CODE>", { … })` from `@lunora/errors`, adding the code to `ERROR_CATALOG` if it is new.',run:e=>e.procedureProtections===void 0?[]:e.procedureProtections.filter(r=>r.throwsBareError===!0).map(r=>t(o,{cacheKey:`error_without_catalog:${r.file}:${r.exportName}`,detail:`${r.kind} \`${r.exportName}\` (${r.file}) throws a bare \`new Error(...)\`. Use \`LunoraError\` with a catalog code so the client can branch on it and Studio can group it.`,metadata:{exportName:r.exportName,file:r.file,kind:r.kind}})),source:"static",title:"Bare Error thrown instead of a coded LunoraError"};export{o as default};
@@ -1 +0,0 @@
1
- import{e as s}from"./finding-NrKO8idM.mjs";import{m as i}from"./procedure-protections-DRQotu9I.mjs";const r={categories:["SECURITY"],description:"A public procedure calls `ctx.db.insertManyUnsafe(...)`, which writes rows straight to storage and bypasses both the per-row validators and the schema's insert triggers (server-trusted columns, ownership stamping, RLS write checks). On a public entry point the rows are request-shaped, so a caller can write columns they shouldn't control and skip every trigger-enforced invariant.",facing:"EXTERNAL",level:"WARN",name:"insert_many_unsafe_user_data",remediation:"Use the validated `ctx.db.insert(...)` path in public procedures so validators and insert triggers run. If you need the unsafe bulk write, move it into an internal function (`internalMutation`/`internalAction`) that is fed only server-constructed rows, never request input.",run:t=>t.procedureProtections===void 0?[]:t.procedureProtections.filter(e=>i(e.usesInsertManyUnsafe)&&e.visibility==="public").map(e=>s(r,{cacheKey:`insert_many_unsafe_user_data:${e.file}:${e.exportName}`,detail:`\`${e.exportName}\` (${e.file}) is public and calls \`ctx.db.insertManyUnsafe(...)\`, bypassing validators and insert triggers on request-shaped rows. Switch to \`ctx.db.insert(...)\`, or move the bulk write into an internal function fed server-built rows.`,metadata:{exportName:e.exportName,file:e.file,kind:e.kind}})),source:"static",title:"Public procedure uses insertManyUnsafe (bypasses validators and triggers)"};export{r as default};
@@ -1 +0,0 @@
1
- import{e as s}from"./finding-NrKO8idM.mjs";const i={categories:["SECURITY"],description:"An RLS policy is bound to a `table` name that does not exist in the schema. The `rls()` middleware never matches it, so the table the policy was meant to protect is left ungated — reads return unrestricted rows and writes are allowed.",facing:"EXTERNAL",level:"WARN",name:"policy_references_unknown_table",remediation:"Fix the policy's `table` to a real table name (check for a typo or a table that was renamed/removed). If the table is gone, delete the dead policy.",run:a=>{if(a.rlsProcedures===void 0)return[];const r=new Set(a.schema.tables.map(t=>t.name)),n=new Set,o=[];for(const t of a.rlsProcedures)for(const e of t.rlsTables)e===""||r.has(e)||n.has(e)||(n.add(e),o.push(s(i,{cacheKey:`policy_references_unknown_table:${e}`,detail:`An RLS policy in \`${t.exportName}\` (${t.file}) is bound to table \`${e}\`, which is not declared in the schema. The policy never matches, so \`${e}\` — if it exists under another name — is left ungated.`,metadata:{exportName:t.exportName,file:t.file,table:e}})));return o},source:"static",title:"RLS policy bound to an unknown table"};export{i as default};
@@ -1 +0,0 @@
1
- import{e as i}from"./finding-NrKO8idM.mjs";import{m as a}from"./procedure-protections-DRQotu9I.mjs";const r={categories:["SECURITY"],description:"A public procedure fans work out to a privileged dispatch surface (`ctx.scheduler.runAfter`/`runAt`, a `ctx.queues.<name>` send, a `ctx.topics.<name>.publish`, or `ctx.workflows.<name>.create`) with no rate-limit guard. Each dispatch runs later under the system identity and bills the account, so an anonymous caller can amplify cost and flood the async surface in a loop.",facing:"EXTERNAL",level:"WARN",name:"privileged_fanout_from_public_procedure",remediation:"Gate the public entry point with a rate limit (`.use(rateLimit(...))` or a `protectPublic({ rateLimit })` bundle), or make the fan-out procedure internal and trigger it only from an authenticated, guarded path. Never expose an unbounded scheduler/queue/topic/workflow dispatch to anonymous callers.",run:t=>t.procedureProtections===void 0?[]:t.procedureProtections.filter(e=>a(e.fanOut)&&e.visibility==="public"&&!e.usesRateLimit).map(e=>i(r,{cacheKey:`privileged_fanout_from_public_procedure:${e.file}:${e.exportName}`,detail:`\`${e.exportName}\` (${e.file}) is public and fans work out to a privileged dispatch surface (scheduler/queue/topic/workflow) with no rate limit — an anonymous caller can drive that billable, system-identity dispatch in a loop. Add a rate-limit guard, or make it internal and trigger it from an authenticated path.`,metadata:{exportName:e.exportName,file:e.file,kind:e.kind}})),source:"static",title:"Public procedure fans out to a privileged dispatch surface"};export{r as default};
@@ -1 +0,0 @@
1
- import{e as i}from"./finding-NrKO8idM.mjs";const a={categories:["SCHEMA"],description:"A public `mutation`/`action` emits no structured event. When it fails you get a stack trace with no request context — no ids, no tenant, no outcome — so the failure is visible but not searchable.",facing:"INTERNAL",level:"INFO",name:"procedure_without_structured_event",remediation:'Emit one event on the primary path: `ctx.log.info("<verb>", { … })`, or attach the facts to the request\'s span with `ctx.span.setAttributes({ … })`, and time a step with `ctx.trace("<name>", …)`.',run:e=>e.procedureProtections===void 0?[]:e.procedureProtections.filter(t=>t.visibility==="public"&&t.kind!=="query"&&t.emitsEvent===!1).map(t=>i(a,{cacheKey:`procedure_without_structured_event:${t.file}:${t.exportName}`,detail:`Public ${t.kind} \`${t.exportName}\` (${t.file}) emits no structured event. Add a \`ctx.log\` line or a \`ctx.span\` so a failure carries its request context.`,metadata:{exportName:t.exportName,file:t.file,kind:t.kind}})),source:"static",title:"Public write emits no structured event"};export{a as default};
@@ -1 +0,0 @@
1
- import{e as a}from"./finding-NrKO8idM.mjs";import{e as r,m as s}from"./helpers-DdZ_pyR3.mjs";const n=["contact","forgot","login","logIn","magic","otp","register","reset","signin","signIn","signup","signUp","subscribe","verify"],o={categories:["SECURITY"],description:"A public `mutation`/`action` has no `rateLimit` middleware. Publicly-callable writes are flood and brute-force targets — an attacker can exhaust writes, mail quota, or credits, or guess credentials on auth-shaped endpoints.",facing:"EXTERNAL",level:"WARN",name:"public_mutation_without_ratelimit",remediation:'Attach a rate limit: `.use(rateLimit(limiter, "<bucket>"))` from `@lunora/ratelimit`, or wrap the recommended public-procedure guards with `.use(protectPublic({ rateLimit, captcha }))` from `@lunora/server`. Genuinely-open writes can be acknowledged by adding a permissive limiter.',run:i=>i.procedureProtections===void 0?[]:i.procedureProtections.filter(t=>r(t)&&!t.usesRateLimit).map(t=>{const e=s(t.exportName,n);return a(o,{cacheKey:`public_mutation_without_ratelimit:${t.file}:${t.exportName}`,detail:`Public ${t.kind} \`${t.exportName}\` (${t.file}) has no rate limit${e?" — its name suggests an auth/abuse-sensitive endpoint, so this is high-risk":""}. Add \`.use(rateLimit(...))\` or \`.use(protectPublic({ rateLimit }))\`.`,metadata:{exportName:t.exportName,file:t.file,kind:t.kind,sensitive:e}})}),source:"static",title:"Public write without a rate limit"};export{o as default};
@@ -1 +0,0 @@
1
- import{e as n}from"./finding-NrKO8idM.mjs";const r={categories:["SCHEMA"],description:"A queue consumer drops a message once it exhausts `maxRetries` (default 3) delivery attempts. Without a `deadLetterQueue`, that message is deleted permanently with no record — route exhausted messages to a DLQ so you can inspect, alert on, and replay them.",facing:"INTERNAL",level:"WARN",name:"queue_without_dlq",remediation:'Add `deadLetterQueue: "<name>-dlq"` to the `defineQueue({...})` options and declare a consumer for that queue so exhausted messages are inspectable (an unconsumed DLQ still expires at the retention window). `vis generate lunora-queue` with the best-practice setup scaffolds both. If the queue is fire-and-forget and message loss is acceptable, this advisory can be ignored.',run:t=>{if(t.queues===void 0)return[];const i=new Set(t.queues.map(e=>e.tuning.deadLetterQueue).filter(e=>e!==void 0&&e!=="")),s=[];for(const e of t.queues){const u=e.tuning.deadLetterQueue;if(u!==void 0&&u!==""||i.has(e.name))continue;const a=typeof e.tuning.maxRetries=="number"?e.tuning.maxRetries:3;s.push(n(r,{cacheKey:`queue_without_dlq:${e.exportName}`,detail:`Queue "${e.exportName}" declares no \`deadLetterQueue\`, so a message that exhausts its retries (\`maxRetries\` = ${String(a)}, ~${String(a+1)} delivery attempts) is dropped and permanently lost.`,metadata:{maxRetries:a,mode:e.mode,queue:e.exportName}}))}return s},source:"static",title:"Queue has no dead-letter queue"};export{r as default};
@@ -1 +0,0 @@
1
- import{e as a}from"./finding-NrKO8idM.mjs";const l={categories:["SECURITY"],description:"A public procedure reads or writes a table that is covered by an RLS policy elsewhere in the app, but this procedure's builder chain does not include `.use(rls(...))`. The raw, unwrapped `ctx.db` silently bypasses every policy in the list.",facing:"EXTERNAL",level:"WARN",name:"rls_uncovered_table",remediation:"Add `.use(rls(policies))` to the procedure's builder chain — e.g. `c.use(rls(myPolicies)).query(...)` — so its `ctx.db` is wrapped by the same policy evaluator as the rest of the app. If this procedure is intentionally privileged (e.g. a background job), declare it with `internalQuery` / `internalMutation` / `internalAction` instead of the public builder so the intent is explicit.",run:r=>{if(r.rlsProcedures===void 0)return[];const s=new Set;for(const e of r.rlsProcedures)for(const i of e.rlsTables)i!==""&&s.add(i);if(s.size===0)return[];const o=[];for(const e of r.rlsProcedures){if(e.usesRls||e.visibility==="internal")continue;const i=new Set;for(const t of[...e.tablesRead,...e.tablesWritten])t!==""&&s.has(t)&&i.add(t);for(const t of i)o.push(a(l,{cacheKey:`rls_uncovered_table:${e.file}:${e.exportName}:${t}`,detail:`\`${e.exportName}\` in ${e.file} accesses table \`${t}\` without \`.use(rls(...))\` — the table is policy-gated elsewhere in the app but this procedure bypasses those policies entirely.`,metadata:{exportName:e.exportName,file:e.file,table:t}}))}return o},source:"static",title:"RLS-gated table accessed without rls() middleware"};export{l as default};
@@ -1 +0,0 @@
1
- import{callSiteCallers as l}from"./callSiteCallers-DArHfQSU.mjs";import{e as c}from"./finding-NrKO8idM.mjs";import{r as d,f as u,g as f}from"./helpers-DdZ_pyR3.mjs";const h=1e3,p=6e4,m=new Set(["patch","patchIf","patchMany","patchWhere"]),w=e=>new Map([...e].map(([n,o])=>[n,o.filter(t=>!m.has(t.method))])),g=/^(?:continue|next|page)?_?cursor$/iu,v=e=>{if(!(e.kind!=="schedule"||e.conditional!==!0||e.target===void 0||e.scope.kind!=="export"))return e.target===u(e.file,e.scope.name)?e.scope.name:void 0},y=e=>{const n=e.schedule?.delayMs,o=e.schedule?.argKeys;if(!(n===void 0||n>=p||o===void 0||o.some(t=>g.test(t))))return n},R=(e,n,o)=>e.some(t=>t.kind==="call"&&t.file===n&&t.scope.kind==="export"&&t.scope.name===o),E=(e,n,o,t)=>{const s=(e.queries??[]).filter(r=>r.file===n&&r.table!==""&&l(r.scope).includes(o));return s.length===0||s.some(r=>f(t,r,void 0,[o]))},S={categories:["PERFORMANCE"],description:"A function re-arms itself with `ctx.scheduler.runAfter` on a delay under a minute, and the re-arming passes no cursor and nothing in the function removes the rows it reads. Each run finds the same rows and does the same work again; a delay under a second is a spin, and a longer one is a poll that rewrites a row on every tick.",facing:"EXTERNAL",level:"WARN",name:"self_reschedule_without_progress",remediation:"Carry the progress forward: pass a cursor (or the last processed id) in the dispatch args, or delete or update the rows the function handled so the next run selects only what is left. Re-arm only while work remains, and use a longer delay or a `cron` for periodic work.",run:e=>{if(e.callEdges===void 0)return[];const{callEdges:n}=e,o=d(e.tableWrites,e.rowEffects),t=[];for(const s of n){const r=v(s),i=y(s);if(r===void 0||i===void 0)continue;const a=i>=h;R(n,s.file,r)||E(e,s.file,r,a?w(o):o)||t.push(c(S,{cacheKey:`self_reschedule_without_progress:${s.file}:${s.line.toString()}:${r}`,detail:a?`\`${r}\` (${s.file}:${s.line.toString()}) polls itself every ${i.toString()} ms with no cursor in its args, and it removes none of the rows it reads. Each tick re-reads the same rows and rewrites in place, and each run is billed.`:`\`${r}\` (${s.file}:${s.line.toString()}) re-arms itself after ${i.toString()} ms with no cursor in its args, and it removes none of the rows it reads. The next run finds the same rows and starts the same work again.`,level:a?"INFO":"WARN",metadata:{delayMs:i,file:s.file,function:r,line:s.line,tier:a?"poll":"spin"}}))}return t},source:"static",title:"Self-reschedule without progress"};export{S as default};
@@ -1 +0,0 @@
1
- import{e as l}from"./finding-NrKO8idM.mjs";const r={categories:["PERFORMANCE"],description:"A `defineShape` replicates from a `.global()` table. Global tables live outside the shard DO's SQLite op-log, so the shape is served through the cross-shard tier — coordinator/poll-refreshed and latency-tiered, not poke-live like a sharded shape.",facing:"EXTERNAL",level:"WARN",name:"shape_targets_global_table",remediation:"Expected if you want the cross-shard tier — just don't assume poke-live freshness; global shapes refresh on a poll. For live updates, replicate from a sharded table instead (denormalize the columns you need into the shard).",run:a=>{if(a.shapes===void 0)return[];const t=new Set(a.schema.tables.filter(e=>e.shardKind==="global").map(e=>e.name));return a.shapes.filter(e=>e.table!==void 0&&t.has(e.table)).map(e=>l(r,{cacheKey:`shape_targets_global_table:${e.exportName}`,detail:`Shape \`${e.exportName}\` (${e.file}) replicates from the \`.global()\` table \`${e.table}\`. It is served through the cross-shard global tier — poll-refreshed and latency-tiered, not poke-live.`,metadata:{exportName:e.exportName,file:e.file,table:e.table}}))},source:"static",title:"Shape replicates from a global (cross-shard) table"};export{r as default};
@@ -1 +0,0 @@
1
- import{e as n}from"./finding-NrKO8idM.mjs";const o={categories:["SCHEMA"],description:"A `defineShape` is bound to a `table` name that does not exist in the schema. The shape can never resolve a rowset — its subscription seeds empty and errors at the first flush.",facing:"INTERNAL",level:"ERROR",name:"shape_unknown_table",remediation:"Fix the shape's `table` to a real table name (check for a typo or a table that was renamed/removed).",run:a=>{if(a.shapes===void 0)return[];const t=new Set(a.schema.tables.map(e=>e.name));return a.shapes.filter(e=>e.table!==void 0&&!t.has(e.table)).map(e=>n(o,{cacheKey:`shape_unknown_table:${e.exportName}`,detail:`Shape \`${e.exportName}\` (${e.file}) replicates from table \`${e.table}\`, which is not declared in the schema. The shape can never resolve a rowset.`,metadata:{exportName:e.exportName,file:e.file,table:e.table}}))},source:"static",title:"Shape bound to an unknown table"};export{o as default};
@@ -1 +0,0 @@
1
- import{e as s}from"./finding-NrKO8idM.mjs";import{m as t}from"./procedure-protections-DRQotu9I.mjs";import{e as o}from"./helpers-DdZ_pyR3.mjs";const r={categories:["SECURITY"],description:"A public `mutation`/`action` that creates a user/session/account row has no disposable-email gate. Throwaway mailboxes farm free trials, evade bans, and pollute the user table.",facing:"EXTERNAL",level:"WARN",name:"signup_mutation_without_disposable_gating",remediation:"Add `.use(emailGateMiddleware({ email: (ctx) => ctx.args.email }))` from `@lunora/auth/email-guard` to reject disposable domains at signup, or gate better-auth's native signup with `withEmailGate(...)` / `emailGateDatabaseHooks(...)`.",run:a=>{if(a.procedureProtections===void 0)return[];const i=[];for(const e of a.procedureProtections)!o(e)||!t(e.writesUserTable)||e.usesEmailGate||t(e.hasEmailArg)&&e.hasEmailArg!==!1&&i.push(s(r,{cacheKey:`signup_mutation_without_disposable_gating:${e.file}:${e.exportName}`,detail:`Public ${e.kind} \`${e.exportName}\` (${e.file}) writes a user/session/account table but has no disposable-email gate. Add \`.use(emailGateMiddleware(...))\` from \`@lunora/auth/email-guard\`.`,metadata:{exportName:e.exportName,file:e.file,kind:e.kind,writesUserTable:e.writesUserTable}}));return i},source:"static",title:"Account-creating write without a disposable-email gate"};export{r as default};
@@ -1 +0,0 @@
1
- import{callSiteCallers as u}from"./callSiteCallers-DArHfQSU.mjs";import{h as d,r as f,i as h,g,f as m}from"./helpers-DdZ_pyR3.mjs";const p=new Set(["lt","lte"]),w=s=>{const o=d(s.callEdges,s.cronTargets),t=f(s.tableWrites,s.rowEffects),i=h(s.schema);return(s.queries??[]).filter(e=>{if(e.terminal!=="collect"||e.table===""||e.index?.bounds===void 0)return!1;const{bounds:l}=e.index;if(l.some(n=>p.has(n)))return!1;const r=l.length>0&&l.every(n=>n==="eq"),c=n=>o.has(m(e.file,n))||e.visibility==="internal"&&!r,a=i(e);return u(e.scope).some(n=>c(n)&&!g(t,e,a,[n]))})},b=(s,o)=>{const t=new Set(o);return(s.filterFields??[]).filter(i=>i!=="_id"&&!t.has(i))};export{w as o,b as u};
@@ -1 +0,0 @@
1
- import{e as a}from"./finding-NrKO8idM.mjs";import{m as i}from"./procedure-protections-DRQotu9I.mjs";import{e as s}from"./helpers-DdZ_pyR3.mjs";const r=t=>t.writesUserTable===!0?"writes a user/session table":t.callsMail===!0?"sends mail":t.analyzableBody===!1?"may write a user/session table or send mail — its handler body could not be read":"may write a user/session table or send mail — at least one could not be determined",n={categories:["SECURITY"],description:"A public `mutation`/`action` that creates a user/session or sends mail has no CAPTCHA / bot check. Account-creating and mail-sending endpoints are prime automated-abuse targets (credential stuffing, mailbox flooding, disposable-account farming).",facing:"EXTERNAL",level:"WARN",name:"user_creating_mutation_without_captcha",remediation:"Add a server-verified human check: `.use(verifyTurnstileMiddleware({ secret, token: (c) => c.args.captchaToken }))` from `@lunora/auth`, or wrap it with `.use(protectPublic({ rateLimit, captcha }))` from `@lunora/server`. Pair with a rate limit for defense in depth. Note it is `verifyTurnstileMiddleware`, not the bare `verifyTurnstile` verdict function — that one returns a Promise and verifies nothing when placed in a `.use()` chain.",run:t=>t.procedureProtections===void 0?[]:t.procedureProtections.filter(e=>s(e)&&(i(e.writesUserTable)||i(e.callsMail))&&!e.usesCaptcha).map(e=>a(n,{cacheKey:`user_creating_mutation_without_captcha:${e.file}:${e.exportName}`,detail:`Public ${e.kind} \`${e.exportName}\` (${e.file}) ${r(e)} but has no CAPTCHA check. Add \`.use(verifyTurnstileMiddleware(...))\` or \`.use(protectPublic({ captcha }))\`.`,metadata:{callsMail:e.callsMail,exportName:e.exportName,file:e.file,kind:e.kind,writesUserTable:e.writesUserTable}})),source:"static",title:"Account-creating / mail-sending write without a CAPTCHA"};export{n as default};
@@ -1 +0,0 @@
1
- import{isReachableSite as a}from"./callSiteCallers-DArHfQSU.mjs";import{e as i}from"./finding-NrKO8idM.mjs";const s={categories:["SCHEMA"],description:'No function starts this workflow via `ctx.workflows.get("<name>")`. It may be triggered through a path the advisor can\'t see (the Cloudflare API, a wrangler invocation, a cross-service binding) — or it may be dead code that still deploys as a billable WorkflowEntrypoint.',facing:"INTERNAL",level:"INFO",name:"workflow_unused",remediation:'If the workflow should be triggered in-app, start it from a mutation/action with `ctx.workflows.get("<name>").create({ params })`. If it is started externally or is no longer needed, this advisory can be ignored (or remove the `defineWorkflow` export).',run:o=>{if(o.workflows===void 0||o.workflowCalls===void 0)return[];const t=o.workflowCalls.filter(e=>a(e.scope));if(t.some(e=>e.workflow===""))return[];const r=new Set(t.map(e=>e.workflow));return o.workflows.filter(e=>!r.has(e.exportName)).map(e=>i(s,{cacheKey:`workflow_unused:${e.exportName}`,detail:`No function calls \`ctx.workflows.get("${e.exportName}")\` — workflow "${e.exportName}" is declared but never started in app code.`,metadata:{workflow:e.exportName}}))},source:"static",title:"Workflow is never started"};export{s as default};