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

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/README.md CHANGED
@@ -109,7 +109,7 @@ const findings = runAdvisor(context, { source: "static" });
109
109
  const map = scoreAdvisor(context.procedureProtections ?? [], findings);
110
110
 
111
111
  console.log(map.score, map.grade); // e.g. 84 "good"
112
- console.log(map.summary); // { clean: 9, exempt: 0, failing: 1, procedures: 12, rulesFired: 6, warned: 2 }
112
+ console.log(map.summary); // { clean: 9, exempt: 0, failing: 1, procedures: 12, rulesFired: 6, suppressed: 0, warned: 2 }
113
113
  ```
114
114
 
115
115
  Each procedure starts at 100 and loses each fired **rule's** severity weight (`ERROR` 20 / `WARN` 10 / `INFO` 5 — severity is the only input; a lint carries no weight of its own) — charged once however many times that rule fires — then rolls up into a weighted global mean: public handlers count double, internal ones and queries half. Findings that name no procedure (schema shape, wrangler config) land in a project bucket weighted against the procedure population, so schema debt genuinely moves the grade.
package/dist/index.d.mts CHANGED
@@ -860,6 +860,8 @@ interface AdvisorMaskProcedure {
860
860
  exportName: string;
861
861
  /** Source file relative to the lunora dir, no extension. */
862
862
  file: string;
863
+ /** 1-based start line of the declaring statement, when the feeder recorded it. */
864
+ line?: number;
863
865
  /**
864
866
  * The `(table, column)` pairs declared by the `mask(policies)` object passed
865
867
  * to `.use(mask(...))` in this procedure's builder chain. Empty when the
@@ -2160,6 +2162,19 @@ interface Finding {
2160
2162
  name: string;
2161
2163
  /** How to fix it — a doc URL or short imperative guidance. */
2162
2164
  remediation: string;
2165
+ /**
2166
+ * Set when an inline `// lunora-advisor-exempt <rule> -- <reason>` directive
2167
+ * accepts this finding. The finding stays in the list so every surface can show
2168
+ * it and its reason, but the gate, the health map and the blocking check ignore it.
2169
+ */
2170
+ suppressed?: {
2171
+ /** The directive's site, relative to the project root. */
2172
+ file: string;
2173
+ /** 1-based line of the directive. */
2174
+ line: number;
2175
+ /** The directive's trimmed reason, required to be non-empty. */
2176
+ reason: string;
2177
+ };
2163
2178
  /** Short headline for the finding. */
2164
2179
  title: string;
2165
2180
  }
@@ -5182,6 +5197,8 @@ interface MapSummary {
5182
5197
  procedures: number;
5183
5198
  /** Findings attributed to a scored row, after per-rule deduplication. */
5184
5199
  rulesFired: number;
5200
+ /** Findings accepted by an inline `lunora-advisor-exempt <rule>` directive. They score nothing and are not in `rulesFired`. */
5201
+ suppressed: number;
5185
5202
  /** Procedures scoring at or above the failing floor, but not clean. */
5186
5203
  warned: number;
5187
5204
  }
package/dist/index.d.ts CHANGED
@@ -860,6 +860,8 @@ interface AdvisorMaskProcedure {
860
860
  exportName: string;
861
861
  /** Source file relative to the lunora dir, no extension. */
862
862
  file: string;
863
+ /** 1-based start line of the declaring statement, when the feeder recorded it. */
864
+ line?: number;
863
865
  /**
864
866
  * The `(table, column)` pairs declared by the `mask(policies)` object passed
865
867
  * to `.use(mask(...))` in this procedure's builder chain. Empty when the
@@ -2160,6 +2162,19 @@ interface Finding {
2160
2162
  name: string;
2161
2163
  /** How to fix it — a doc URL or short imperative guidance. */
2162
2164
  remediation: string;
2165
+ /**
2166
+ * Set when an inline `// lunora-advisor-exempt <rule> -- <reason>` directive
2167
+ * accepts this finding. The finding stays in the list so every surface can show
2168
+ * it and its reason, but the gate, the health map and the blocking check ignore it.
2169
+ */
2170
+ suppressed?: {
2171
+ /** The directive's site, relative to the project root. */
2172
+ file: string;
2173
+ /** 1-based line of the directive. */
2174
+ line: number;
2175
+ /** The directive's trimmed reason, required to be non-empty. */
2176
+ reason: string;
2177
+ };
2163
2178
  /** Short headline for the finding. */
2164
2179
  title: string;
2165
2180
  }
@@ -5182,6 +5197,8 @@ interface MapSummary {
5182
5197
  procedures: number;
5183
5198
  /** Findings attributed to a scored row, after per-rule deduplication. */
5184
5199
  rulesFired: number;
5200
+ /** Findings accepted by an inline `lunora-advisor-exempt <rule>` directive. They score nothing and are not in `rulesFired`. */
5201
+ suppressed: number;
5185
5202
  /** Procedures scoring at or above the failing floor, but not clean. */
5186
5203
  warned: number;
5187
5204
  }
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-axEka4nd.mjs";import ye from"./packem_shared/maskWeakHashStrategyOnPii-CwgAXFSx.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-CUG59IOy.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-MQ5W2B6n.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-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};
@@ -0,0 +1 @@
1
+ import{readCallSiteCallers as S}from"./callSiteCallers-DArHfQSU.mjs";import{scoreProcedure as w,procedureWeight as b,coverageFromScore as k,scoreGlobal as M,projectWeight as j,gradeFromScore as N,weightFor as C,worstLevel as F}from"./gradeFromScore-KSt58rj1.mjs";import P from"./classifySensitivity-JnjaTGYi.mjs";const y=(e,t)=>e===t?0:e<t?-1:1,x=(e,t)=>y(e.name,t.name),A=(e,t)=>{const n=e[t];return typeof n=="string"?n:void 0},g=(e,t)=>`${e}#${t}`,I=(e,t,n,c)=>e===void 0?{level:t,name:n,occurrences:1,weight:c}:{level:F(e.level,t),name:n,occurrences:e.occurrences+1,weight:Math.max(e.weight,c)},R=(e,t)=>{const n=new Map;for(const o of e)n.set(g(o.file,o.exportName),new Map);const c=new Map;for(const o of t){const s=A(o.metadata,"file"),m=S(o.metadata),i=s===void 0?[]:m.flatMap(l=>n.get(g(s,l))??[]),d=i.length===0?[c]:i;for(const l of d)l.set(o.name,I(l.get(o.name),o.level,o.name,C(o.level)))}return{byProcedure:new Map([...n].map(([o,s])=>[o,[...s.values()].toSorted(x)])),project:[...c.values()].toSorted(x)}},W=(e,t,n)=>{const c={clean:0,exempt:0,failing:0,warned:0};let o=t.checks.length;for(const s of e)c[s.coverage]+=1,o+=s.checks.length;return{clean:c.clean,exempt:c.exempt,failing:c.failing,procedures:e.length,rulesFired:o,suppressed:n,warned:c.warned}},E=1,D=(e,t,n={})=>{const c=new Set(n.exempt),o=t.filter(r=>r.suppressed===void 0),s=R(e,o),m=e.map(r=>{const a=g(r.file,r.exportName),u=s.byProcedure.get(a)??[],h=w(u),p=c.has(a)||r.exempt===!0,v=P(r);return{checks:u,coverage:p?"exempt":k(h),...p?{exemptReason:r.exemptReason??""}:{},exportName:r.exportName,file:r.file,id:a,kind:r.kind,score:h,sensitivity:v,visibility:r.visibility,weight:p?0:b(r,v.level)}}).toSorted((r,a)=>y(r.id,a.id)),i={checks:s.project,score:w(s.project)},d=m.filter(r=>r.coverage!=="exempt"),l=d.reduce((r,a)=>r+a.weight,0),f=M([...d,{score:i.score,weight:j(l)}]);return{generatedAt:n.generatedAt??new Date().toISOString(),grade:N(f),procedures:m,project:i,score:f,summary:W(m,i,t.length-o.length),version:E}};export{E as MAP_VERSION,y as byCodepoint,D as scoreAdvisor};
@@ -1 +1 @@
1
- import{byCodepoint as f}from"./MAP_VERSION-MQ5W2B6n.mjs";const m=new Set(["clean","exempt","failing","warned"]),u=(e,r)=>{const c=new Map(e.map(s=>[s.name,s.occurrences]));return r.some(s=>s.occurrences>(c.get(s.name)??0))},n=e=>typeof e=="number"&&Number.isFinite(e),g=e=>Array.isArray(e)&&e.every(r=>{if(typeof r!="object"||r===null)return!1;const c=r;return typeof c.name=="string"&&n(c.occurrences)}),h=e=>{if(typeof e!="object"||e===null)return!1;const r=e;return typeof r.id=="string"&&n(r.score)&&typeof r.coverage=="string"&&m.has(r.coverage)&&g(r.checks)},y=e=>{if(typeof e!="object"||e===null)return!1;const r=e;return g(r.checks)&&n(r.score)},v=(e,r)=>{if(r.version!==e.version)return{comparable:!1,reason:"version-mismatch"};const c=new Map(r.procedures.map(o=>[o.id,o])),s=[],i=[],p=[];for(const o of e.procedures){if(o.coverage==="exempt")continue;const t=c.get(o.id);t!==void 0&&t.coverage!=="exempt"&&o.score<t.score&&s.push({after:o.score,before:t.score,id:o.id}),o.coverage==="failing"&&t?.coverage!=="failing"&&i.push(o.id),u(t?.checks??[],o.checks)&&p.push(o.id)}s.sort((o,t)=>f(o.id,t.id)),i.sort(f),p.sort(f);const a=e.score-r.score,d=u(r.project.checks,e.project.checks);return{comparable:!0,dropped:s,newFailing:i,projectRegressed:d,regressed:a<0||s.length>0||i.length>0||p.length>0||d,scoreDelta:a,worsened:p}},b=e=>{if(typeof e!="object"||e===null)return;const r=e;if(!(!n(r.version)||!n(r.score))&&!(!Array.isArray(r.procedures)||!r.procedures.every(c=>h(c)))&&y(r.project))return e};export{v as compareToBaseline,b as parseAdvisorMap};
1
+ import{byCodepoint as f}from"./MAP_VERSION-BdyirFdd.mjs";const m=new Set(["clean","exempt","failing","warned"]),u=(e,r)=>{const c=new Map(e.map(s=>[s.name,s.occurrences]));return r.some(s=>s.occurrences>(c.get(s.name)??0))},n=e=>typeof e=="number"&&Number.isFinite(e),g=e=>Array.isArray(e)&&e.every(r=>{if(typeof r!="object"||r===null)return!1;const c=r;return typeof c.name=="string"&&n(c.occurrences)}),h=e=>{if(typeof e!="object"||e===null)return!1;const r=e;return typeof r.id=="string"&&n(r.score)&&typeof r.coverage=="string"&&m.has(r.coverage)&&g(r.checks)},y=e=>{if(typeof e!="object"||e===null)return!1;const r=e;return g(r.checks)&&n(r.score)},v=(e,r)=>{if(r.version!==e.version)return{comparable:!1,reason:"version-mismatch"};const c=new Map(r.procedures.map(o=>[o.id,o])),s=[],i=[],p=[];for(const o of e.procedures){if(o.coverage==="exempt")continue;const t=c.get(o.id);t!==void 0&&t.coverage!=="exempt"&&o.score<t.score&&s.push({after:o.score,before:t.score,id:o.id}),o.coverage==="failing"&&t?.coverage!=="failing"&&i.push(o.id),u(t?.checks??[],o.checks)&&p.push(o.id)}s.sort((o,t)=>f(o.id,t.id)),i.sort(f),p.sort(f);const a=e.score-r.score,d=u(r.project.checks,e.project.checks);return{comparable:!0,dropped:s,newFailing:i,projectRegressed:d,regressed:a<0||s.length>0||i.length>0||p.length>0||d,scoreDelta:a,worsened:p}},b=e=>{if(typeof e!="object"||e===null)return;const r=e;if(!(!n(r.version)||!n(r.score))&&!(!Array.isArray(r.procedures)||!r.procedures.every(c=>h(c)))&&y(r.project))return e};export{v as compareToBaseline,b as parseAdvisorMap};
@@ -0,0 +1 @@
1
+ import{e as l}from"./finding-NrKO8idM.mjs";import{d}from"./helpers-YAAwOBMH.mjs";const m={categories:["SECURITY"],description:"A public procedure reads a table whose columns are masked by `.use(mask(...))` elsewhere in the app, but this procedure's builder chain does not include `.use(mask(...))`. It returns those columns in the clear while a sibling procedure redacts them.",facing:"EXTERNAL",level:"WARN",name:"mask_uncovered_pii_column",remediation:"Add `.use(mask(policies))` to the procedure's builder chain — e.g. `c.use(mask(myMasks)).query(...)` — so its returned rows redact the same columns as the rest of the app. If this procedure is intentionally privileged (e.g. an admin export), declare it with `internalQuery` / `internalMutation` / `internalAction` instead of the public builder so the intent is explicit.",run:r=>{if(r.maskProcedures===void 0)return[];const o=new Map;for(const t of r.maskProcedures)for(const{column:i,table:e}of t.maskColumns){if(e===""||i==="")continue;const s=o.get(e)??new Set;s.add(i),o.set(e,s)}if(o.size===0)return[];const n=[];for(const t of r.maskProcedures){if(t.usesMask||t.visibility==="internal")continue;const i=new Set;for(const e of t.tablesRead)e!==""&&o.has(e)&&i.add(e);for(const e of i){const s=[...o.get(e)??new Set].toSorted((a,u)=>a.localeCompare(u)),c=s.map(a=>`\`${a}\``).join(", ");n.push(l(m,{cacheKey:`mask_uncovered_pii_column:${t.file}:${t.exportName}:${e}`,detail:`\`${t.exportName}\` in ${t.file} reads table \`${e}\` without \`.use(mask(...))\` — its column${s.length===1?"":"s"} ${c} ${s.length===1?"is":"are"} masked elsewhere in the app but returned in the clear here.`,metadata:{columns:s,exportName:t.exportName,...d(t),table:e}}))}}return n},source:"static",title:"Maskable column returned without mask() middleware"};export{m as default};
@@ -1 +1 @@
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
+ 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,line:e.line,table:e.table}})),source:"static",title:'Weak "hash" mask strategy on a PII column'};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.293",
3
+ "version": "1.0.0-alpha.294",
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{readCallSiteCallers as y}from"./callSiteCallers-DArHfQSU.mjs";import{scoreProcedure as v,procedureWeight as S,coverageFromScore as b,scoreGlobal as k,projectWeight as M,gradeFromScore as j,weightFor as N,worstLevel as C}from"./gradeFromScore-KSt58rj1.mjs";import F from"./classifySensitivity-JnjaTGYi.mjs";const x=(e,r)=>e===r?0:e<r?-1:1,w=(e,r)=>x(e.name,r.name),P=(e,r)=>{const o=e[r];return typeof o=="string"?o:void 0},f=(e,r)=>`${e}#${r}`,A=(e,r,o,c)=>e===void 0?{level:r,name:o,occurrences:1,weight:c}:{level:C(e.level,r),name:o,occurrences:e.occurrences+1,weight:Math.max(e.weight,c)},I=(e,r)=>{const o=new Map;for(const t of e)o.set(f(t.file,t.exportName),new Map);const c=new Map;for(const t of r){const s=P(t.metadata,"file"),l=y(t.metadata),m=s===void 0?[]:l.flatMap(a=>o.get(f(s,a))??[]),d=m.length===0?[c]:m;for(const a of d)a.set(t.name,A(a.get(t.name),t.level,t.name,N(t.level)))}return{byProcedure:new Map([...o].map(([t,s])=>[t,[...s.values()].toSorted(w)])),project:[...c.values()].toSorted(w)}},R=(e,r)=>{const o={clean:0,exempt:0,failing:0,warned:0};let c=r.checks.length;for(const t of e)o[t.coverage]+=1,c+=t.checks.length;return{clean:o.clean,exempt:o.exempt,failing:o.failing,procedures:e.length,rulesFired:c,warned:o.warned}},W=1,B=(e,r,o={})=>{const c=new Set(o.exempt),t=I(e,r),s=e.map(n=>{const i=f(n.file,n.exportName),p=t.byProcedure.get(i)??[],u=v(p),g=c.has(i)||n.exempt===!0,h=F(n);return{checks:p,coverage:g?"exempt":b(u),...g?{exemptReason:n.exemptReason??""}:{},exportName:n.exportName,file:n.file,id:i,kind:n.kind,score:u,sensitivity:h,visibility:n.visibility,weight:g?0:S(n,h.level)}}).toSorted((n,i)=>x(n.id,i.id)),l={checks:t.project,score:v(t.project)},m=s.filter(n=>n.coverage!=="exempt"),d=m.reduce((n,i)=>n+i.weight,0),a=k([...m,{score:l.score,weight:M(d)}]);return{generatedAt:o.generatedAt??new Date().toISOString(),grade:j(a),procedures:s,project:l,score:a,summary:R(s,l),version:W}};export{W as MAP_VERSION,x as byCodepoint,B as scoreAdvisor};
@@ -1 +0,0 @@
1
- import{e as l}from"./finding-NrKO8idM.mjs";const d={categories:["SECURITY"],description:"A public procedure reads a table whose columns are masked by `.use(mask(...))` elsewhere in the app, but this procedure's builder chain does not include `.use(mask(...))`. It returns those columns in the clear while a sibling procedure redacts them.",facing:"EXTERNAL",level:"WARN",name:"mask_uncovered_pii_column",remediation:"Add `.use(mask(policies))` to the procedure's builder chain — e.g. `c.use(mask(myMasks)).query(...)` — so its returned rows redact the same columns as the rest of the app. If this procedure is intentionally privileged (e.g. an admin export), declare it with `internalQuery` / `internalMutation` / `internalAction` instead of the public builder so the intent is explicit.",run:n=>{if(n.maskProcedures===void 0)return[];const i=new Map;for(const t of n.maskProcedures)for(const{column:o,table:e}of t.maskColumns){if(e===""||o==="")continue;const s=i.get(e)??new Set;s.add(o),i.set(e,s)}if(i.size===0)return[];const a=[];for(const t of n.maskProcedures){if(t.usesMask||t.visibility==="internal")continue;const o=new Set;for(const e of t.tablesRead)e!==""&&i.has(e)&&o.add(e);for(const e of o){const s=[...i.get(e)??new Set].toSorted((r,u)=>r.localeCompare(u)),c=s.map(r=>`\`${r}\``).join(", ");a.push(l(d,{cacheKey:`mask_uncovered_pii_column:${t.file}:${t.exportName}:${e}`,detail:`\`${t.exportName}\` in ${t.file} reads table \`${e}\` without \`.use(mask(...))\` — its column${s.length===1?"":"s"} ${c} ${s.length===1?"is":"are"} masked elsewhere in the app but returned in the clear here.`,metadata:{columns:s,exportName:t.exportName,file:t.file,table:e}}))}}return a},source:"static",title:"Maskable column returned without mask() middleware"};export{d as default};