xploitscan-shared-rules 1.16.0 → 1.18.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 +107 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +31 -1
- package/dist/index.d.ts +31 -1
- package/dist/index.js +104 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -507,6 +507,36 @@ declare const allRules: CustomRule[];
|
|
|
507
507
|
declare const allCustomRules: CustomRule[];
|
|
508
508
|
declare function runCustomRules(content: string, filePath: string, disabledRules?: string[], tier?: "free" | "pro", extraRules?: CustomRule[]): Finding[];
|
|
509
509
|
|
|
510
|
+
/**
|
|
511
|
+
* Rule-set sizes as plain numbers, importable without dragging the rules in.
|
|
512
|
+
*
|
|
513
|
+
* WHY THIS FILE EXISTS — read before "simplifying" it back to `.length`.
|
|
514
|
+
*
|
|
515
|
+
* The CLI needs to tell a free user how many rules Pro unlocks. The obvious
|
|
516
|
+
* way is `allCustomRules.length`. Doing exactly that shipped **63 Pro-only
|
|
517
|
+
* rule definitions into the published free CLI bundle** in v1.3.3: tsup marks
|
|
518
|
+
* shared-rules `noExternal`, so importing the array inlines every regex, check
|
|
519
|
+
* body and fix string it contains. v1.3.2's executable JS had zero Pro-range
|
|
520
|
+
* rule IDs; v1.3.3's had 63, and the main chunk grew 1.7MB -> 1.9MB.
|
|
521
|
+
*
|
|
522
|
+
* `rules.ts` states the rule plainly: "Pro rules are delivered server-side —
|
|
523
|
+
* not shipped in npm package." A count is a number, and a number is all the
|
|
524
|
+
* CLI should have to import to print one.
|
|
525
|
+
*
|
|
526
|
+
* So: literals here, and `rule-counts.test.ts` asserts each one equals the
|
|
527
|
+
* real array's length. The value is *derived at test time* and *shipped as a
|
|
528
|
+
* constant* — drift fails CI instead of reaching npm, and nothing in this file
|
|
529
|
+
* references a rule, so a bundler can tree-shake the catalog away.
|
|
530
|
+
*
|
|
531
|
+
* THIS FILE MUST NOT IMPORT FROM ./rules.js. That import is the entire bug.
|
|
532
|
+
*/
|
|
533
|
+
/** Rules any caller gets, including anonymous and free-tier CLI users. */
|
|
534
|
+
declare const FREE_RULE_COUNT = 30;
|
|
535
|
+
/** Rules gated behind a paid plan and served from the API, never bundled. */
|
|
536
|
+
declare const PRO_RULE_COUNT = 182;
|
|
537
|
+
/** The full catalog. FREE_RULE_COUNT + PRO_RULE_COUNT, asserted in the test. */
|
|
538
|
+
declare const TOTAL_RULE_COUNT = 212;
|
|
539
|
+
|
|
510
540
|
interface FilteredFinding {
|
|
511
541
|
finding: Finding;
|
|
512
542
|
reason: string;
|
|
@@ -807,4 +837,4 @@ declare function getObjectProperty(node: ObjectExpression, key: string): {
|
|
|
807
837
|
/** Does this CallExpression spread an expression `matcher` returns true for? */
|
|
808
838
|
declare function callSpreads(call: CallExpression, matcher: (node: Node) => boolean): boolean;
|
|
809
839
|
|
|
810
|
-
export { type AIFilterResult, type BuilderFingerprint, type Confidence, type CustomRule, type DetectedFramework, type ExposedConfig, type Exposure, type FilteredFinding, type Finding, type GradeOptions, type GradeResult, type HeaderFinding, NON_APP_PATH_PATTERNS, type ParsedFile, RULE_IMPACTS, type RuleMatch, type SecurityGrade, type Severity, type TaintMap, type TargetCheck, type VibePlatform, allCustomRules, allRules, androidDebuggable, assessHeaders, blockingMainThread, 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, envNotGitignored, evalUsage, eventListenerLeak, exposedAdminRoutes, exposedAuthSecret, exposedDBCredentials, exposedDatabaseStudio, exposedDebugMode, exposedDockerPorts, exposedEnvFile, exposedGitDir, exposedServerActions, exposedSourceMaps, exposedStackTraces, 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, pathTraversal, pickleDeserialization, piiInLogs, prototypePollution, pyDjangoAllowedHostsWildcard, pyDjangoMarkSafe, pyJWTDecodeWeakConfig, pyJinja2AutoescapeOff, pyParamikoAutoAdd, pyRequestsVerifyFalse, pyTempfileMktemp, raceCondition, rdsPubliclyAccessible, reflectedCORSOrigin, regexDos, runCustomRules, s3BucketNoEncryption, scanEntropy, secretInBundleConfig, secretInCLIArgument, secretInErrorResponse, secretInHTMLAttribute, secretInLLMPrompt, secretInURLParam, secretLoggedToConsole, secretsInCI, securityGroupAllInbound, sensitiveAsyncStorage, sensitiveLocalStorage, sensitiveURLParams, sessionFixation, sqlInjection, ssrfVulnerability, ssti, stripeWebhookUnprotected, supabaseAnonAdmin, 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 };
|
|
840
|
+
export { type AIFilterResult, 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, RULE_IMPACTS, type RuleMatch, type SecurityGrade, type Severity, TOTAL_RULE_COUNT, type TaintMap, type TargetCheck, type VibePlatform, allCustomRules, allRules, androidDebuggable, assessHeaders, blockingMainThread, 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, envNotGitignored, evalUsage, eventListenerLeak, exposedAdminRoutes, exposedAuthSecret, exposedDBCredentials, exposedDatabaseStudio, exposedDebugMode, exposedDockerPorts, exposedEnvFile, exposedGitDir, exposedServerActions, exposedSourceMaps, exposedStackTraces, 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, pathTraversal, pickleDeserialization, piiInLogs, prototypePollution, pyDjangoAllowedHostsWildcard, pyDjangoMarkSafe, pyJWTDecodeWeakConfig, pyJinja2AutoescapeOff, pyParamikoAutoAdd, pyRequestsVerifyFalse, pyTempfileMktemp, raceCondition, rdsPubliclyAccessible, reflectedCORSOrigin, regexDos, runCustomRules, s3BucketNoEncryption, scanEntropy, secretInBundleConfig, secretInCLIArgument, secretInErrorResponse, secretInHTMLAttribute, secretInLLMPrompt, secretInURLParam, secretLoggedToConsole, secretsInCI, securityGroupAllInbound, sensitiveAsyncStorage, sensitiveLocalStorage, sensitiveURLParams, sessionFixation, sqlInjection, ssrfVulnerability, ssti, stripeWebhookUnprotected, supabaseAnonAdmin, 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
|
@@ -507,6 +507,36 @@ declare const allRules: CustomRule[];
|
|
|
507
507
|
declare const allCustomRules: CustomRule[];
|
|
508
508
|
declare function runCustomRules(content: string, filePath: string, disabledRules?: string[], tier?: "free" | "pro", extraRules?: CustomRule[]): Finding[];
|
|
509
509
|
|
|
510
|
+
/**
|
|
511
|
+
* Rule-set sizes as plain numbers, importable without dragging the rules in.
|
|
512
|
+
*
|
|
513
|
+
* WHY THIS FILE EXISTS — read before "simplifying" it back to `.length`.
|
|
514
|
+
*
|
|
515
|
+
* The CLI needs to tell a free user how many rules Pro unlocks. The obvious
|
|
516
|
+
* way is `allCustomRules.length`. Doing exactly that shipped **63 Pro-only
|
|
517
|
+
* rule definitions into the published free CLI bundle** in v1.3.3: tsup marks
|
|
518
|
+
* shared-rules `noExternal`, so importing the array inlines every regex, check
|
|
519
|
+
* body and fix string it contains. v1.3.2's executable JS had zero Pro-range
|
|
520
|
+
* rule IDs; v1.3.3's had 63, and the main chunk grew 1.7MB -> 1.9MB.
|
|
521
|
+
*
|
|
522
|
+
* `rules.ts` states the rule plainly: "Pro rules are delivered server-side —
|
|
523
|
+
* not shipped in npm package." A count is a number, and a number is all the
|
|
524
|
+
* CLI should have to import to print one.
|
|
525
|
+
*
|
|
526
|
+
* So: literals here, and `rule-counts.test.ts` asserts each one equals the
|
|
527
|
+
* real array's length. The value is *derived at test time* and *shipped as a
|
|
528
|
+
* constant* — drift fails CI instead of reaching npm, and nothing in this file
|
|
529
|
+
* references a rule, so a bundler can tree-shake the catalog away.
|
|
530
|
+
*
|
|
531
|
+
* THIS FILE MUST NOT IMPORT FROM ./rules.js. That import is the entire bug.
|
|
532
|
+
*/
|
|
533
|
+
/** Rules any caller gets, including anonymous and free-tier CLI users. */
|
|
534
|
+
declare const FREE_RULE_COUNT = 30;
|
|
535
|
+
/** Rules gated behind a paid plan and served from the API, never bundled. */
|
|
536
|
+
declare const PRO_RULE_COUNT = 182;
|
|
537
|
+
/** The full catalog. FREE_RULE_COUNT + PRO_RULE_COUNT, asserted in the test. */
|
|
538
|
+
declare const TOTAL_RULE_COUNT = 212;
|
|
539
|
+
|
|
510
540
|
interface FilteredFinding {
|
|
511
541
|
finding: Finding;
|
|
512
542
|
reason: string;
|
|
@@ -807,4 +837,4 @@ declare function getObjectProperty(node: ObjectExpression, key: string): {
|
|
|
807
837
|
/** Does this CallExpression spread an expression `matcher` returns true for? */
|
|
808
838
|
declare function callSpreads(call: CallExpression, matcher: (node: Node) => boolean): boolean;
|
|
809
839
|
|
|
810
|
-
export { type AIFilterResult, type BuilderFingerprint, type Confidence, type CustomRule, type DetectedFramework, type ExposedConfig, type Exposure, type FilteredFinding, type Finding, type GradeOptions, type GradeResult, type HeaderFinding, NON_APP_PATH_PATTERNS, type ParsedFile, RULE_IMPACTS, type RuleMatch, type SecurityGrade, type Severity, type TaintMap, type TargetCheck, type VibePlatform, allCustomRules, allRules, androidDebuggable, assessHeaders, blockingMainThread, 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, envNotGitignored, evalUsage, eventListenerLeak, exposedAdminRoutes, exposedAuthSecret, exposedDBCredentials, exposedDatabaseStudio, exposedDebugMode, exposedDockerPorts, exposedEnvFile, exposedGitDir, exposedServerActions, exposedSourceMaps, exposedStackTraces, 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, pathTraversal, pickleDeserialization, piiInLogs, prototypePollution, pyDjangoAllowedHostsWildcard, pyDjangoMarkSafe, pyJWTDecodeWeakConfig, pyJinja2AutoescapeOff, pyParamikoAutoAdd, pyRequestsVerifyFalse, pyTempfileMktemp, raceCondition, rdsPubliclyAccessible, reflectedCORSOrigin, regexDos, runCustomRules, s3BucketNoEncryption, scanEntropy, secretInBundleConfig, secretInCLIArgument, secretInErrorResponse, secretInHTMLAttribute, secretInLLMPrompt, secretInURLParam, secretLoggedToConsole, secretsInCI, securityGroupAllInbound, sensitiveAsyncStorage, sensitiveLocalStorage, sensitiveURLParams, sessionFixation, sqlInjection, ssrfVulnerability, ssti, stripeWebhookUnprotected, supabaseAnonAdmin, 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 };
|
|
840
|
+
export { type AIFilterResult, 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, RULE_IMPACTS, type RuleMatch, type SecurityGrade, type Severity, TOTAL_RULE_COUNT, type TaintMap, type TargetCheck, type VibePlatform, allCustomRules, allRules, androidDebuggable, assessHeaders, blockingMainThread, 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, envNotGitignored, evalUsage, eventListenerLeak, exposedAdminRoutes, exposedAuthSecret, exposedDBCredentials, exposedDatabaseStudio, exposedDebugMode, exposedDockerPorts, exposedEnvFile, exposedGitDir, exposedServerActions, exposedSourceMaps, exposedStackTraces, 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, pathTraversal, pickleDeserialization, piiInLogs, prototypePollution, pyDjangoAllowedHostsWildcard, pyDjangoMarkSafe, pyJWTDecodeWeakConfig, pyJinja2AutoescapeOff, pyParamikoAutoAdd, pyRequestsVerifyFalse, pyTempfileMktemp, raceCondition, rdsPubliclyAccessible, reflectedCORSOrigin, regexDos, runCustomRules, s3BucketNoEncryption, scanEntropy, secretInBundleConfig, secretInCLIArgument, secretInErrorResponse, secretInHTMLAttribute, secretInLLMPrompt, secretInURLParam, secretLoggedToConsole, secretsInCI, securityGroupAllInbound, sensitiveAsyncStorage, sensitiveLocalStorage, sensitiveURLParams, sessionFixation, sqlInjection, ssrfVulnerability, ssti, stripeWebhookUnprotected, supabaseAnonAdmin, 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
|
@@ -1190,6 +1190,80 @@ var exposedEnvFile = {
|
|
|
1190
1190
|
}];
|
|
1191
1191
|
}
|
|
1192
1192
|
};
|
|
1193
|
+
var SUPABASE_EDGE_FN_RE = /(?:^|\/)supabase\/functions\/[^/]+\/.*\.(?:m?[jt]s)$/;
|
|
1194
|
+
function isDenoEdgeEntry(codeOnly) {
|
|
1195
|
+
if (/\bDeno\s*\.\s*serve\s*\(/.test(codeOnly)) return true;
|
|
1196
|
+
const importsStdServe = /from\s+["']https?:\/\/deno\.land\/[^"']{0,120}\/http\/server(?:\.ts)?["']/.test(codeOnly) || /from\s+["'](?:jsr:)?@std\/http[^"']{0,40}["']/.test(codeOnly);
|
|
1197
|
+
return importsStdServe && /(?<![.\w])serve\s*\(/.test(codeOnly);
|
|
1198
|
+
}
|
|
1199
|
+
var DENO_EDGE_ENTRY_RE = /(?:\bDeno\s*\.\s*serve|(?<![.\w])serve)\s*\(/g;
|
|
1200
|
+
var EDGE_WEAK_AUTH_HINTS = [
|
|
1201
|
+
// WEAK_AUTH — the author touched the caller's identity somehow.
|
|
1202
|
+
// Covers the classifier's `/\bheaders\s*(?:\.\s*get\s*\(\s*)?["'`]?[Aa]uthorization/`
|
|
1203
|
+
// via the plain `authorization` token.
|
|
1204
|
+
/\bauthorization\b/i,
|
|
1205
|
+
/\bbearer\b/i,
|
|
1206
|
+
/\btoken\b/i,
|
|
1207
|
+
/\bsession\b/i,
|
|
1208
|
+
/\bapi[_-]?key\b/i,
|
|
1209
|
+
/\buser\b/,
|
|
1210
|
+
// Beyond the classifier's WEAK_AUTH list — these are strong-auth or
|
|
1211
|
+
// ownership signals there, and suppressing on them here can only remove
|
|
1212
|
+
// findings.
|
|
1213
|
+
/\b401\b/,
|
|
1214
|
+
/\b403\b/,
|
|
1215
|
+
/\bunauthori[sz]ed\b/i,
|
|
1216
|
+
/\bforbidden\b/i,
|
|
1217
|
+
/\bgetSession\b/,
|
|
1218
|
+
/\bgetClaims\b/,
|
|
1219
|
+
// RLS_DELEGATED — the database is the gate
|
|
1220
|
+
/\bcreateServerClient\s*\(/,
|
|
1221
|
+
/\bcreateRouteHandlerClient\s*\(/,
|
|
1222
|
+
/\bcreateServerComponentClient\s*\(/,
|
|
1223
|
+
/\bpersistSession\b/,
|
|
1224
|
+
// SIGNATURE_VERIFY — a receiver that authenticates its caller with a
|
|
1225
|
+
// signature or a shared secret rather than a session. Matched on content
|
|
1226
|
+
// rather than on the function's name, because the name is only a
|
|
1227
|
+
// convention: an edge function called `sync-inventory` can still be a
|
|
1228
|
+
// signed webhook receiver, and flagging it for "missing authentication"
|
|
1229
|
+
// would be wrong in the most embarrassing possible way.
|
|
1230
|
+
/\bconstructEvent\w*\s*\(/,
|
|
1231
|
+
/\bcreateHmac\s*\(/,
|
|
1232
|
+
// `hmac` bare, not just Node's `createHmac`. Deno edge functions verify
|
|
1233
|
+
// signatures with Web Crypto — `crypto.subtle.importKey(…, { name: "HMAC" })`
|
|
1234
|
+
// — which contains no other token on this list. Its absence flagged
|
|
1235
|
+
// correctly-signed receivers, which is the worst false positive this rule
|
|
1236
|
+
// can produce.
|
|
1237
|
+
/\bhmac\b/i,
|
|
1238
|
+
/\btimingSafeEqual\s*\(/,
|
|
1239
|
+
/\bsvix\b/i,
|
|
1240
|
+
/\bWebhook\s*\(\s*\w{0,64}SECRET/i,
|
|
1241
|
+
// Header names, quoted or bare. The quoted form below requires the literal
|
|
1242
|
+
// to END at `-signature`, so it misses `"X-Hub-Signature-256"` — the header
|
|
1243
|
+
// GitHub actually sends.
|
|
1244
|
+
/\bx-hub-signature\b/i,
|
|
1245
|
+
/\bx-signature\b/i,
|
|
1246
|
+
/\bstripe-signature\b/i,
|
|
1247
|
+
/\bverifyHeader\s*\(/,
|
|
1248
|
+
/\bverifySignature\b/i,
|
|
1249
|
+
/\bwebhook[_-]?secret\b/i,
|
|
1250
|
+
/\bsigning[_-]?secret\b/i,
|
|
1251
|
+
// Beyond the classifier's SIGNATURE_VERIFY list.
|
|
1252
|
+
/["'`][\w-]*-signature["'`]/i,
|
|
1253
|
+
/\b\w*(?:webhook|shared|signing|cron|admin|internal)[_-]?secret\b/i
|
|
1254
|
+
];
|
|
1255
|
+
var EDGE_PUBLIC_PATH_RE = /(^|[/_-])(health(?:z|check)?|ping|status|version|readyz|livez|robots|sitemap|manifest|favicon|opengraph|og-image|og|rss|feed|_?static|public|metrics)([/_.-]|$)/i;
|
|
1256
|
+
var EDGE_AUTH_FLOW_PATH_RE = /(^|[/_[-])(auth|login|signin|sign-in|signup|sign-up|register|logout|signout|sign-out|callback|oauth|sso|session|csrf|reset-password|forgot-password|forgot|magic-?link|verify-?email|confirm|nextauth|otp|invite|token)([/\]_.-]|$)/i;
|
|
1257
|
+
var EDGE_CRON_PATH_RE = /(^|[/_-])(cron|jobs?|scheduled?|tasks?)([/_.-]|$)/i;
|
|
1258
|
+
function isPublicByDesignEdgePath(filePath) {
|
|
1259
|
+
return EDGE_PUBLIC_PATH_RE.test(filePath) || EDGE_AUTH_FLOW_PATH_RE.test(filePath) || EDGE_CRON_PATH_RE.test(filePath);
|
|
1260
|
+
}
|
|
1261
|
+
function stripCorsHeaderList(codeOnly) {
|
|
1262
|
+
return codeOnly.replace(
|
|
1263
|
+
/["'`]?Access-Control-(?:Allow|Expose)-Headers["'`]?\s*:\s*["'`][^"'`]*["'`]/gi,
|
|
1264
|
+
""
|
|
1265
|
+
);
|
|
1266
|
+
}
|
|
1193
1267
|
var missingAuthMiddleware = {
|
|
1194
1268
|
id: "VC003",
|
|
1195
1269
|
title: "API Route Missing Authentication",
|
|
@@ -1201,14 +1275,19 @@ var missingAuthMiddleware = {
|
|
|
1201
1275
|
const routePatterns = [
|
|
1202
1276
|
// Express/Hono style
|
|
1203
1277
|
/\.(get|post|put|patch|delete)\s*\(\s*["'`][^"'`]+["'`]\s*,\s*(?:async\s+)?\(?(?:req|c|ctx)/gi,
|
|
1204
|
-
// Next.js API routes
|
|
1278
|
+
// Next.js API routes — named function declaration
|
|
1205
1279
|
/export\s+(?:async\s+)?function\s+(?:GET|POST|PUT|PATCH|DELETE)\s*\(/gi
|
|
1206
1280
|
];
|
|
1281
|
+
if (/(?:^|\/)(?:src\/)?app\/(?:.*\/)?route\.(?:m?[jt]sx?)$/.test(filePath)) {
|
|
1282
|
+
routePatterns.push(
|
|
1283
|
+
/export\s+const\s+(?:GET|POST|PUT|PATCH|DELETE)\s*(?::[^=\n]{0,120})?=\s*(?:async\s*)?(?:function\b|\()/g
|
|
1284
|
+
);
|
|
1285
|
+
}
|
|
1207
1286
|
if (isTestFile(filePath)) return [];
|
|
1208
1287
|
if (filePath.match(/\.(md|txt|rst|html|css|json|yaml|yml)$/)) return [];
|
|
1209
1288
|
const isAuthRoute = /\/auth\/|\/login|\/signup|\/register|\/logout|\/password\/|\/forgot|\/reset/i.test(filePath);
|
|
1210
1289
|
if (isAuthRoute) return [];
|
|
1211
|
-
const isWebhookRoute = /\/webhook/i.test(filePath);
|
|
1290
|
+
const isWebhookRoute = /\/webhook/i.test(filePath) || /(?:^|[/_-])webhooks?(?:[/_.-]|$)/i.test(filePath);
|
|
1212
1291
|
if (isWebhookRoute) return [];
|
|
1213
1292
|
const codeOnly = content.replace(/\/\*[\s\S]*?\*\//g, "").replace(/(^|[^:])\/\/.*$/gm, "$1").replace(/^\s*#.*$/gm, "");
|
|
1214
1293
|
const authPatterns = [
|
|
@@ -1253,6 +1332,21 @@ var missingAuthMiddleware = {
|
|
|
1253
1332
|
)
|
|
1254
1333
|
);
|
|
1255
1334
|
}
|
|
1335
|
+
if (matches.length === 0 && SUPABASE_EDGE_FN_RE.test(filePath) && isDenoEdgeEntry(codeOnly) && !isPublicByDesignEdgePath(filePath)) {
|
|
1336
|
+
const withoutCors = stripCorsHeaderList(codeOnly);
|
|
1337
|
+
const hasWeakHint = EDGE_WEAK_AUTH_HINTS.some((p) => p.test(withoutCors));
|
|
1338
|
+
if (!hasWeakHint) {
|
|
1339
|
+
matches.push(
|
|
1340
|
+
...findMatches(
|
|
1341
|
+
content,
|
|
1342
|
+
DENO_EDGE_ENTRY_RE,
|
|
1343
|
+
missingAuthMiddleware,
|
|
1344
|
+
filePath,
|
|
1345
|
+
() => "This edge function does not establish who is calling it. Read the caller's token from the Authorization header and resolve it (`const { data: { user } } = await supabase.auth.getUser(token)`), or build the Supabase client with that token so row-level security scopes every query to the caller. If the endpoint is public by design, add an inline `// VC003-OK: <reason>` comment above the handler to silence."
|
|
1346
|
+
)
|
|
1347
|
+
);
|
|
1348
|
+
}
|
|
1349
|
+
}
|
|
1256
1350
|
return filterSilenced(matches, content, "VC003");
|
|
1257
1351
|
}
|
|
1258
1352
|
};
|
|
@@ -8653,6 +8747,11 @@ function runCustomRules(content, filePath, disabledRules = [], tier = "free", ex
|
|
|
8653
8747
|
return findings;
|
|
8654
8748
|
}
|
|
8655
8749
|
|
|
8750
|
+
// src/rule-counts.ts
|
|
8751
|
+
var FREE_RULE_COUNT = 30;
|
|
8752
|
+
var PRO_RULE_COUNT = 182;
|
|
8753
|
+
var TOTAL_RULE_COUNT = 212;
|
|
8754
|
+
|
|
8656
8755
|
// src/ai-fp-filter.ts
|
|
8657
8756
|
import Anthropic from "@anthropic-ai/sdk";
|
|
8658
8757
|
var REVIEW_SYSTEM_PROMPT = `You are reviewing security scan findings for false positives. Your job is to look at each finding and the surrounding code to determine if it's a REAL security vulnerability or a FALSE POSITIVE.
|
|
@@ -9206,8 +9305,11 @@ function extractScriptUrls(html, pageUrl, limit = 12) {
|
|
|
9206
9305
|
return [...new Set(out)];
|
|
9207
9306
|
}
|
|
9208
9307
|
export {
|
|
9308
|
+
FREE_RULE_COUNT,
|
|
9209
9309
|
NON_APP_PATH_PATTERNS,
|
|
9310
|
+
PRO_RULE_COUNT,
|
|
9210
9311
|
RULE_IMPACTS,
|
|
9312
|
+
TOTAL_RULE_COUNT,
|
|
9211
9313
|
allCustomRules,
|
|
9212
9314
|
allRules,
|
|
9213
9315
|
androidDebuggable,
|