xploitscan-shared-rules 1.22.0 → 1.24.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +25 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +85 -1
- package/dist/index.d.ts +85 -1
- package/dist/index.js +19 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -145,6 +145,73 @@ interface CustomRule {
|
|
|
145
145
|
*/
|
|
146
146
|
declare function getSnippet(content: string, line: number, contextLines?: number): string;
|
|
147
147
|
|
|
148
|
+
/**
|
|
149
|
+
* Claude model IDs — the single place they are written down.
|
|
150
|
+
*
|
|
151
|
+
* There used to be three copies of "which model do we call", in three
|
|
152
|
+
* packages, each with its own literal. One of them (`ai-analyzer.ts`) sat on
|
|
153
|
+
* `claude-sonnet-4-5-20250514` for long enough that the model went two
|
|
154
|
+
* generations stale without anyone noticing, because nothing in the repo
|
|
155
|
+
* pointed at it. That is the same duplication defect that produced three
|
|
156
|
+
* copies of `calculateGrade` and two of `NON_APP_PATH_PATTERNS`.
|
|
157
|
+
*
|
|
158
|
+
* The lesson recorded in docs/BACKLOG.md applies exactly:
|
|
159
|
+
* "Import, don't restate — a shared function makes drift unexpressible,
|
|
160
|
+
* whereas a guard only catches it afterwards."
|
|
161
|
+
*
|
|
162
|
+
* So: import from here. `scripts/check-model-ids.js` fails CI on any Claude
|
|
163
|
+
* model literal written anywhere else, and on a stale review date below.
|
|
164
|
+
*/
|
|
165
|
+
/**
|
|
166
|
+
* Deep analysis — open-ended discovery over up to 50KB of source at a time.
|
|
167
|
+
*
|
|
168
|
+
* Why Sonnet and not Haiku: this call *invents* findings rather than judging
|
|
169
|
+
* ones it was handed, and whatever it returns is pushed onto the finding list
|
|
170
|
+
* that `calculateGrade()` scores. A wrong finding here becomes a wrong letter
|
|
171
|
+
* grade shown to someone who, by construction, cannot tell a bogus finding
|
|
172
|
+
* from a real one — the audience is non-expert developers. It also runs on the
|
|
173
|
+
* *user's* own ANTHROPIC_API_KEY in the CLI (see `analyzeWithAI`), so the
|
|
174
|
+
* cost of the stronger model is not ours to optimise away.
|
|
175
|
+
*/
|
|
176
|
+
declare const MODEL_ANALYSIS = "claude-sonnet-5";
|
|
177
|
+
/**
|
|
178
|
+
* High-volume narrow judgment — "is this specific finding a false positive?"
|
|
179
|
+
* and "answer this questionnaire item from these facts".
|
|
180
|
+
*
|
|
181
|
+
* Haiku is the right tier: the task is bounded, the finding is handed to the
|
|
182
|
+
* model rather than discovered by it, and the call count scales with findings
|
|
183
|
+
* (one per file batch, many per scan). Pinned to a dated release deliberately
|
|
184
|
+
* — this one runs on OUR key against user-visible output, and a silent model
|
|
185
|
+
* swap underneath a filter that can *hide* a real vulnerability is not a
|
|
186
|
+
* change we want to arrive unannounced.
|
|
187
|
+
*/
|
|
188
|
+
declare const MODEL_TRIAGE = "claude-haiku-4-5-20251001";
|
|
189
|
+
/**
|
|
190
|
+
* Last time a human checked these against the current model line-up.
|
|
191
|
+
*
|
|
192
|
+
* `scripts/check-model-ids.js` FAILS once this is more than
|
|
193
|
+
* MODEL_REVIEW_INTERVAL_DAYS old. That is deliberate: a warning in CI is a
|
|
194
|
+
* warning nobody reads, and "we fell two generations behind without noticing"
|
|
195
|
+
* is the exact failure this module exists to prevent.
|
|
196
|
+
*
|
|
197
|
+
* To clear it: re-read https://docs.claude.com/en/docs/about-claude/models,
|
|
198
|
+
* update the IDs above if the line-up moved, and set today's date here.
|
|
199
|
+
*/
|
|
200
|
+
declare const MODEL_POLICY_REVIEWED = "2026-09-15";
|
|
201
|
+
/** How long a review stays fresh before CI asks for another one. */
|
|
202
|
+
declare const MODEL_REVIEW_INTERVAL_DAYS = 180;
|
|
203
|
+
/**
|
|
204
|
+
* Sampling is pinned to 0 at every call site, and extended thinking is
|
|
205
|
+
* deliberately NOT enabled at any of them.
|
|
206
|
+
*
|
|
207
|
+
* Both follow from the same requirement: a user who scans the same unchanged
|
|
208
|
+
* commit twice must get the same letter grade, with no explanation needed for
|
|
209
|
+
* why it moved. Extended thinking requires temperature 1, so enabling it
|
|
210
|
+
* would trade that guarantee away. If a future call site does not feed a
|
|
211
|
+
* grade, it is free to make the opposite choice — but it should say so.
|
|
212
|
+
*/
|
|
213
|
+
declare const MODEL_TEMPERATURE = 0;
|
|
214
|
+
|
|
148
215
|
/**
|
|
149
216
|
* Real-world consequence descriptions for VC### rules.
|
|
150
217
|
*
|
|
@@ -580,6 +647,23 @@ declare const insecureDirectObjectReference: CustomRule;
|
|
|
580
647
|
declare const freeRules: CustomRule[];
|
|
581
648
|
declare const allRules: CustomRule[];
|
|
582
649
|
declare const allCustomRules: CustomRule[];
|
|
650
|
+
/**
|
|
651
|
+
* Every rule that is NOT in the free tier, derived — never hand-listed.
|
|
652
|
+
*
|
|
653
|
+
* `runCustomRules()` always runs `freeRules` internally; its `extraRules`
|
|
654
|
+
* argument is how a caller adds the rest. Passing `allCustomRules` there
|
|
655
|
+
* therefore runs the 30 free rules TWICE, and every free-tier finding is
|
|
656
|
+
* reported twice. That is exactly what the MCP server and the VS Code
|
|
657
|
+
* extension were doing — both shipped, on npm and the Marketplace — while
|
|
658
|
+
* the CLI passed the complement and was correct.
|
|
659
|
+
*
|
|
660
|
+
* The free/Pro split had been restated in three places by hand: this file's
|
|
661
|
+
* `freeRules`, a literal ID Set in scripts/vsi/vsi-lib.cjs, and a 184-entry
|
|
662
|
+
* import list in packages/cli/src/pro-bundle-entry.ts. Deriving it once is
|
|
663
|
+
* the fix the repo keeps re-learning — a shared value makes the drift
|
|
664
|
+
* unexpressible, where a guard only catches it afterwards.
|
|
665
|
+
*/
|
|
666
|
+
declare const proOnlyRules: CustomRule[];
|
|
583
667
|
declare function runCustomRules(content: string, filePath: string, disabledRules?: string[], tier?: "free" | "pro", extraRules?: CustomRule[],
|
|
584
668
|
/**
|
|
585
669
|
* Cross-file facts for the project being scanned, from
|
|
@@ -996,4 +1080,4 @@ declare function getObjectProperty(node: ObjectExpression, key: string): {
|
|
|
996
1080
|
/** Does this CallExpression spread an expression `matcher` returns true for? */
|
|
997
1081
|
declare function callSpreads(call: CallExpression, matcher: (node: Node) => boolean): boolean;
|
|
998
1082
|
|
|
999
|
-
export { type AIFilterResult, type AppRoute, type BuilderFingerprint, type Confidence, type CustomRule, type DetectedFramework, type ExposedConfig, type Exposure, FREE_RULE_COUNT, type FilteredFinding, type Finding, type GradeOptions, type GradeResult, type HeaderFinding, NON_APP_PATH_PATTERNS, PRO_RULE_COUNT, type ParsedFile, type ProjectContext, RULE_IMPACTS, type RouteFramework, type RouteTable, type RuleMatch, type SecurityGrade, type Severity, TOTAL_RULE_COUNT, type TaintMap, type TargetCheck, type VibePlatform, accountStateFromWebStorage, allCustomRules, allRules, androidDebuggable, assessHeaders, blockingMainThread, buildProjectContext, buildTaintMap, calculateGrade, callSpreads, callbackHell, classifyExposure, clickjacking, clientComponentSecret, clientSideAuth, commandInjection, complianceMap, consoleLogProduction, corsLocalhost, corsServerless, corsWildcard, dangerousInnerHTML, deprecatedTLS, detectBuilder, detectExposedConfig, detectFramework, detectPlatform, disabledTLSVerification, djangoDebug, dockerCopySensitive, dockerLatestTag, dockerRunAsRoot, dockerTooManyPorts, dockerfileADDInsteadOfCOPY, dockerfileMissingHealthcheck, dockerfileUnverifiedShellPipe, ecbModeEncryption, electronNavigationUnrestricted, emptyCatchBlock, entitlementFromWebStorage, envNotGitignored, evalUsage, eventListenerLeak, exposedAdminRoutes, exposedAuthSecret, exposedDBCredentials, exposedDatabaseStudio, exposedDebugMode, exposedDockerPorts, exposedEnvFile, exposedGitDir, exposedServerActions, exposedSourceMaps, exposedStackTraces, extractRoutes, extractScriptUrls, filterFalsePositives, findSourceMapRefs, firebaseClientConfig, flaskSecretKey, freeRules, getObjectProperty, getSnippet, ghaExpressionInjection, ghaPermissionsWriteAll, ghaPullRequestTargetCheckout, ghaThirdPartyActionWithSecrets, githubActionsInjection, graphqlCSRFDisabled, graphqlIntrospection, graphqlNoComplexityLimit, graphqlNoDepthLimit, hardcodedAlgoliaAdminKey, hardcodedAnthropicKey, hardcodedCloudflareToken, hardcodedCohereKey, hardcodedCreditCard, hardcodedDatadogKey, hardcodedDiscordToken, hardcodedEncryptionKey, hardcodedFastlyToken, hardcodedFireworksKey, hardcodedFlyToken, hardcodedGCPServiceAccount, hardcodedGitHubPAT, hardcodedGitLabToken, hardcodedGroqKey, hardcodedHighlightKey, hardcodedIPAllowlist, hardcodedIntercomToken, hardcodedJWTSecret, hardcodedLinearKey, hardcodedLogtailToken, hardcodedLoopsKey, hardcodedMailgunKey, hardcodedMistralKey, hardcodedNetlifyToken, hardcodedNotionKey, hardcodedOAuthSecret, hardcodedPineconeKey, hardcodedPlivoToken, hardcodedPostmarkKey, hardcodedQdrantKey, hardcodedRailwayToken, hardcodedReplicateKey, hardcodedResendKey, hardcodedSSN, hardcodedSecrets, hardcodedSendGridKey, hardcodedSentryAuthToken, hardcodedShopifyToken, hardcodedSlackToken, hardcodedSupabaseServiceRole, hardcodedTogetherKey, hardcodedTwilioKey, hardcodedVaultToken, hardcodedVercelToken, hardcodedWeaviateKey, hostHeaderRedirect, httpRequestSmuggling, insecureCookies, insecureDeepLink, insecureDeserialization, insecureDirectObjectReference, insecureElectronWindow, insecureFileUpload, insecureGRPC, insecureHTTPMethods, insecurePasswordReset, insecureRandomness, insecureWebSocket, ipcPathTraversal, isCalleeNamed, isMethodCall, isPrivateAddress, isVendoredFinding, isVendoredPath, javaDeserialization, jwtAlgConfusion, k8sNoResourceLimits, k8sPrivileged, k8sSecretNotEncrypted, lambdaWithoutVPC, largeBundleImport, llmCallNoMaxTokens, llmOutputAsHTML, llmOutputToSink, llmPromptInjection, llmSystemPromptInjection, logInjection, magicNumbers, massAssignment, middlewareMatcherExcludesApi, missingAIRateLimit, missingAuthMiddleware, missingAuthRateLimit, missingBruteForce, missingCSP, missingCSRF, missingCertPinning, missingCloudTrail, missingContentDisposition, missingDBEncryption, missingErrorBoundary, missingFileSizeLimits, missingHSTS, missingHTTPS, missingLockFile, missingOAuthState, missingPagination, missingRequestSizeLimit, missingRequestValidation, missingSRI, missingSecurityMeta, nPlusOneQuery, nextPublicSecret, noRateLimiting, normalizeScanPath, nosqlInjection, openRedirectParams, overlyPermissiveIAM, parseFile, parseScanTarget, parseSupabaseConfig, pathTraversal, pickleDeserialization, piiInLogs, prototypePollution, pyDjangoAllowedHostsWildcard, pyDjangoMarkSafe, pyJWTDecodeWeakConfig, pyJinja2AutoescapeOff, pyParamikoAutoAdd, pyRequestsVerifyFalse, pyTempfileMktemp, raceCondition, rdsPubliclyAccessible, reflectedCORSOrigin, regexDos, routeForFile, runCustomRules, s3BucketNoEncryption, scanEntropy, secretInBundleConfig, secretInCLIArgument, secretInErrorResponse, secretInHTMLAttribute, secretInLLMPrompt, secretInURLParam, secretLoggedToConsole, secretsInCI, securityGroupAllInbound, sensitiveAsyncStorage, sensitiveLocalStorage, sensitiveURLParams, sessionFixation, sqlInjection, ssrfVulnerability, ssti, stripeWebhookUnprotected, supabaseAnonAdmin, supabaseFunctionName, supabaseNoRLS, syncFileOps, terraformStateExposed, timingAttack, todoLeftInCode, unencryptedPII, unpinnedGitHubAction, unprotectedAPIRoutes, unprotectedDownload, unsafeObjectAssign, unsanitizedFilenames, unsanitizedHTMLExport, unvalidatedAPIParams, unvalidatedEventData, unvalidatedRedirect, vectorStoreQueryNoUserFilter, vectorStoreUpsertNoMetadata, vendoredReason, visitBinary, visitCalls, vulnerableDependencies, weakHashing, weakPasswordRequirements, weakRSAKeySize, webhookMissingIdempotency, webhookSignatureVerification, xssVulnerability, xxeVulnerability };
|
|
1083
|
+
export { type AIFilterResult, type AppRoute, type BuilderFingerprint, type Confidence, type CustomRule, type DetectedFramework, type ExposedConfig, type Exposure, FREE_RULE_COUNT, type FilteredFinding, type Finding, type GradeOptions, type GradeResult, type HeaderFinding, MODEL_ANALYSIS, MODEL_POLICY_REVIEWED, MODEL_REVIEW_INTERVAL_DAYS, MODEL_TEMPERATURE, MODEL_TRIAGE, NON_APP_PATH_PATTERNS, PRO_RULE_COUNT, type ParsedFile, type ProjectContext, RULE_IMPACTS, type RouteFramework, type RouteTable, type RuleMatch, type SecurityGrade, type Severity, TOTAL_RULE_COUNT, type TaintMap, type TargetCheck, type VibePlatform, accountStateFromWebStorage, allCustomRules, allRules, androidDebuggable, assessHeaders, blockingMainThread, buildProjectContext, buildTaintMap, calculateGrade, callSpreads, callbackHell, classifyExposure, clickjacking, clientComponentSecret, clientSideAuth, commandInjection, complianceMap, consoleLogProduction, corsLocalhost, corsServerless, corsWildcard, dangerousInnerHTML, deprecatedTLS, detectBuilder, detectExposedConfig, detectFramework, detectPlatform, disabledTLSVerification, djangoDebug, dockerCopySensitive, dockerLatestTag, dockerRunAsRoot, dockerTooManyPorts, dockerfileADDInsteadOfCOPY, dockerfileMissingHealthcheck, dockerfileUnverifiedShellPipe, ecbModeEncryption, electronNavigationUnrestricted, emptyCatchBlock, entitlementFromWebStorage, envNotGitignored, evalUsage, eventListenerLeak, exposedAdminRoutes, exposedAuthSecret, exposedDBCredentials, exposedDatabaseStudio, exposedDebugMode, exposedDockerPorts, exposedEnvFile, exposedGitDir, exposedServerActions, exposedSourceMaps, exposedStackTraces, extractRoutes, extractScriptUrls, filterFalsePositives, findSourceMapRefs, firebaseClientConfig, flaskSecretKey, freeRules, getObjectProperty, getSnippet, ghaExpressionInjection, ghaPermissionsWriteAll, ghaPullRequestTargetCheckout, ghaThirdPartyActionWithSecrets, githubActionsInjection, graphqlCSRFDisabled, graphqlIntrospection, graphqlNoComplexityLimit, graphqlNoDepthLimit, hardcodedAlgoliaAdminKey, hardcodedAnthropicKey, hardcodedCloudflareToken, hardcodedCohereKey, hardcodedCreditCard, hardcodedDatadogKey, hardcodedDiscordToken, hardcodedEncryptionKey, hardcodedFastlyToken, hardcodedFireworksKey, hardcodedFlyToken, hardcodedGCPServiceAccount, hardcodedGitHubPAT, hardcodedGitLabToken, hardcodedGroqKey, hardcodedHighlightKey, hardcodedIPAllowlist, hardcodedIntercomToken, hardcodedJWTSecret, hardcodedLinearKey, hardcodedLogtailToken, hardcodedLoopsKey, hardcodedMailgunKey, hardcodedMistralKey, hardcodedNetlifyToken, hardcodedNotionKey, hardcodedOAuthSecret, hardcodedPineconeKey, hardcodedPlivoToken, hardcodedPostmarkKey, hardcodedQdrantKey, hardcodedRailwayToken, hardcodedReplicateKey, hardcodedResendKey, hardcodedSSN, hardcodedSecrets, hardcodedSendGridKey, hardcodedSentryAuthToken, hardcodedShopifyToken, hardcodedSlackToken, hardcodedSupabaseServiceRole, hardcodedTogetherKey, hardcodedTwilioKey, hardcodedVaultToken, hardcodedVercelToken, hardcodedWeaviateKey, hostHeaderRedirect, httpRequestSmuggling, insecureCookies, insecureDeepLink, insecureDeserialization, insecureDirectObjectReference, insecureElectronWindow, insecureFileUpload, insecureGRPC, insecureHTTPMethods, insecurePasswordReset, insecureRandomness, insecureWebSocket, ipcPathTraversal, isCalleeNamed, isMethodCall, isPrivateAddress, isVendoredFinding, isVendoredPath, javaDeserialization, jwtAlgConfusion, k8sNoResourceLimits, k8sPrivileged, k8sSecretNotEncrypted, lambdaWithoutVPC, largeBundleImport, llmCallNoMaxTokens, llmOutputAsHTML, llmOutputToSink, llmPromptInjection, llmSystemPromptInjection, logInjection, magicNumbers, massAssignment, middlewareMatcherExcludesApi, missingAIRateLimit, missingAuthMiddleware, missingAuthRateLimit, missingBruteForce, missingCSP, missingCSRF, missingCertPinning, missingCloudTrail, missingContentDisposition, missingDBEncryption, missingErrorBoundary, missingFileSizeLimits, missingHSTS, missingHTTPS, missingLockFile, missingOAuthState, missingPagination, missingRequestSizeLimit, missingRequestValidation, missingSRI, missingSecurityMeta, nPlusOneQuery, nextPublicSecret, noRateLimiting, normalizeScanPath, nosqlInjection, openRedirectParams, overlyPermissiveIAM, parseFile, parseScanTarget, parseSupabaseConfig, pathTraversal, pickleDeserialization, piiInLogs, proOnlyRules, prototypePollution, pyDjangoAllowedHostsWildcard, pyDjangoMarkSafe, pyJWTDecodeWeakConfig, pyJinja2AutoescapeOff, pyParamikoAutoAdd, pyRequestsVerifyFalse, pyTempfileMktemp, raceCondition, rdsPubliclyAccessible, reflectedCORSOrigin, regexDos, routeForFile, runCustomRules, s3BucketNoEncryption, scanEntropy, secretInBundleConfig, secretInCLIArgument, secretInErrorResponse, secretInHTMLAttribute, secretInLLMPrompt, secretInURLParam, secretLoggedToConsole, secretsInCI, securityGroupAllInbound, sensitiveAsyncStorage, sensitiveLocalStorage, sensitiveURLParams, sessionFixation, sqlInjection, ssrfVulnerability, ssti, stripeWebhookUnprotected, supabaseAnonAdmin, supabaseFunctionName, supabaseNoRLS, syncFileOps, terraformStateExposed, timingAttack, todoLeftInCode, unencryptedPII, unpinnedGitHubAction, unprotectedAPIRoutes, unprotectedDownload, unsafeObjectAssign, unsanitizedFilenames, unsanitizedHTMLExport, unvalidatedAPIParams, unvalidatedEventData, unvalidatedRedirect, vectorStoreQueryNoUserFilter, vectorStoreUpsertNoMetadata, vendoredReason, visitBinary, visitCalls, vulnerableDependencies, weakHashing, weakPasswordRequirements, weakRSAKeySize, webhookMissingIdempotency, webhookSignatureVerification, xssVulnerability, xxeVulnerability };
|
package/dist/index.d.ts
CHANGED
|
@@ -145,6 +145,73 @@ interface CustomRule {
|
|
|
145
145
|
*/
|
|
146
146
|
declare function getSnippet(content: string, line: number, contextLines?: number): string;
|
|
147
147
|
|
|
148
|
+
/**
|
|
149
|
+
* Claude model IDs — the single place they are written down.
|
|
150
|
+
*
|
|
151
|
+
* There used to be three copies of "which model do we call", in three
|
|
152
|
+
* packages, each with its own literal. One of them (`ai-analyzer.ts`) sat on
|
|
153
|
+
* `claude-sonnet-4-5-20250514` for long enough that the model went two
|
|
154
|
+
* generations stale without anyone noticing, because nothing in the repo
|
|
155
|
+
* pointed at it. That is the same duplication defect that produced three
|
|
156
|
+
* copies of `calculateGrade` and two of `NON_APP_PATH_PATTERNS`.
|
|
157
|
+
*
|
|
158
|
+
* The lesson recorded in docs/BACKLOG.md applies exactly:
|
|
159
|
+
* "Import, don't restate — a shared function makes drift unexpressible,
|
|
160
|
+
* whereas a guard only catches it afterwards."
|
|
161
|
+
*
|
|
162
|
+
* So: import from here. `scripts/check-model-ids.js` fails CI on any Claude
|
|
163
|
+
* model literal written anywhere else, and on a stale review date below.
|
|
164
|
+
*/
|
|
165
|
+
/**
|
|
166
|
+
* Deep analysis — open-ended discovery over up to 50KB of source at a time.
|
|
167
|
+
*
|
|
168
|
+
* Why Sonnet and not Haiku: this call *invents* findings rather than judging
|
|
169
|
+
* ones it was handed, and whatever it returns is pushed onto the finding list
|
|
170
|
+
* that `calculateGrade()` scores. A wrong finding here becomes a wrong letter
|
|
171
|
+
* grade shown to someone who, by construction, cannot tell a bogus finding
|
|
172
|
+
* from a real one — the audience is non-expert developers. It also runs on the
|
|
173
|
+
* *user's* own ANTHROPIC_API_KEY in the CLI (see `analyzeWithAI`), so the
|
|
174
|
+
* cost of the stronger model is not ours to optimise away.
|
|
175
|
+
*/
|
|
176
|
+
declare const MODEL_ANALYSIS = "claude-sonnet-5";
|
|
177
|
+
/**
|
|
178
|
+
* High-volume narrow judgment — "is this specific finding a false positive?"
|
|
179
|
+
* and "answer this questionnaire item from these facts".
|
|
180
|
+
*
|
|
181
|
+
* Haiku is the right tier: the task is bounded, the finding is handed to the
|
|
182
|
+
* model rather than discovered by it, and the call count scales with findings
|
|
183
|
+
* (one per file batch, many per scan). Pinned to a dated release deliberately
|
|
184
|
+
* — this one runs on OUR key against user-visible output, and a silent model
|
|
185
|
+
* swap underneath a filter that can *hide* a real vulnerability is not a
|
|
186
|
+
* change we want to arrive unannounced.
|
|
187
|
+
*/
|
|
188
|
+
declare const MODEL_TRIAGE = "claude-haiku-4-5-20251001";
|
|
189
|
+
/**
|
|
190
|
+
* Last time a human checked these against the current model line-up.
|
|
191
|
+
*
|
|
192
|
+
* `scripts/check-model-ids.js` FAILS once this is more than
|
|
193
|
+
* MODEL_REVIEW_INTERVAL_DAYS old. That is deliberate: a warning in CI is a
|
|
194
|
+
* warning nobody reads, and "we fell two generations behind without noticing"
|
|
195
|
+
* is the exact failure this module exists to prevent.
|
|
196
|
+
*
|
|
197
|
+
* To clear it: re-read https://docs.claude.com/en/docs/about-claude/models,
|
|
198
|
+
* update the IDs above if the line-up moved, and set today's date here.
|
|
199
|
+
*/
|
|
200
|
+
declare const MODEL_POLICY_REVIEWED = "2026-09-15";
|
|
201
|
+
/** How long a review stays fresh before CI asks for another one. */
|
|
202
|
+
declare const MODEL_REVIEW_INTERVAL_DAYS = 180;
|
|
203
|
+
/**
|
|
204
|
+
* Sampling is pinned to 0 at every call site, and extended thinking is
|
|
205
|
+
* deliberately NOT enabled at any of them.
|
|
206
|
+
*
|
|
207
|
+
* Both follow from the same requirement: a user who scans the same unchanged
|
|
208
|
+
* commit twice must get the same letter grade, with no explanation needed for
|
|
209
|
+
* why it moved. Extended thinking requires temperature 1, so enabling it
|
|
210
|
+
* would trade that guarantee away. If a future call site does not feed a
|
|
211
|
+
* grade, it is free to make the opposite choice — but it should say so.
|
|
212
|
+
*/
|
|
213
|
+
declare const MODEL_TEMPERATURE = 0;
|
|
214
|
+
|
|
148
215
|
/**
|
|
149
216
|
* Real-world consequence descriptions for VC### rules.
|
|
150
217
|
*
|
|
@@ -580,6 +647,23 @@ declare const insecureDirectObjectReference: CustomRule;
|
|
|
580
647
|
declare const freeRules: CustomRule[];
|
|
581
648
|
declare const allRules: CustomRule[];
|
|
582
649
|
declare const allCustomRules: CustomRule[];
|
|
650
|
+
/**
|
|
651
|
+
* Every rule that is NOT in the free tier, derived — never hand-listed.
|
|
652
|
+
*
|
|
653
|
+
* `runCustomRules()` always runs `freeRules` internally; its `extraRules`
|
|
654
|
+
* argument is how a caller adds the rest. Passing `allCustomRules` there
|
|
655
|
+
* therefore runs the 30 free rules TWICE, and every free-tier finding is
|
|
656
|
+
* reported twice. That is exactly what the MCP server and the VS Code
|
|
657
|
+
* extension were doing — both shipped, on npm and the Marketplace — while
|
|
658
|
+
* the CLI passed the complement and was correct.
|
|
659
|
+
*
|
|
660
|
+
* The free/Pro split had been restated in three places by hand: this file's
|
|
661
|
+
* `freeRules`, a literal ID Set in scripts/vsi/vsi-lib.cjs, and a 184-entry
|
|
662
|
+
* import list in packages/cli/src/pro-bundle-entry.ts. Deriving it once is
|
|
663
|
+
* the fix the repo keeps re-learning — a shared value makes the drift
|
|
664
|
+
* unexpressible, where a guard only catches it afterwards.
|
|
665
|
+
*/
|
|
666
|
+
declare const proOnlyRules: CustomRule[];
|
|
583
667
|
declare function runCustomRules(content: string, filePath: string, disabledRules?: string[], tier?: "free" | "pro", extraRules?: CustomRule[],
|
|
584
668
|
/**
|
|
585
669
|
* Cross-file facts for the project being scanned, from
|
|
@@ -996,4 +1080,4 @@ declare function getObjectProperty(node: ObjectExpression, key: string): {
|
|
|
996
1080
|
/** Does this CallExpression spread an expression `matcher` returns true for? */
|
|
997
1081
|
declare function callSpreads(call: CallExpression, matcher: (node: Node) => boolean): boolean;
|
|
998
1082
|
|
|
999
|
-
export { type AIFilterResult, type AppRoute, type BuilderFingerprint, type Confidence, type CustomRule, type DetectedFramework, type ExposedConfig, type Exposure, FREE_RULE_COUNT, type FilteredFinding, type Finding, type GradeOptions, type GradeResult, type HeaderFinding, NON_APP_PATH_PATTERNS, PRO_RULE_COUNT, type ParsedFile, type ProjectContext, RULE_IMPACTS, type RouteFramework, type RouteTable, type RuleMatch, type SecurityGrade, type Severity, TOTAL_RULE_COUNT, type TaintMap, type TargetCheck, type VibePlatform, accountStateFromWebStorage, allCustomRules, allRules, androidDebuggable, assessHeaders, blockingMainThread, buildProjectContext, buildTaintMap, calculateGrade, callSpreads, callbackHell, classifyExposure, clickjacking, clientComponentSecret, clientSideAuth, commandInjection, complianceMap, consoleLogProduction, corsLocalhost, corsServerless, corsWildcard, dangerousInnerHTML, deprecatedTLS, detectBuilder, detectExposedConfig, detectFramework, detectPlatform, disabledTLSVerification, djangoDebug, dockerCopySensitive, dockerLatestTag, dockerRunAsRoot, dockerTooManyPorts, dockerfileADDInsteadOfCOPY, dockerfileMissingHealthcheck, dockerfileUnverifiedShellPipe, ecbModeEncryption, electronNavigationUnrestricted, emptyCatchBlock, entitlementFromWebStorage, envNotGitignored, evalUsage, eventListenerLeak, exposedAdminRoutes, exposedAuthSecret, exposedDBCredentials, exposedDatabaseStudio, exposedDebugMode, exposedDockerPorts, exposedEnvFile, exposedGitDir, exposedServerActions, exposedSourceMaps, exposedStackTraces, extractRoutes, extractScriptUrls, filterFalsePositives, findSourceMapRefs, firebaseClientConfig, flaskSecretKey, freeRules, getObjectProperty, getSnippet, ghaExpressionInjection, ghaPermissionsWriteAll, ghaPullRequestTargetCheckout, ghaThirdPartyActionWithSecrets, githubActionsInjection, graphqlCSRFDisabled, graphqlIntrospection, graphqlNoComplexityLimit, graphqlNoDepthLimit, hardcodedAlgoliaAdminKey, hardcodedAnthropicKey, hardcodedCloudflareToken, hardcodedCohereKey, hardcodedCreditCard, hardcodedDatadogKey, hardcodedDiscordToken, hardcodedEncryptionKey, hardcodedFastlyToken, hardcodedFireworksKey, hardcodedFlyToken, hardcodedGCPServiceAccount, hardcodedGitHubPAT, hardcodedGitLabToken, hardcodedGroqKey, hardcodedHighlightKey, hardcodedIPAllowlist, hardcodedIntercomToken, hardcodedJWTSecret, hardcodedLinearKey, hardcodedLogtailToken, hardcodedLoopsKey, hardcodedMailgunKey, hardcodedMistralKey, hardcodedNetlifyToken, hardcodedNotionKey, hardcodedOAuthSecret, hardcodedPineconeKey, hardcodedPlivoToken, hardcodedPostmarkKey, hardcodedQdrantKey, hardcodedRailwayToken, hardcodedReplicateKey, hardcodedResendKey, hardcodedSSN, hardcodedSecrets, hardcodedSendGridKey, hardcodedSentryAuthToken, hardcodedShopifyToken, hardcodedSlackToken, hardcodedSupabaseServiceRole, hardcodedTogetherKey, hardcodedTwilioKey, hardcodedVaultToken, hardcodedVercelToken, hardcodedWeaviateKey, hostHeaderRedirect, httpRequestSmuggling, insecureCookies, insecureDeepLink, insecureDeserialization, insecureDirectObjectReference, insecureElectronWindow, insecureFileUpload, insecureGRPC, insecureHTTPMethods, insecurePasswordReset, insecureRandomness, insecureWebSocket, ipcPathTraversal, isCalleeNamed, isMethodCall, isPrivateAddress, isVendoredFinding, isVendoredPath, javaDeserialization, jwtAlgConfusion, k8sNoResourceLimits, k8sPrivileged, k8sSecretNotEncrypted, lambdaWithoutVPC, largeBundleImport, llmCallNoMaxTokens, llmOutputAsHTML, llmOutputToSink, llmPromptInjection, llmSystemPromptInjection, logInjection, magicNumbers, massAssignment, middlewareMatcherExcludesApi, missingAIRateLimit, missingAuthMiddleware, missingAuthRateLimit, missingBruteForce, missingCSP, missingCSRF, missingCertPinning, missingCloudTrail, missingContentDisposition, missingDBEncryption, missingErrorBoundary, missingFileSizeLimits, missingHSTS, missingHTTPS, missingLockFile, missingOAuthState, missingPagination, missingRequestSizeLimit, missingRequestValidation, missingSRI, missingSecurityMeta, nPlusOneQuery, nextPublicSecret, noRateLimiting, normalizeScanPath, nosqlInjection, openRedirectParams, overlyPermissiveIAM, parseFile, parseScanTarget, parseSupabaseConfig, pathTraversal, pickleDeserialization, piiInLogs, prototypePollution, pyDjangoAllowedHostsWildcard, pyDjangoMarkSafe, pyJWTDecodeWeakConfig, pyJinja2AutoescapeOff, pyParamikoAutoAdd, pyRequestsVerifyFalse, pyTempfileMktemp, raceCondition, rdsPubliclyAccessible, reflectedCORSOrigin, regexDos, routeForFile, runCustomRules, s3BucketNoEncryption, scanEntropy, secretInBundleConfig, secretInCLIArgument, secretInErrorResponse, secretInHTMLAttribute, secretInLLMPrompt, secretInURLParam, secretLoggedToConsole, secretsInCI, securityGroupAllInbound, sensitiveAsyncStorage, sensitiveLocalStorage, sensitiveURLParams, sessionFixation, sqlInjection, ssrfVulnerability, ssti, stripeWebhookUnprotected, supabaseAnonAdmin, supabaseFunctionName, supabaseNoRLS, syncFileOps, terraformStateExposed, timingAttack, todoLeftInCode, unencryptedPII, unpinnedGitHubAction, unprotectedAPIRoutes, unprotectedDownload, unsafeObjectAssign, unsanitizedFilenames, unsanitizedHTMLExport, unvalidatedAPIParams, unvalidatedEventData, unvalidatedRedirect, vectorStoreQueryNoUserFilter, vectorStoreUpsertNoMetadata, vendoredReason, visitBinary, visitCalls, vulnerableDependencies, weakHashing, weakPasswordRequirements, weakRSAKeySize, webhookMissingIdempotency, webhookSignatureVerification, xssVulnerability, xxeVulnerability };
|
|
1083
|
+
export { type AIFilterResult, type AppRoute, type BuilderFingerprint, type Confidence, type CustomRule, type DetectedFramework, type ExposedConfig, type Exposure, FREE_RULE_COUNT, type FilteredFinding, type Finding, type GradeOptions, type GradeResult, type HeaderFinding, MODEL_ANALYSIS, MODEL_POLICY_REVIEWED, MODEL_REVIEW_INTERVAL_DAYS, MODEL_TEMPERATURE, MODEL_TRIAGE, NON_APP_PATH_PATTERNS, PRO_RULE_COUNT, type ParsedFile, type ProjectContext, RULE_IMPACTS, type RouteFramework, type RouteTable, type RuleMatch, type SecurityGrade, type Severity, TOTAL_RULE_COUNT, type TaintMap, type TargetCheck, type VibePlatform, accountStateFromWebStorage, allCustomRules, allRules, androidDebuggable, assessHeaders, blockingMainThread, buildProjectContext, buildTaintMap, calculateGrade, callSpreads, callbackHell, classifyExposure, clickjacking, clientComponentSecret, clientSideAuth, commandInjection, complianceMap, consoleLogProduction, corsLocalhost, corsServerless, corsWildcard, dangerousInnerHTML, deprecatedTLS, detectBuilder, detectExposedConfig, detectFramework, detectPlatform, disabledTLSVerification, djangoDebug, dockerCopySensitive, dockerLatestTag, dockerRunAsRoot, dockerTooManyPorts, dockerfileADDInsteadOfCOPY, dockerfileMissingHealthcheck, dockerfileUnverifiedShellPipe, ecbModeEncryption, electronNavigationUnrestricted, emptyCatchBlock, entitlementFromWebStorage, envNotGitignored, evalUsage, eventListenerLeak, exposedAdminRoutes, exposedAuthSecret, exposedDBCredentials, exposedDatabaseStudio, exposedDebugMode, exposedDockerPorts, exposedEnvFile, exposedGitDir, exposedServerActions, exposedSourceMaps, exposedStackTraces, extractRoutes, extractScriptUrls, filterFalsePositives, findSourceMapRefs, firebaseClientConfig, flaskSecretKey, freeRules, getObjectProperty, getSnippet, ghaExpressionInjection, ghaPermissionsWriteAll, ghaPullRequestTargetCheckout, ghaThirdPartyActionWithSecrets, githubActionsInjection, graphqlCSRFDisabled, graphqlIntrospection, graphqlNoComplexityLimit, graphqlNoDepthLimit, hardcodedAlgoliaAdminKey, hardcodedAnthropicKey, hardcodedCloudflareToken, hardcodedCohereKey, hardcodedCreditCard, hardcodedDatadogKey, hardcodedDiscordToken, hardcodedEncryptionKey, hardcodedFastlyToken, hardcodedFireworksKey, hardcodedFlyToken, hardcodedGCPServiceAccount, hardcodedGitHubPAT, hardcodedGitLabToken, hardcodedGroqKey, hardcodedHighlightKey, hardcodedIPAllowlist, hardcodedIntercomToken, hardcodedJWTSecret, hardcodedLinearKey, hardcodedLogtailToken, hardcodedLoopsKey, hardcodedMailgunKey, hardcodedMistralKey, hardcodedNetlifyToken, hardcodedNotionKey, hardcodedOAuthSecret, hardcodedPineconeKey, hardcodedPlivoToken, hardcodedPostmarkKey, hardcodedQdrantKey, hardcodedRailwayToken, hardcodedReplicateKey, hardcodedResendKey, hardcodedSSN, hardcodedSecrets, hardcodedSendGridKey, hardcodedSentryAuthToken, hardcodedShopifyToken, hardcodedSlackToken, hardcodedSupabaseServiceRole, hardcodedTogetherKey, hardcodedTwilioKey, hardcodedVaultToken, hardcodedVercelToken, hardcodedWeaviateKey, hostHeaderRedirect, httpRequestSmuggling, insecureCookies, insecureDeepLink, insecureDeserialization, insecureDirectObjectReference, insecureElectronWindow, insecureFileUpload, insecureGRPC, insecureHTTPMethods, insecurePasswordReset, insecureRandomness, insecureWebSocket, ipcPathTraversal, isCalleeNamed, isMethodCall, isPrivateAddress, isVendoredFinding, isVendoredPath, javaDeserialization, jwtAlgConfusion, k8sNoResourceLimits, k8sPrivileged, k8sSecretNotEncrypted, lambdaWithoutVPC, largeBundleImport, llmCallNoMaxTokens, llmOutputAsHTML, llmOutputToSink, llmPromptInjection, llmSystemPromptInjection, logInjection, magicNumbers, massAssignment, middlewareMatcherExcludesApi, missingAIRateLimit, missingAuthMiddleware, missingAuthRateLimit, missingBruteForce, missingCSP, missingCSRF, missingCertPinning, missingCloudTrail, missingContentDisposition, missingDBEncryption, missingErrorBoundary, missingFileSizeLimits, missingHSTS, missingHTTPS, missingLockFile, missingOAuthState, missingPagination, missingRequestSizeLimit, missingRequestValidation, missingSRI, missingSecurityMeta, nPlusOneQuery, nextPublicSecret, noRateLimiting, normalizeScanPath, nosqlInjection, openRedirectParams, overlyPermissiveIAM, parseFile, parseScanTarget, parseSupabaseConfig, pathTraversal, pickleDeserialization, piiInLogs, proOnlyRules, prototypePollution, pyDjangoAllowedHostsWildcard, pyDjangoMarkSafe, pyJWTDecodeWeakConfig, pyJinja2AutoescapeOff, pyParamikoAutoAdd, pyRequestsVerifyFalse, pyTempfileMktemp, raceCondition, rdsPubliclyAccessible, reflectedCORSOrigin, regexDos, routeForFile, runCustomRules, s3BucketNoEncryption, scanEntropy, secretInBundleConfig, secretInCLIArgument, secretInErrorResponse, secretInHTMLAttribute, secretInLLMPrompt, secretInURLParam, secretLoggedToConsole, secretsInCI, securityGroupAllInbound, sensitiveAsyncStorage, sensitiveLocalStorage, sensitiveURLParams, sessionFixation, sqlInjection, ssrfVulnerability, ssti, stripeWebhookUnprotected, supabaseAnonAdmin, supabaseFunctionName, supabaseNoRLS, syncFileOps, terraformStateExposed, timingAttack, todoLeftInCode, unencryptedPII, unpinnedGitHubAction, unprotectedAPIRoutes, unprotectedDownload, unsafeObjectAssign, unsanitizedFilenames, unsanitizedHTMLExport, unvalidatedAPIParams, unvalidatedEventData, unvalidatedRedirect, vectorStoreQueryNoUserFilter, vectorStoreUpsertNoMetadata, vendoredReason, visitBinary, visitCalls, vulnerableDependencies, weakHashing, weakPasswordRequirements, weakRSAKeySize, webhookMissingIdempotency, webhookSignatureVerification, xssVulnerability, xxeVulnerability };
|
package/dist/index.js
CHANGED
|
@@ -45,6 +45,13 @@ function getSnippet(content, line, contextLines = 2) {
|
|
|
45
45
|
return out.join("\n");
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
+
// src/models.ts
|
|
49
|
+
var MODEL_ANALYSIS = "claude-sonnet-5";
|
|
50
|
+
var MODEL_TRIAGE = "claude-haiku-4-5-20251001";
|
|
51
|
+
var MODEL_POLICY_REVIEWED = "2026-09-15";
|
|
52
|
+
var MODEL_REVIEW_INTERVAL_DAYS = 180;
|
|
53
|
+
var MODEL_TEMPERATURE = 0;
|
|
54
|
+
|
|
48
55
|
// src/rule-impacts.ts
|
|
49
56
|
var RULE_IMPACTS = {
|
|
50
57
|
VC001: "An attacker who finds this key in your source code or client bundle can use your API with your credentials, potentially reading or modifying user data and racking up usage charges.",
|
|
@@ -8935,6 +8942,10 @@ var allCustomRules = [
|
|
|
8935
8942
|
entitlementFromWebStorage,
|
|
8936
8943
|
accountStateFromWebStorage
|
|
8937
8944
|
];
|
|
8945
|
+
var proOnlyRules = (() => {
|
|
8946
|
+
const freeIds = new Set(freeRules.map((r) => r.id));
|
|
8947
|
+
return allCustomRules.filter((r) => !freeIds.has(r.id));
|
|
8948
|
+
})();
|
|
8938
8949
|
function runCustomRules(content, filePath, disabledRules = [], tier = "free", extraRules = [], project) {
|
|
8939
8950
|
const findings = [];
|
|
8940
8951
|
if (/function runScan\(files\)|export function runCustomRules/.test(content) && /const (?:rules|allRules)\s*[:=]/.test(content) && /findMatches/.test(content)) {
|
|
@@ -9120,7 +9131,7 @@ async function filterFalsePositives(findings, fileContents) {
|
|
|
9120
9131
|
const prompt = buildReviewPrompt(batch, content);
|
|
9121
9132
|
const response = await client.messages.create(
|
|
9122
9133
|
{
|
|
9123
|
-
model:
|
|
9134
|
+
model: MODEL_TRIAGE,
|
|
9124
9135
|
max_tokens: 1024,
|
|
9125
9136
|
// Pinned, NOT left to the API default of 1.0. This is a binary
|
|
9126
9137
|
// classification (real vs. false positive), not generation — there
|
|
@@ -9132,7 +9143,7 @@ async function filterFalsePositives(findings, fileContents) {
|
|
|
9132
9143
|
// variance source that was ours to control. See
|
|
9133
9144
|
// scripts/fp-filter-repeatability.cjs for the measured flip rate,
|
|
9134
9145
|
// and the assertion in ai-fp-filter.test.ts that keeps it pinned.
|
|
9135
|
-
temperature:
|
|
9146
|
+
temperature: MODEL_TEMPERATURE,
|
|
9136
9147
|
system: REVIEW_SYSTEM_PROMPT,
|
|
9137
9148
|
messages: [{ role: "user", content: prompt }]
|
|
9138
9149
|
},
|
|
@@ -9648,6 +9659,11 @@ function extractScriptUrls(html, pageUrl, limit = 12) {
|
|
|
9648
9659
|
}
|
|
9649
9660
|
export {
|
|
9650
9661
|
FREE_RULE_COUNT,
|
|
9662
|
+
MODEL_ANALYSIS,
|
|
9663
|
+
MODEL_POLICY_REVIEWED,
|
|
9664
|
+
MODEL_REVIEW_INTERVAL_DAYS,
|
|
9665
|
+
MODEL_TEMPERATURE,
|
|
9666
|
+
MODEL_TRIAGE,
|
|
9651
9667
|
NON_APP_PATH_PATTERNS,
|
|
9652
9668
|
PRO_RULE_COUNT,
|
|
9653
9669
|
RULE_IMPACTS,
|
|
@@ -9839,6 +9855,7 @@ export {
|
|
|
9839
9855
|
pathTraversal,
|
|
9840
9856
|
pickleDeserialization,
|
|
9841
9857
|
piiInLogs,
|
|
9858
|
+
proOnlyRules,
|
|
9842
9859
|
prototypePollution,
|
|
9843
9860
|
pyDjangoAllowedHostsWildcard,
|
|
9844
9861
|
pyDjangoMarkSafe,
|