@lunora/advisor 1.0.0-alpha.294 → 1.0.0-alpha.296

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.
package/dist/index.d.mts CHANGED
@@ -465,7 +465,7 @@ interface AdvisorCron {
465
465
  }
466
466
  /**
467
467
  * One CDC export-sink construction discovered in a function body — the input the
468
- * `export_sink_misconfigured` lint consumes. Produced by the codegen feeder,
468
+ * export_sink_misconfigured lint consumes. Produced by the codegen feeder,
469
469
  * which walks the lunora source for the three sink factories the export tap
470
470
  * (plan 170) ships: `defineExportSink({ name, deliver })`,
471
471
  * `webhookExportSink({ name, url, … })`, and `r2Sink({ name, bucket, … })`.
@@ -523,7 +523,7 @@ interface AdvisorFailOpenGuard {
523
523
  }
524
524
  /**
525
525
  * One `ctx.flags` read discovered lexically inside a `query(...)` handler body —
526
- * the input the `flag_read_in_subscription` lint consumes. Produced by the
526
+ * the input the flag_read_in_subscription lint consumes. Produced by the
527
527
  * codegen feeder, which walks each exported query's handler with ts-morph and
528
528
  * records reads of the flag-evaluation surface (`ctx.flags.boolean(...)`,
529
529
  * `ctx.flags.string(...)`, `ctx.flags.details.number(...)`, …).
@@ -1128,10 +1128,15 @@ interface AdvisorOwnerFieldWrite {
1128
1128
  ownerScoped?: true;
1129
1129
  /** Who the site runs on behalf of — see {@link AdvisorCallSiteScope}. */
1130
1130
  scope: AdvisorCallSiteScope;
1131
+ /**
1132
+ * Set when every caller is an `internal*` procedure, the only `internal` writes the lint trusts. A lifecycle or
1133
+ * channel registration is `internal` too, but a connected client triggers it with its own payload.
1134
+ */
1135
+ trustedInternal?: true;
1131
1136
  /**
1132
1137
  * Visibility of the enclosing procedure. `internal` procedures are not
1133
1138
  * reachable by a caller, so the "any caller can act as any user" premise
1134
- * does not hold there and the finding drops to `INFO`. `undefined` when the
1139
+ * does not hold there and the lint reports nothing for the write. `undefined` when the
1135
1140
  * feeder could not attribute the write to a registered procedure.
1136
1141
  */
1137
1142
  visibility?: "internal" | "public";
@@ -1139,7 +1144,7 @@ interface AdvisorOwnerFieldWrite {
1139
1144
  /**
1140
1145
  * One payment webhook-adapter construction (`createStripeAdapter` /
1141
1146
  * `createPolarAdapter` / `createAutumnAdapter` / `createDodoPaymentsAdapter`) —
1142
- * the shared input for the `payment_webhook_wide_tolerance` lint. The adapters
1147
+ * the shared input for the payment_webhook_wide_tolerance lint. The adapters
1143
1148
  * verify a webhook's signed timestamp against a `webhookToleranceSeconds` replay
1144
1149
  * window (default 300s); an implausibly wide window leaves the endpoint accepting
1145
1150
  * stale, replayable signed payloads long after capture. `toleranceSeconds`
@@ -1267,6 +1272,12 @@ interface AdvisorProcedureProtection {
1267
1272
  * design — see `isUnboundedAiGeneration`).
1268
1273
  */
1269
1274
  unboundedAiGeneration?: boolean;
1275
+ /**
1276
+ * `true` when the chain carries `.use(authorize(...))` from `@lunora/server`: the procedure is behind a
1277
+ * permission check, so a CAPTCHA is not expected. `undefined` from a feeder predating this field, which
1278
+ * leaves the CAPTCHA lint firing.
1279
+ */
1280
+ usesAuthorize?: boolean;
1270
1281
  /** `true` when the chain carries `.use(verifyTurnstile(...))` or a `protectPublic({ captcha })` bundle. */
1271
1282
  usesCaptcha: boolean;
1272
1283
  /** `true` when the chain carries `.use(emailGateMiddleware(...))` from `@lunora/auth`. Read by the `signup_mutation_without_disposable_gating` lint (paired with public visibility + a user-table write). */
@@ -1477,7 +1488,7 @@ interface AdvisorRatelimitKeySelector {
1477
1488
  * result of a `ctx.db.<table>.findMany()` / `.findFirst()` / `.get()` read, or a
1478
1489
  * `ctx.db.query("<table>")…collect()` fluent chain — returned directly (or through
1479
1490
  * one local `const` hop) with no hand-built projection. The shared input for the
1480
- * `output_projection_missing_on_public_read` lint, which keeps only `visibility
1491
+ * output_projection_missing_on_public_read lint, which keeps only `visibility
1481
1492
  * === "public"` rows with no `.output(...)` / `.use(mask(...))` on the chain and
1482
1493
  * joins `table` against the schema's PII-named columns before flagging. Produced by
1483
1494
  * the codegen feeder; runtime callers don't supply it, so the lint finds nothing
@@ -3028,7 +3039,7 @@ declare const aiUnboundedGenerationPublic: Lint;
3028
3039
  * Flags an app that opts into `allowUnauthenticatedShardAccess: true` while its
3029
3040
  * schema has an RLS gap (no `.rls("required")`, or a `.public()` table).
3030
3041
  *
3031
- * `allowUnauthenticatedShardAccess` (a `WorkerOptions` field consumed by
3042
+ * allowUnauthenticatedShardAccess (a `WorkerOptions` field consumed by
3032
3043
  * `createWorker(...)`) turns off the fail-closed default that denies a shard
3033
3044
  * lookup for a request with no verified identity. That is a deliberate, opt-in
3034
3045
  * posture switch — appropriate for a public/anonymous-first shard resolver — but
@@ -3294,8 +3305,8 @@ declare const commitOrderedHardDelete: Lint;
3294
3305
  * built one hop earlier from `args`), any caller can hand in another tenant's
3295
3306
  * key and reach that tenant's container instance. The fix is to derive the
3296
3307
  * key from a server-trusted identity (`` `${ctx.auth.userId}` ``) or a record
3297
- * the caller owns — a key that references `ctx` is treated as scoped and is
3298
- * not flagged. `.any()`/`.pool()` are not sinks (they take no key).
3308
+ * the caller owns. Only that identity, or a db read bound to it, scopes a key:
3309
+ * `ctx.env.PREFIX` is the same for every caller and does not. `.any()`/`.pool()` are not sinks (they take no key).
3299
3310
  *
3300
3311
  * Runs only when the codegen feeder supplies container key-access evidence
3301
3312
  * (`context.containerKeyAccesses`); a runtime caller flags nothing. One
@@ -3852,8 +3863,9 @@ declare const insertManyUnsafeUserData: Lint;
3852
3863
  * `args.*`, or a key built one hop earlier from `args`), any caller can hand in
3853
3864
  * another user's key and read, overwrite, or delete that user's entry. The fix is
3854
3865
  * to prefix every key with a server-trusted identity (`` `${ctx.auth.userId}:…` ``)
3855
- * so a caller can only ever address their own entries — a key that references
3856
- * `ctx` is treated as scoped and is not flagged. `list` is not a sink (it takes a
3866
+ * so a caller can only ever address their own entries. Only the caller's `ctx.auth`
3867
+ * identity, or a db read bound to it, scopes a key: a server-trusted value the same
3868
+ * for every caller (`ctx.env.PREFIX`) does not. `list` is not a sink (it takes a
3857
3869
  * prefix, not a per-entry key).
3858
3870
  *
3859
3871
  * Runs only when the codegen feeder supplies KV key-access evidence
@@ -4732,8 +4744,8 @@ declare const storageGenerateUploadUrlNoContentTypePin: Lint;
4732
4744
  * a key built one hop earlier from `args`), any caller can name any object — reading,
4733
4745
  * overwriting, or deleting another user's file. The fix is to prefix the key with a
4734
4746
  * server-trusted identity (`` `${ctx.auth.userId}/…` ``) or to resolve the object
4735
- * through a record the caller is known to own; a key that references `ctx` is treated
4736
- * as scoped and is not flagged.
4747
+ * through a record the caller is known to own. Only that identity, or a db read bound
4748
+ * to it, scopes a key: `ctx.env.PREFIX` is the same for every caller and does not.
4737
4749
  *
4738
4750
  * Runs only when the codegen feeder supplies storage-key evidence
4739
4751
  * (`context.storageKeyAccesses`); a runtime caller flags nothing. One finding per
@@ -5026,8 +5038,9 @@ declare const userCreatingMutationWithoutCaptcha: Lint;
5026
5038
  * value built one hop earlier from `args`), any caller can hand in another
5027
5039
  * tenant's namespace and read or poison that tenant's vectors. The fix is to
5028
5040
  * derive the namespace from a server-trusted identity (`` `${ctx.auth.orgId}` ``)
5029
- * so a caller can only ever address their own partition — a namespace that
5030
- * references `ctx` is treated as scoped and is not flagged.
5041
+ * so a caller can only ever address their own partition. Only the caller's
5042
+ * `ctx.auth` identity, or a database read bound to it, scopes a namespace: a
5043
+ * server-trusted value the same for every caller (`ctx.env.PREFIX`) does not.
5031
5044
  *
5032
5045
  * Runs only when the codegen feeder supplies vector-namespace evidence
5033
5046
  * (`context.vectorNamespaceAccesses`); a runtime caller flags nothing. One
package/dist/index.d.ts CHANGED
@@ -465,7 +465,7 @@ interface AdvisorCron {
465
465
  }
466
466
  /**
467
467
  * One CDC export-sink construction discovered in a function body — the input the
468
- * `export_sink_misconfigured` lint consumes. Produced by the codegen feeder,
468
+ * export_sink_misconfigured lint consumes. Produced by the codegen feeder,
469
469
  * which walks the lunora source for the three sink factories the export tap
470
470
  * (plan 170) ships: `defineExportSink({ name, deliver })`,
471
471
  * `webhookExportSink({ name, url, … })`, and `r2Sink({ name, bucket, … })`.
@@ -523,7 +523,7 @@ interface AdvisorFailOpenGuard {
523
523
  }
524
524
  /**
525
525
  * One `ctx.flags` read discovered lexically inside a `query(...)` handler body —
526
- * the input the `flag_read_in_subscription` lint consumes. Produced by the
526
+ * the input the flag_read_in_subscription lint consumes. Produced by the
527
527
  * codegen feeder, which walks each exported query's handler with ts-morph and
528
528
  * records reads of the flag-evaluation surface (`ctx.flags.boolean(...)`,
529
529
  * `ctx.flags.string(...)`, `ctx.flags.details.number(...)`, …).
@@ -1128,10 +1128,15 @@ interface AdvisorOwnerFieldWrite {
1128
1128
  ownerScoped?: true;
1129
1129
  /** Who the site runs on behalf of — see {@link AdvisorCallSiteScope}. */
1130
1130
  scope: AdvisorCallSiteScope;
1131
+ /**
1132
+ * Set when every caller is an `internal*` procedure, the only `internal` writes the lint trusts. A lifecycle or
1133
+ * channel registration is `internal` too, but a connected client triggers it with its own payload.
1134
+ */
1135
+ trustedInternal?: true;
1131
1136
  /**
1132
1137
  * Visibility of the enclosing procedure. `internal` procedures are not
1133
1138
  * reachable by a caller, so the "any caller can act as any user" premise
1134
- * does not hold there and the finding drops to `INFO`. `undefined` when the
1139
+ * does not hold there and the lint reports nothing for the write. `undefined` when the
1135
1140
  * feeder could not attribute the write to a registered procedure.
1136
1141
  */
1137
1142
  visibility?: "internal" | "public";
@@ -1139,7 +1144,7 @@ interface AdvisorOwnerFieldWrite {
1139
1144
  /**
1140
1145
  * One payment webhook-adapter construction (`createStripeAdapter` /
1141
1146
  * `createPolarAdapter` / `createAutumnAdapter` / `createDodoPaymentsAdapter`) —
1142
- * the shared input for the `payment_webhook_wide_tolerance` lint. The adapters
1147
+ * the shared input for the payment_webhook_wide_tolerance lint. The adapters
1143
1148
  * verify a webhook's signed timestamp against a `webhookToleranceSeconds` replay
1144
1149
  * window (default 300s); an implausibly wide window leaves the endpoint accepting
1145
1150
  * stale, replayable signed payloads long after capture. `toleranceSeconds`
@@ -1267,6 +1272,12 @@ interface AdvisorProcedureProtection {
1267
1272
  * design — see `isUnboundedAiGeneration`).
1268
1273
  */
1269
1274
  unboundedAiGeneration?: boolean;
1275
+ /**
1276
+ * `true` when the chain carries `.use(authorize(...))` from `@lunora/server`: the procedure is behind a
1277
+ * permission check, so a CAPTCHA is not expected. `undefined` from a feeder predating this field, which
1278
+ * leaves the CAPTCHA lint firing.
1279
+ */
1280
+ usesAuthorize?: boolean;
1270
1281
  /** `true` when the chain carries `.use(verifyTurnstile(...))` or a `protectPublic({ captcha })` bundle. */
1271
1282
  usesCaptcha: boolean;
1272
1283
  /** `true` when the chain carries `.use(emailGateMiddleware(...))` from `@lunora/auth`. Read by the `signup_mutation_without_disposable_gating` lint (paired with public visibility + a user-table write). */
@@ -1477,7 +1488,7 @@ interface AdvisorRatelimitKeySelector {
1477
1488
  * result of a `ctx.db.<table>.findMany()` / `.findFirst()` / `.get()` read, or a
1478
1489
  * `ctx.db.query("<table>")…collect()` fluent chain — returned directly (or through
1479
1490
  * one local `const` hop) with no hand-built projection. The shared input for the
1480
- * `output_projection_missing_on_public_read` lint, which keeps only `visibility
1491
+ * output_projection_missing_on_public_read lint, which keeps only `visibility
1481
1492
  * === "public"` rows with no `.output(...)` / `.use(mask(...))` on the chain and
1482
1493
  * joins `table` against the schema's PII-named columns before flagging. Produced by
1483
1494
  * the codegen feeder; runtime callers don't supply it, so the lint finds nothing
@@ -3028,7 +3039,7 @@ declare const aiUnboundedGenerationPublic: Lint;
3028
3039
  * Flags an app that opts into `allowUnauthenticatedShardAccess: true` while its
3029
3040
  * schema has an RLS gap (no `.rls("required")`, or a `.public()` table).
3030
3041
  *
3031
- * `allowUnauthenticatedShardAccess` (a `WorkerOptions` field consumed by
3042
+ * allowUnauthenticatedShardAccess (a `WorkerOptions` field consumed by
3032
3043
  * `createWorker(...)`) turns off the fail-closed default that denies a shard
3033
3044
  * lookup for a request with no verified identity. That is a deliberate, opt-in
3034
3045
  * posture switch — appropriate for a public/anonymous-first shard resolver — but
@@ -3294,8 +3305,8 @@ declare const commitOrderedHardDelete: Lint;
3294
3305
  * built one hop earlier from `args`), any caller can hand in another tenant's
3295
3306
  * key and reach that tenant's container instance. The fix is to derive the
3296
3307
  * key from a server-trusted identity (`` `${ctx.auth.userId}` ``) or a record
3297
- * the caller owns — a key that references `ctx` is treated as scoped and is
3298
- * not flagged. `.any()`/`.pool()` are not sinks (they take no key).
3308
+ * the caller owns. Only that identity, or a db read bound to it, scopes a key:
3309
+ * `ctx.env.PREFIX` is the same for every caller and does not. `.any()`/`.pool()` are not sinks (they take no key).
3299
3310
  *
3300
3311
  * Runs only when the codegen feeder supplies container key-access evidence
3301
3312
  * (`context.containerKeyAccesses`); a runtime caller flags nothing. One
@@ -3852,8 +3863,9 @@ declare const insertManyUnsafeUserData: Lint;
3852
3863
  * `args.*`, or a key built one hop earlier from `args`), any caller can hand in
3853
3864
  * another user's key and read, overwrite, or delete that user's entry. The fix is
3854
3865
  * to prefix every key with a server-trusted identity (`` `${ctx.auth.userId}:…` ``)
3855
- * so a caller can only ever address their own entries — a key that references
3856
- * `ctx` is treated as scoped and is not flagged. `list` is not a sink (it takes a
3866
+ * so a caller can only ever address their own entries. Only the caller's `ctx.auth`
3867
+ * identity, or a db read bound to it, scopes a key: a server-trusted value the same
3868
+ * for every caller (`ctx.env.PREFIX`) does not. `list` is not a sink (it takes a
3857
3869
  * prefix, not a per-entry key).
3858
3870
  *
3859
3871
  * Runs only when the codegen feeder supplies KV key-access evidence
@@ -4732,8 +4744,8 @@ declare const storageGenerateUploadUrlNoContentTypePin: Lint;
4732
4744
  * a key built one hop earlier from `args`), any caller can name any object — reading,
4733
4745
  * overwriting, or deleting another user's file. The fix is to prefix the key with a
4734
4746
  * server-trusted identity (`` `${ctx.auth.userId}/…` ``) or to resolve the object
4735
- * through a record the caller is known to own; a key that references `ctx` is treated
4736
- * as scoped and is not flagged.
4747
+ * through a record the caller is known to own. Only that identity, or a db read bound
4748
+ * to it, scopes a key: `ctx.env.PREFIX` is the same for every caller and does not.
4737
4749
  *
4738
4750
  * Runs only when the codegen feeder supplies storage-key evidence
4739
4751
  * (`context.storageKeyAccesses`); a runtime caller flags nothing. One finding per
@@ -5026,8 +5038,9 @@ declare const userCreatingMutationWithoutCaptcha: Lint;
5026
5038
  * value built one hop earlier from `args`), any caller can hand in another
5027
5039
  * tenant's namespace and read or poison that tenant's vectors. The fix is to
5028
5040
  * derive the namespace from a server-trusted identity (`` `${ctx.auth.orgId}` ``)
5029
- * so a caller can only ever address their own partition — a namespace that
5030
- * references `ctx` is treated as scoped and is not flagged.
5041
+ * so a caller can only ever address their own partition. Only the caller's
5042
+ * `ctx.auth` identity, or a database read bound to it, scopes a namespace: a
5043
+ * server-trusted value the same for every caller (`ctx.env.PREFIX`) does not.
5031
5044
  *
5032
5045
  * Runs only when the codegen feeder supplies vector-namespace evidence
5033
5046
  * (`context.vectorNamespaceAccesses`); a runtime caller flags nothing. One
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- import{dedupeCacheKeys as c}from"./packem_shared/dedupeCacheKeys-DtBOHffV.mjs";import d from"./packem_shared/fanOutBreadth-CBtmZnoh.mjs";import u from"./packem_shared/hotShard-BwGYZ3Tq.mjs";import h from"./packem_shared/indexUtilization-CmtN9-HA.mjs";import g from"./packem_shared/actionFetchSsrf-B7FqsLWm.mjs";import b from"./packem_shared/actionWithoutErrorHandling-DK3rB5c-.mjs";import y from"./packem_shared/adminRouteWithoutGuard-CcdlN75o.mjs";import S from"./packem_shared/aiRawRunEscapeHatch-CzIaQf_v.mjs";import w from"./packem_shared/aiRunWithoutLogging-Ct5MeKWe.mjs";import v from"./packem_shared/aiToolSideEffectPromptInjection-Ck_h8tFx.mjs";import A from"./packem_shared/aiUnboundedGenerationPublic-CzF3xBc3.mjs";import R from"./packem_shared/allowUnauthenticatedShardAccessEnabled-BQufF5Kb.mjs";import U from"./packem_shared/authApiCallWithoutHeaders-9PpziIB9.mjs";import T from"./packem_shared/authCsrfCheckDisabled-DYTzZFpp.mjs";import W from"./packem_shared/authEmailVerificationDisabled-OiNes7Dz.mjs";import I from"./packem_shared/authScimWithoutTransactions-CajXH24D.mjs";import x from"./packem_shared/authSecureCookiesDisabled-CA5zyqDZ.mjs";import C from"./packem_shared/authSessionFreshageZero-C3IYlYft.mjs";import N from"./packem_shared/authTrustedOriginsWildcard-661FRsGe.mjs";import k from"./packem_shared/browserAllowPrivateTargets-Cj5sizhv.mjs";import F from"./packem_shared/browserUserUrlWithoutAllowlist-Bi5ZWTF7.mjs";import M from"./packem_shared/circularFk-DtcWFJxK.mjs";import O from"./packem_shared/commitOrderedHardDelete-dmDVELQ0.mjs";import $ from"./packem_shared/containerInstanceKeyFromUserInput-DHQ2JL4x.mjs";import E from"./packem_shared/containerLongSleepAfter-DSGnfpfl.mjs";import D from"./packem_shared/containerOversizedInstance-INKmy3-D.mjs";import P from"./packem_shared/containerPublicInternet-Csh5_RwX.mjs";import L from"./packem_shared/containerRuntimeEgressRelaxation-J6rpfvr8.mjs";import q from"./packem_shared/containerStartEnableInternetOverride-Bxbmrpwe.mjs";import K from"./packem_shared/countWithoutIndex-CTbdpLyE.mjs";import _ from"./packem_shared/cronEveryMinute-BjdRdTEz.mjs";import G from"./packem_shared/crossModuleTableWrite-DuIFwf3x.mjs";import z from"./packem_shared/dispatchCycle-BwuXRDiL.mjs";import H from"./packem_shared/duplicateIndex-DkuQfUJ7.mjs";import B from"./packem_shared/emptyIndex-CeS4ZF5O.mjs";import j from"./packem_shared/errorWithoutCatalog-Dib0sdSD.mjs";import V from"./packem_shared/exportSinkMisconfigured-JfbAx9AI.mjs";import Q from"./packem_shared/externalSourceIncrementalNoDeletePath-DrcLlb76.mjs";import X from"./packem_shared/externalSourceOnGlobal-WQbJ74fq.mjs";import Z from"./packem_shared/externalSourceUnscoped-BxU2uSXk.mjs";import J from"./packem_shared/filterAfterIndexScan-BTHjxkNi.mjs";import Y from"./packem_shared/filterOnPrimaryKey-DeRYfLa7.mjs";import ee from"./packem_shared/filterWithoutIndex-8VrXwbq5.mjs";import oe from"./packem_shared/flagGatesSecurityWithUnsafeDefault-CJK9sKcH.mjs";import re from"./packem_shared/flagReadInSubscription-DabIhYGD.mjs";import te from"./packem_shared/geoIndexFieldNotGeopoint-DcFi2zOK.mjs";import ie from"./packem_shared/geoIndexUnused-DgVtk2z_.mjs";import ne from"./packem_shared/globalTableNearColumnLimit-CTvIcQ5e.mjs";import ae from"./packem_shared/hardcodedSecret-Bw_4FYrs.mjs";import me from"./packem_shared/httpActionMissingAuthGuard-D58Vnjr0.mjs";import se from"./packem_shared/httpActionResponseHeaderInjection-Yn1pbKZ8.mjs";import le from"./packem_shared/hyperdriveOutsideAction-CPDdGP2g.mjs";import pe from"./packem_shared/identityUndeclaredClaimTrusted-Z-9ob8F2.mjs";import fe from"./packem_shared/imagesUrlSourceFromUserInput-a2CZ-Xnj.mjs";import ce from"./packem_shared/indexReferencesUnknownField-Bs2DiZqb.mjs";import de from"./packem_shared/insertManyUnsafeUserData-CSvy65sr.mjs";import ue from"./packem_shared/kvUnscopedUserKeyIdor-D0O2alyn.mjs";import he from"./packem_shared/mailInboundDispatchWithoutVerify-CWwqXyPX.mjs";import ge from"./packem_shared/mailRecipientFromRequestInput-BMrAJjNK.mjs";import be from"./packem_shared/maskUncoveredPiiColumn-BJ1prEd0.mjs";import ye from"./packem_shared/maskWeakHashStrategyOnPii-dQPsGXl0.mjs";import Se from"./packem_shared/maskedRelationLeakViaWith-CIFij6vE.mjs";import{e as a}from"./packem_shared/finding-NrKO8idM.mjs";import we from"./packem_shared/mutatorFullRowReplace-NuqUCVOI.mjs";import ve from"./packem_shared/mutatorWithoutOwnerScope-BoS81ns0.mjs";import Ae from"./packem_shared/nondeterministicQueryMutation-DA_Lq_IE.mjs";import Re from"./packem_shared/normalizeIdUsedAsAuthorization-BXN-Can6.mjs";import Ue from"./packem_shared/notifyMissingPushConfig-BYks8FAs.mjs";import Te from"./packem_shared/notifySendOutsideAction-BJrDkr4h.mjs";import We from"./packem_shared/openShardAccess-CVMAgmmY.mjs";import Ie from"./packem_shared/outputProjectionMissingOnPublicRead-BPS-eg2q.mjs";import xe from"./packem_shared/ownerFieldFromArgsNotAuth-BmKLZxrX.mjs";import Ce from"./packem_shared/paymentCreateWithoutAuthorize-CdenWpXD.mjs";import Ne from"./packem_shared/paymentWebhookWideTolerance-D9i3Vb1n.mjs";import ke from"./packem_shared/plaintextSecretInWranglerVariables-Bs1RvhjG.mjs";import Fe from"./packem_shared/policyReferencesUnknownTable-DiQYFRFY.mjs";import Me from"./packem_shared/privilegedDispatchUnvalidatedPayload-BJL0JNzG.mjs";import Oe from"./packem_shared/privilegedFanoutFromPublicProcedure-Byw3Prsi.mjs";import $e from"./packem_shared/procedureWithoutStructuredEvent-na08a0M1.mjs";import Ee from"./packem_shared/publicArgumentUsesAny-BDEvMA8Q.mjs";import De from"./packem_shared/publicMutationWithoutRatelimit-DAxh8tL0.mjs";import Pe from"./packem_shared/publicTableRlsOptoutConfusion-DMqePR7i.mjs";import Le from"./packem_shared/queueDispatchCycle-84yt1IR-.mjs";import qe from"./packem_shared/queueWithoutDlq-CF_xUgE_.mjs";import Ke from"./packem_shared/r2sqlOutsideAction-BdLiLOAX.mjs";import _e from"./packem_shared/ratelimitDefaultMemoryStore-Dj0Kk7t9.mjs";import Ge from"./packem_shared/ratelimitKeySpoofableOrGlobal-VSGOuu5X.mjs";import ze from"./packem_shared/ratelimitMiddlewareFailOpen-bweBVZ4J.mjs";import He from"./packem_shared/relationReferencesUnknownField-Cb9BSxHl.mjs";import Be from"./packem_shared/relationReferencesUnknownTable-COkvw71e.mjs";import je from"./packem_shared/rlsUncoveredTable-e2FhD6Nr.mjs";import Ve from"./packem_shared/selfRescheduleWithoutProgress-HoknmezK.mjs";import Qe from"./packem_shared/shapeTargetsGlobalTable-CYRV8OvU.mjs";import Xe from"./packem_shared/shapeUnknownTable-6virkUOz.mjs";import Ze from"./packem_shared/signupMutationWithoutDisposableGating-nopEfEEK.mjs";import Je from"./packem_shared/softDeleteIncludeDeletedFromArgs-C7Ugg4zb.mjs";import Ye from"./packem_shared/sqlInjectionRisk-CSKho3Vk.mjs";import eo from"./packem_shared/storageGenerateUploadUrlNoContentTypePin-BlOPGwhZ.mjs";import oo from"./packem_shared/storageKeyFromUserArgs-BuoTsz-h.mjs";import ro from"./packem_shared/storagePresignedUrlForPrivateContent-l-EwrAfj.mjs";import to from"./packem_shared/storageUploadWithoutContentTypeAllowlist-JmITAazT.mjs";import io from"./packem_shared/storageUploadWithoutMaxSize-DlhE1I98.mjs";import no from"./packem_shared/tableWithoutInsert-CgQyPF1P.mjs";import ao from"./packem_shared/throughRelationMissingUniqueIndex-DfVfPdjK.mjs";import mo from"./packem_shared/topicTooManySubscriptions-B1SiGfHM.mjs";import so from"./packem_shared/ttlFieldNotTimestamp-BM9uNTT8.mjs";import{s as lo,q as po,c as fo}from"./packem_shared/helpers-YAAwOBMH.mjs";import co from"./packem_shared/unboundedCollectOnOpenRange-DDGNuKks.mjs";import uo from"./packem_shared/unboundedLoop-CUF9Wdxa.mjs";import ho from"./packem_shared/unboundedStringArgument-jZnCbwB0.mjs";import go from"./packem_shared/unindexedForeignKey-ClyKvTnR.mjs";import bo from"./packem_shared/unindexedRelationTarget-C2t48b-z.mjs";import yo from"./packem_shared/unrestrictedWhereBranch-CcIBmHik.mjs";import So from"./packem_shared/userCreatingMutationWithoutCaptcha-8mtYqiGy.mjs";import wo from"./packem_shared/vectorsNamespaceFromUserInput-537Bt2vT.mjs";import vo from"./packem_shared/workflowDuplicateStepName-B6eAJzwA.mjs";import Ao from"./packem_shared/workflowUnknownTarget-DdG3cUPH.mjs";import Ro from"./packem_shared/workflowUnused-CSKRWTd_.mjs";import{callSiteCallers as Gt,callSiteDescription as zt,callSiteLabel as Ht,callSiteMetadata as Bt,helperRole as jt,isReachableSite as Vt,readCallSiteCallers as Qt}from"./packem_shared/callSiteCallers-DArHfQSU.mjs";import{compareToBaseline as Zt,parseAdvisorMap as Jt}from"./packem_shared/compareToBaseline-CbHQTuNW.mjs";import{gradeFromScore as ei}from"./packem_shared/gradeFromScore-KSt58rj1.mjs";import{MAP_VERSION as ri,byCodepoint as ti,scoreAdvisor as ii}from"./packem_shared/MAP_VERSION-BdyirFdd.mjs";import{default as ai}from"./packem_shared/classifySensitivity-JnjaTGYi.mjs";import{fromServerSchema as si}from"./packem_shared/fromServerSchema-KWJd4PLE.mjs";const Uo={convex:"migrating/from-convex",firebase:"migrating/from-firebase",supabase:"migrating/from-supabase"},m={categories:["SCHEMA"],description:"A migrated-away platform's SDK is still imported from `lunora/` source. The code compiles and typechecks, so a half-finished port keeps reading from the old platform at runtime and the two stores silently drift apart.",facing:"INTERNAL",level:"WARN",name:"migration_stale_import",remediation:"Replace the call with its Lunora equivalent and drop the dependency. If the import is deliberate — a second data source you still read from — move it out of `lunora/` so it is not mistaken for an unfinished migration.",run:r=>r.staleMigrationImports===void 0?[]:r.staleMigrationImports.map(e=>a(m,{cacheKey:`migration_stale_import:${e.file}:${e.line.toString()}:${e.moduleSpecifier}`,detail:`\`${e.file}\` (line ${e.line.toString()}) still imports \`${e.moduleSpecifier}\`. Finish the port — see \`${Uo[e.platform]}\` — or move the import out of \`lunora/\` if you genuinely still read from ${e.platform}.`,metadata:{file:e.file,line:e.line,moduleSpecifier:e.moduleSpecifier,platform:e.platform}})),source:"static",title:"Stale migration import"},To=new Map([["global",{level:"WARN",scope:r=>`it reads the whole D1 table "${r}" over a cross-region round trip`}],["root",{level:"WARN",scope:r=>`it loads every row of "${r}" from the root Durable Object's SQLite into memory`}],["shardBy",{level:"INFO",scope:r=>`"${r}" is \`.shardBy()\`, so this collects one shard's rows rather than the whole table — bounded by a single tenant's row count`}]]),Wo={level:"WARN",scope:r=>`it loads every row of "${r}"`},s={categories:["PERFORMANCE"],description:"A query calls `.collect()` with no `.withIndex()` and no `.filter()`, so it materializes every row of the table. Any live subscription over it also re-sends that whole result to every subscribed client on every write to the table.",facing:"EXTERNAL",level:"WARN",name:"unbounded_collect",remediation:'Narrow the read with `.withIndex("name", (q) => q.eq(...))`, cap it with `.take(n)`, or page it with `.paginate(args.paginationOpts)` so neither the scan nor the subscription payload grows with the table.',run:r=>{const e=[],n=lo(r.schema);for(const o of r.queries??[]){if(o.terminal!=="collect"||o.hasIndex||o.table===""||o.hasFilter)continue;const t=n.get(o.table),{level:i,scope:l}=To.get(t??"")??Wo,p=po(o),f=i==="WARN"?` A live subscription over this query records a whole-table dependency, so every write to "${o.table}" re-runs it and re-sends the full result to each subscribed socket.`:" Cap it with `.take(n)` if that count can grow.";e.push(a(s,{cacheKey:`unbounded_collect:${o.file}:${o.line.toString()}:${o.table}`,detail:`Query on "${o.table}" at ${p} calls .collect() with no index and no filter — ${l(o.table)}.${f}`,level:i,metadata:{...fo(o),shardKind:t??"unknown",table:o.table}}))}return e},source:"static",title:"Unbounded collect"},Io=[ce,Be,He,Ao,vo,Xe,Q,X,Z,B,ne,j,te,ie,V,so,O,M,K,G,go,bo,ao,H,no,Ro,Le,qe,_,mo,Y,ee,J,s,co,uo,z,Ve,Qe,we,ve,Ae,le,Ke,U,Fe,je,be,ye,E,D,P,De,yo,So,Ze,Ee,ho,ae,Ye,y,Ce,he,_e,k,Oe,$e,de,A,g,b,xe,oo,ue,$,S,w,wo,ge,F,Me,q,L,I,N,T,x,W,C,fe,Ge,Pe,R,We,to,io,eo,ro,me,se,ze,oe,re,v,pe,Ne,Je,Se,Ie,Re,Te,Ue,ke,m],xo=[u,h,d],Co=[...Io,...xo],qt=(r,e={})=>{const n=e.lints??Co,o=[];for(const t of n)if(!(e.source!==void 0&&t.source!==e.source))try{o.push(...t.run(r))}catch(i){o.push({cacheKey:`advisor_lint_failed:${t.name}`,categories:t.categories,description:"An advisor lint threw while running, so its check did not run. This is a bug in the lint, not in your app.",detail:`The \`${t.name}\` lint threw: ${i instanceof Error?i.message:String(i)}. Its findings are missing from this run.`,facing:"INTERNAL",level:t.level,metadata:{lint:t.name},name:"advisor_lint_failed",remediation:"Report the error with the source shape that triggered it. Pass `--no-strict-advisories` to deploy past it in the meantime.",title:`Advisor lint \`${t.name}\` failed`})}return c(o)};export{Co as ALL_LINTS,ri as MAP_VERSION,xo as RUNTIME_LINTS,Io as STATIC_LINTS,g as actionFetchSsrf,b as actionWithoutErrorHandling,y as adminRouteWithoutGuard,S as aiRawRunEscapeHatch,w as aiRunWithoutLogging,v as aiToolSideEffectPromptInjection,A as aiUnboundedGenerationPublic,R as allowUnauthenticatedShardAccessEnabled,U as authApiCallWithoutHeaders,T as authCsrfCheckDisabled,W as authEmailVerificationDisabled,I as authScimWithoutTransactions,x as authSecureCookiesDisabled,C as authSessionFreshageZero,N as authTrustedOriginsWildcard,k as browserAllowPrivateTargets,F as browserUserUrlWithoutAllowlist,ti as byCodepoint,Gt as callSiteCallers,zt as callSiteDescription,Ht as callSiteLabel,Bt as callSiteMetadata,M as circularFk,ai as classifySensitivity,O as commitOrderedHardDelete,Zt as compareToBaseline,$ as containerInstanceKeyFromUserInput,E as containerLongSleepAfter,D as containerOversizedInstance,P as containerPublicInternet,L as containerRuntimeEgressRelaxation,q as containerStartEnableInternetOverride,K as countWithoutIndex,_ as cronEveryMinute,G as crossModuleTableWrite,c as dedupeCacheKeys,z as dispatchCycle,H as duplicateIndex,B as emptyIndex,j as errorWithoutCatalog,V as exportSinkMisconfigured,Q as externalSourceIncrementalNoDeletePath,X as externalSourceOnGlobal,Z as externalSourceUnscoped,d as fanOutBreadth,J as filterAfterIndexScan,Y as filterOnPrimaryKey,ee as filterWithoutIndex,oe as flagGatesSecurityWithUnsafeDefault,re as flagReadInSubscription,si as fromServerSchema,te as geoIndexFieldNotGeopoint,ie as geoIndexUnused,ne as globalTableNearColumnLimit,ei as gradeFromScore,ae as hardcodedSecret,jt as helperRole,u as hotShard,me as httpActionMissingAuthGuard,se as httpActionResponseHeaderInjection,le as hyperdriveOutsideAction,pe as identityUndeclaredClaimTrusted,fe as imagesUrlSourceFromUserInput,ce as indexReferencesUnknownField,h as indexUtilization,de as insertManyUnsafeUserData,Vt as isReachableSite,ue as kvUnscopedUserKeyIdor,he as mailInboundDispatchWithoutVerify,ge as mailRecipientFromRequestInput,be as maskUncoveredPiiColumn,ye as maskWeakHashStrategyOnPii,Se as maskedRelationLeakViaWith,we as mutatorFullRowReplace,ve as mutatorWithoutOwnerScope,Ae as nondeterministicQueryMutation,Re as normalizeIdUsedAsAuthorization,Ue as notifyMissingPushConfig,Te as notifySendOutsideAction,We as openShardAccess,Ie as outputProjectionMissingOnPublicRead,xe as ownerFieldFromArgsNotAuth,Jt as parseAdvisorMap,Ce as paymentCreateWithoutAuthorize,Ne as paymentWebhookWideTolerance,ke as plaintextSecretInWranglerVariables,Fe as policyReferencesUnknownTable,Me as privilegedDispatchUnvalidatedPayload,Oe as privilegedFanoutFromPublicProcedure,$e as procedureWithoutStructuredEvent,Ee as publicArgumentUsesAny,De as publicMutationWithoutRatelimit,Pe as publicTableRlsOptoutConfusion,Le as queueDispatchCycle,qe as queueWithoutDlq,Ke as r2sqlOutsideAction,_e as ratelimitDefaultMemoryStore,Ge as ratelimitKeySpoofableOrGlobal,ze as ratelimitMiddlewareFailOpen,Qt as readCallSiteCallers,He as relationReferencesUnknownField,Be as relationReferencesUnknownTable,je as rlsUncoveredTable,qt as runAdvisor,ii as scoreAdvisor,Ve as selfRescheduleWithoutProgress,Qe as shapeTargetsGlobalTable,Xe as shapeUnknownTable,Ze as signupMutationWithoutDisposableGating,Je as softDeleteIncludeDeletedFromArgs,Ye as sqlInjectionRisk,eo as storageGenerateUploadUrlNoContentTypePin,oo as storageKeyFromUserArgs,ro as storagePresignedUrlForPrivateContent,to as storageUploadWithoutContentTypeAllowlist,io as storageUploadWithoutMaxSize,no as tableWithoutInsert,ao as throughRelationMissingUniqueIndex,mo as topicTooManySubscriptions,so as ttlFieldNotTimestamp,co as unboundedCollectOnOpenRange,uo as unboundedLoop,ho as unboundedStringArgument,go as unindexedForeignKey,bo as unindexedRelationTarget,yo as unrestrictedWhereBranch,So as userCreatingMutationWithoutCaptcha,wo as vectorsNamespaceFromUserInput,vo as workflowDuplicateStepName,Ao as workflowUnknownTarget,Ro as workflowUnused};
1
+ import{dedupeCacheKeys as c}from"./packem_shared/dedupeCacheKeys-DtBOHffV.mjs";import d from"./packem_shared/fanOutBreadth-CBtmZnoh.mjs";import u from"./packem_shared/hotShard-BwGYZ3Tq.mjs";import h from"./packem_shared/indexUtilization-CmtN9-HA.mjs";import g from"./packem_shared/actionFetchSsrf-B7FqsLWm.mjs";import b from"./packem_shared/actionWithoutErrorHandling-DK3rB5c-.mjs";import y from"./packem_shared/adminRouteWithoutGuard-CcdlN75o.mjs";import S from"./packem_shared/aiRawRunEscapeHatch-CzIaQf_v.mjs";import w from"./packem_shared/aiRunWithoutLogging-Ct5MeKWe.mjs";import v from"./packem_shared/aiToolSideEffectPromptInjection-Ck_h8tFx.mjs";import A from"./packem_shared/aiUnboundedGenerationPublic-CzF3xBc3.mjs";import R from"./packem_shared/allowUnauthenticatedShardAccessEnabled-BQufF5Kb.mjs";import U from"./packem_shared/authApiCallWithoutHeaders-9PpziIB9.mjs";import T from"./packem_shared/authCsrfCheckDisabled-DYTzZFpp.mjs";import W from"./packem_shared/authEmailVerificationDisabled-OiNes7Dz.mjs";import I from"./packem_shared/authScimWithoutTransactions-CajXH24D.mjs";import x from"./packem_shared/authSecureCookiesDisabled-CA5zyqDZ.mjs";import C from"./packem_shared/authSessionFreshageZero-C3IYlYft.mjs";import N from"./packem_shared/authTrustedOriginsWildcard-661FRsGe.mjs";import k from"./packem_shared/browserAllowPrivateTargets-Cj5sizhv.mjs";import F from"./packem_shared/browserUserUrlWithoutAllowlist-Bi5ZWTF7.mjs";import M from"./packem_shared/circularFk-DtcWFJxK.mjs";import O from"./packem_shared/commitOrderedHardDelete-dmDVELQ0.mjs";import $ from"./packem_shared/containerInstanceKeyFromUserInput-DHQ2JL4x.mjs";import E from"./packem_shared/containerLongSleepAfter-DSGnfpfl.mjs";import D from"./packem_shared/containerOversizedInstance-INKmy3-D.mjs";import P from"./packem_shared/containerPublicInternet-Csh5_RwX.mjs";import L from"./packem_shared/containerRuntimeEgressRelaxation-J6rpfvr8.mjs";import q from"./packem_shared/containerStartEnableInternetOverride-Bxbmrpwe.mjs";import K from"./packem_shared/countWithoutIndex-CTbdpLyE.mjs";import _ from"./packem_shared/cronEveryMinute-BjdRdTEz.mjs";import G from"./packem_shared/crossModuleTableWrite-DuIFwf3x.mjs";import z from"./packem_shared/dispatchCycle-BwuXRDiL.mjs";import H from"./packem_shared/duplicateIndex-DkuQfUJ7.mjs";import B from"./packem_shared/emptyIndex-CeS4ZF5O.mjs";import j from"./packem_shared/errorWithoutCatalog-Dib0sdSD.mjs";import V from"./packem_shared/exportSinkMisconfigured-JfbAx9AI.mjs";import Q from"./packem_shared/externalSourceIncrementalNoDeletePath-DrcLlb76.mjs";import X from"./packem_shared/externalSourceOnGlobal-WQbJ74fq.mjs";import Z from"./packem_shared/externalSourceUnscoped-BxU2uSXk.mjs";import J from"./packem_shared/filterAfterIndexScan-BTHjxkNi.mjs";import Y from"./packem_shared/filterOnPrimaryKey-DeRYfLa7.mjs";import ee from"./packem_shared/filterWithoutIndex-8VrXwbq5.mjs";import oe from"./packem_shared/flagGatesSecurityWithUnsafeDefault-CJK9sKcH.mjs";import re from"./packem_shared/flagReadInSubscription-DabIhYGD.mjs";import te from"./packem_shared/geoIndexFieldNotGeopoint-DcFi2zOK.mjs";import ie from"./packem_shared/geoIndexUnused-DgVtk2z_.mjs";import ne from"./packem_shared/globalTableNearColumnLimit-CTvIcQ5e.mjs";import ae from"./packem_shared/hardcodedSecret-Bw_4FYrs.mjs";import me from"./packem_shared/httpActionMissingAuthGuard-D58Vnjr0.mjs";import se from"./packem_shared/httpActionResponseHeaderInjection-Yn1pbKZ8.mjs";import le from"./packem_shared/hyperdriveOutsideAction-CPDdGP2g.mjs";import pe from"./packem_shared/identityUndeclaredClaimTrusted-Z-9ob8F2.mjs";import fe from"./packem_shared/imagesUrlSourceFromUserInput-a2CZ-Xnj.mjs";import ce from"./packem_shared/indexReferencesUnknownField-Bs2DiZqb.mjs";import de from"./packem_shared/insertManyUnsafeUserData-CSvy65sr.mjs";import ue from"./packem_shared/kvUnscopedUserKeyIdor-D0O2alyn.mjs";import he from"./packem_shared/mailInboundDispatchWithoutVerify-CWwqXyPX.mjs";import ge from"./packem_shared/mailRecipientFromRequestInput-BMrAJjNK.mjs";import be from"./packem_shared/maskUncoveredPiiColumn-BJ1prEd0.mjs";import ye from"./packem_shared/maskWeakHashStrategyOnPii-dQPsGXl0.mjs";import Se from"./packem_shared/maskedRelationLeakViaWith-CIFij6vE.mjs";import{e as a}from"./packem_shared/finding-NrKO8idM.mjs";import we from"./packem_shared/mutatorFullRowReplace-NuqUCVOI.mjs";import ve from"./packem_shared/mutatorWithoutOwnerScope-BoS81ns0.mjs";import Ae from"./packem_shared/nondeterministicQueryMutation-DA_Lq_IE.mjs";import Re from"./packem_shared/normalizeIdUsedAsAuthorization-BXN-Can6.mjs";import Ue from"./packem_shared/notifyMissingPushConfig-BYks8FAs.mjs";import Te from"./packem_shared/notifySendOutsideAction-BJrDkr4h.mjs";import We from"./packem_shared/openShardAccess-CVMAgmmY.mjs";import Ie from"./packem_shared/outputProjectionMissingOnPublicRead-BPS-eg2q.mjs";import xe from"./packem_shared/ownerFieldFromArgsNotAuth-CjiTwv4k.mjs";import Ce from"./packem_shared/paymentCreateWithoutAuthorize-CdenWpXD.mjs";import Ne from"./packem_shared/paymentWebhookWideTolerance-D9i3Vb1n.mjs";import ke from"./packem_shared/plaintextSecretInWranglerVariables-Bs1RvhjG.mjs";import Fe from"./packem_shared/policyReferencesUnknownTable-DiQYFRFY.mjs";import Me from"./packem_shared/privilegedDispatchUnvalidatedPayload-BJL0JNzG.mjs";import Oe from"./packem_shared/privilegedFanoutFromPublicProcedure-Byw3Prsi.mjs";import $e from"./packem_shared/procedureWithoutStructuredEvent-na08a0M1.mjs";import Ee from"./packem_shared/publicArgumentUsesAny-BDEvMA8Q.mjs";import De from"./packem_shared/publicMutationWithoutRatelimit-DAxh8tL0.mjs";import Pe from"./packem_shared/publicTableRlsOptoutConfusion-DMqePR7i.mjs";import Le from"./packem_shared/queueDispatchCycle-84yt1IR-.mjs";import qe from"./packem_shared/queueWithoutDlq-CF_xUgE_.mjs";import Ke from"./packem_shared/r2sqlOutsideAction-BdLiLOAX.mjs";import _e from"./packem_shared/ratelimitDefaultMemoryStore-Dj0Kk7t9.mjs";import Ge from"./packem_shared/ratelimitKeySpoofableOrGlobal-VSGOuu5X.mjs";import ze from"./packem_shared/ratelimitMiddlewareFailOpen-bweBVZ4J.mjs";import He from"./packem_shared/relationReferencesUnknownField-Cb9BSxHl.mjs";import Be from"./packem_shared/relationReferencesUnknownTable-COkvw71e.mjs";import je from"./packem_shared/rlsUncoveredTable-e2FhD6Nr.mjs";import Ve from"./packem_shared/selfRescheduleWithoutProgress-HoknmezK.mjs";import Qe from"./packem_shared/shapeTargetsGlobalTable-CYRV8OvU.mjs";import Xe from"./packem_shared/shapeUnknownTable-6virkUOz.mjs";import Ze from"./packem_shared/signupMutationWithoutDisposableGating-nopEfEEK.mjs";import Je from"./packem_shared/softDeleteIncludeDeletedFromArgs-C7Ugg4zb.mjs";import Ye from"./packem_shared/sqlInjectionRisk-CSKho3Vk.mjs";import eo from"./packem_shared/storageGenerateUploadUrlNoContentTypePin-BlOPGwhZ.mjs";import oo from"./packem_shared/storageKeyFromUserArgs-BuoTsz-h.mjs";import ro from"./packem_shared/storagePresignedUrlForPrivateContent-l-EwrAfj.mjs";import to from"./packem_shared/storageUploadWithoutContentTypeAllowlist-JmITAazT.mjs";import io from"./packem_shared/storageUploadWithoutMaxSize-DlhE1I98.mjs";import no from"./packem_shared/tableWithoutInsert-CgQyPF1P.mjs";import ao from"./packem_shared/throughRelationMissingUniqueIndex-DfVfPdjK.mjs";import mo from"./packem_shared/topicTooManySubscriptions-B1SiGfHM.mjs";import so from"./packem_shared/ttlFieldNotTimestamp-BM9uNTT8.mjs";import{s as lo,q as po,c as fo}from"./packem_shared/helpers-YAAwOBMH.mjs";import co from"./packem_shared/unboundedCollectOnOpenRange-DDGNuKks.mjs";import uo from"./packem_shared/unboundedLoop-CUF9Wdxa.mjs";import ho from"./packem_shared/unboundedStringArgument-jZnCbwB0.mjs";import go from"./packem_shared/unindexedForeignKey-ClyKvTnR.mjs";import bo from"./packem_shared/unindexedRelationTarget-C2t48b-z.mjs";import yo from"./packem_shared/unrestrictedWhereBranch-CcIBmHik.mjs";import So from"./packem_shared/userCreatingMutationWithoutCaptcha-NmAAdA7R.mjs";import wo from"./packem_shared/vectorsNamespaceFromUserInput-537Bt2vT.mjs";import vo from"./packem_shared/workflowDuplicateStepName-B6eAJzwA.mjs";import Ao from"./packem_shared/workflowUnknownTarget-DdG3cUPH.mjs";import Ro from"./packem_shared/workflowUnused-CSKRWTd_.mjs";import{callSiteCallers as Gt,callSiteDescription as zt,callSiteLabel as Ht,callSiteMetadata as Bt,helperRole as jt,isReachableSite as Vt,readCallSiteCallers as Qt}from"./packem_shared/callSiteCallers-DArHfQSU.mjs";import{compareToBaseline as Zt,parseAdvisorMap as Jt}from"./packem_shared/compareToBaseline-CbHQTuNW.mjs";import{gradeFromScore as ei}from"./packem_shared/gradeFromScore-KSt58rj1.mjs";import{MAP_VERSION as ri,byCodepoint as ti,scoreAdvisor as ii}from"./packem_shared/MAP_VERSION-BdyirFdd.mjs";import{default as ai}from"./packem_shared/classifySensitivity-JnjaTGYi.mjs";import{fromServerSchema as si}from"./packem_shared/fromServerSchema-KWJd4PLE.mjs";const Uo={convex:"migrating/from-convex",firebase:"migrating/from-firebase",supabase:"migrating/from-supabase"},m={categories:["SCHEMA"],description:"A migrated-away platform's SDK is still imported from `lunora/` source. The code compiles and typechecks, so a half-finished port keeps reading from the old platform at runtime and the two stores silently drift apart.",facing:"INTERNAL",level:"WARN",name:"migration_stale_import",remediation:"Replace the call with its Lunora equivalent and drop the dependency. If the import is deliberate — a second data source you still read from — move it out of `lunora/` so it is not mistaken for an unfinished migration.",run:r=>r.staleMigrationImports===void 0?[]:r.staleMigrationImports.map(e=>a(m,{cacheKey:`migration_stale_import:${e.file}:${e.line.toString()}:${e.moduleSpecifier}`,detail:`\`${e.file}\` (line ${e.line.toString()}) still imports \`${e.moduleSpecifier}\`. Finish the port — see \`${Uo[e.platform]}\` — or move the import out of \`lunora/\` if you genuinely still read from ${e.platform}.`,metadata:{file:e.file,line:e.line,moduleSpecifier:e.moduleSpecifier,platform:e.platform}})),source:"static",title:"Stale migration import"},To=new Map([["global",{level:"WARN",scope:r=>`it reads the whole D1 table "${r}" over a cross-region round trip`}],["root",{level:"WARN",scope:r=>`it loads every row of "${r}" from the root Durable Object's SQLite into memory`}],["shardBy",{level:"INFO",scope:r=>`"${r}" is \`.shardBy()\`, so this collects one shard's rows rather than the whole table — bounded by a single tenant's row count`}]]),Wo={level:"WARN",scope:r=>`it loads every row of "${r}"`},s={categories:["PERFORMANCE"],description:"A query calls `.collect()` with no `.withIndex()` and no `.filter()`, so it materializes every row of the table. Any live subscription over it also re-sends that whole result to every subscribed client on every write to the table.",facing:"EXTERNAL",level:"WARN",name:"unbounded_collect",remediation:'Narrow the read with `.withIndex("name", (q) => q.eq(...))`, cap it with `.take(n)`, or page it with `.paginate(args.paginationOpts)` so neither the scan nor the subscription payload grows with the table.',run:r=>{const e=[],n=lo(r.schema);for(const o of r.queries??[]){if(o.terminal!=="collect"||o.hasIndex||o.table===""||o.hasFilter)continue;const t=n.get(o.table),{level:i,scope:l}=To.get(t??"")??Wo,p=po(o),f=i==="WARN"?` A live subscription over this query records a whole-table dependency, so every write to "${o.table}" re-runs it and re-sends the full result to each subscribed socket.`:" Cap it with `.take(n)` if that count can grow.";e.push(a(s,{cacheKey:`unbounded_collect:${o.file}:${o.line.toString()}:${o.table}`,detail:`Query on "${o.table}" at ${p} calls .collect() with no index and no filter — ${l(o.table)}.${f}`,level:i,metadata:{...fo(o),shardKind:t??"unknown",table:o.table}}))}return e},source:"static",title:"Unbounded collect"},Io=[ce,Be,He,Ao,vo,Xe,Q,X,Z,B,ne,j,te,ie,V,so,O,M,K,G,go,bo,ao,H,no,Ro,Le,qe,_,mo,Y,ee,J,s,co,uo,z,Ve,Qe,we,ve,Ae,le,Ke,U,Fe,je,be,ye,E,D,P,De,yo,So,Ze,Ee,ho,ae,Ye,y,Ce,he,_e,k,Oe,$e,de,A,g,b,xe,oo,ue,$,S,w,wo,ge,F,Me,q,L,I,N,T,x,W,C,fe,Ge,Pe,R,We,to,io,eo,ro,me,se,ze,oe,re,v,pe,Ne,Je,Se,Ie,Re,Te,Ue,ke,m],xo=[u,h,d],Co=[...Io,...xo],qt=(r,e={})=>{const n=e.lints??Co,o=[];for(const t of n)if(!(e.source!==void 0&&t.source!==e.source))try{o.push(...t.run(r))}catch(i){o.push({cacheKey:`advisor_lint_failed:${t.name}`,categories:t.categories,description:"An advisor lint threw while running, so its check did not run. This is a bug in the lint, not in your app.",detail:`The \`${t.name}\` lint threw: ${i instanceof Error?i.message:String(i)}. Its findings are missing from this run.`,facing:"INTERNAL",level:t.level,metadata:{lint:t.name},name:"advisor_lint_failed",remediation:"Report the error with the source shape that triggered it. Pass `--no-strict-advisories` to deploy past it in the meantime.",title:`Advisor lint \`${t.name}\` failed`})}return c(o)};export{Co as ALL_LINTS,ri as MAP_VERSION,xo as RUNTIME_LINTS,Io as STATIC_LINTS,g as actionFetchSsrf,b as actionWithoutErrorHandling,y as adminRouteWithoutGuard,S as aiRawRunEscapeHatch,w as aiRunWithoutLogging,v as aiToolSideEffectPromptInjection,A as aiUnboundedGenerationPublic,R as allowUnauthenticatedShardAccessEnabled,U as authApiCallWithoutHeaders,T as authCsrfCheckDisabled,W as authEmailVerificationDisabled,I as authScimWithoutTransactions,x as authSecureCookiesDisabled,C as authSessionFreshageZero,N as authTrustedOriginsWildcard,k as browserAllowPrivateTargets,F as browserUserUrlWithoutAllowlist,ti as byCodepoint,Gt as callSiteCallers,zt as callSiteDescription,Ht as callSiteLabel,Bt as callSiteMetadata,M as circularFk,ai as classifySensitivity,O as commitOrderedHardDelete,Zt as compareToBaseline,$ as containerInstanceKeyFromUserInput,E as containerLongSleepAfter,D as containerOversizedInstance,P as containerPublicInternet,L as containerRuntimeEgressRelaxation,q as containerStartEnableInternetOverride,K as countWithoutIndex,_ as cronEveryMinute,G as crossModuleTableWrite,c as dedupeCacheKeys,z as dispatchCycle,H as duplicateIndex,B as emptyIndex,j as errorWithoutCatalog,V as exportSinkMisconfigured,Q as externalSourceIncrementalNoDeletePath,X as externalSourceOnGlobal,Z as externalSourceUnscoped,d as fanOutBreadth,J as filterAfterIndexScan,Y as filterOnPrimaryKey,ee as filterWithoutIndex,oe as flagGatesSecurityWithUnsafeDefault,re as flagReadInSubscription,si as fromServerSchema,te as geoIndexFieldNotGeopoint,ie as geoIndexUnused,ne as globalTableNearColumnLimit,ei as gradeFromScore,ae as hardcodedSecret,jt as helperRole,u as hotShard,me as httpActionMissingAuthGuard,se as httpActionResponseHeaderInjection,le as hyperdriveOutsideAction,pe as identityUndeclaredClaimTrusted,fe as imagesUrlSourceFromUserInput,ce as indexReferencesUnknownField,h as indexUtilization,de as insertManyUnsafeUserData,Vt as isReachableSite,ue as kvUnscopedUserKeyIdor,he as mailInboundDispatchWithoutVerify,ge as mailRecipientFromRequestInput,be as maskUncoveredPiiColumn,ye as maskWeakHashStrategyOnPii,Se as maskedRelationLeakViaWith,we as mutatorFullRowReplace,ve as mutatorWithoutOwnerScope,Ae as nondeterministicQueryMutation,Re as normalizeIdUsedAsAuthorization,Ue as notifyMissingPushConfig,Te as notifySendOutsideAction,We as openShardAccess,Ie as outputProjectionMissingOnPublicRead,xe as ownerFieldFromArgsNotAuth,Jt as parseAdvisorMap,Ce as paymentCreateWithoutAuthorize,Ne as paymentWebhookWideTolerance,ke as plaintextSecretInWranglerVariables,Fe as policyReferencesUnknownTable,Me as privilegedDispatchUnvalidatedPayload,Oe as privilegedFanoutFromPublicProcedure,$e as procedureWithoutStructuredEvent,Ee as publicArgumentUsesAny,De as publicMutationWithoutRatelimit,Pe as publicTableRlsOptoutConfusion,Le as queueDispatchCycle,qe as queueWithoutDlq,Ke as r2sqlOutsideAction,_e as ratelimitDefaultMemoryStore,Ge as ratelimitKeySpoofableOrGlobal,ze as ratelimitMiddlewareFailOpen,Qt as readCallSiteCallers,He as relationReferencesUnknownField,Be as relationReferencesUnknownTable,je as rlsUncoveredTable,qt as runAdvisor,ii as scoreAdvisor,Ve as selfRescheduleWithoutProgress,Qe as shapeTargetsGlobalTable,Xe as shapeUnknownTable,Ze as signupMutationWithoutDisposableGating,Je as softDeleteIncludeDeletedFromArgs,Ye as sqlInjectionRisk,eo as storageGenerateUploadUrlNoContentTypePin,oo as storageKeyFromUserArgs,ro as storagePresignedUrlForPrivateContent,to as storageUploadWithoutContentTypeAllowlist,io as storageUploadWithoutMaxSize,no as tableWithoutInsert,ao as throughRelationMissingUniqueIndex,mo as topicTooManySubscriptions,so as ttlFieldNotTimestamp,co as unboundedCollectOnOpenRange,uo as unboundedLoop,ho as unboundedStringArgument,go as unindexedForeignKey,bo as unindexedRelationTarget,yo as unrestrictedWhereBranch,So as userCreatingMutationWithoutCaptcha,wo as vectorsNamespaceFromUserInput,vo as workflowDuplicateStepName,Ao as workflowUnknownTarget,Ro as workflowUnused};
@@ -0,0 +1 @@
1
+ import{e as r}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[];if(e.trustedInternal===!0)return[];const t=`\`${e.method}\` in ${o(e)}`,n={...s(e),field:e.field,method:e.method,visibility:e.visibility??"unknown"};return e.adminOnly?[r(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:n})]:e.visibility==="internal"?[r(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\` in a socket, channel or lifecycle handler. A connected client supplies that payload, so stamp \`${e.field}\` from the server-trusted identity.`,facing:"INTERNAL",level:"INFO",metadata:n})]:[r(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:n})]}),source:"static",title:"Ownership field written from args, not server identity"};export{a as default};
@@ -1 +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
+ import{e as i}from"./finding-NrKO8idM.mjs";import{m as a}from"./procedure-protections-DRQotu9I.mjs";import{f as r,d as s}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. A procedure that only a permitted caller may reach is not a bot target: gate it with `.use(authorize(...))` from `@lunora/server` instead.",run:t=>t.procedureProtections===void 0?[]:t.procedureProtections.filter(e=>r(e)&&(a(e.writesUserTable)||a(e.callsMail))&&!e.usesCaptcha&&e.usesAuthorize!==!0).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,...s(e),kind:e.kind,writesUserTable:e.writesUserTable}})),source:"static",title:"Account-creating / mail-sending write without a CAPTCHA"};export{o as default};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lunora/advisor",
3
- "version": "1.0.0-alpha.294",
3
+ "version": "1.0.0-alpha.296",
4
4
  "description": "Schema & query lints (splinter-style advisors) for Lunora, feeding the Studio Advisors view",
5
5
  "keywords": [
6
6
  "advisor",
@@ -47,7 +47,7 @@
47
47
  },
48
48
  "dependencies": {
49
49
  "@lunora/errors": ">=1.0.0-alpha.51 <2.0.0-0",
50
- "@lunora/server": "^1.0.0-alpha.268",
50
+ "@lunora/server": "^1.0.0-alpha.280",
51
51
  "@visulima/cron-parser": "2.0.0"
52
52
  },
53
53
  "engines": {
@@ -1 +0,0 @@
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};