xploitscan-shared-rules 1.13.1 → 1.14.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -188,6 +188,22 @@ declare function detectFramework(files: {
188
188
  path: string;
189
189
  content: string;
190
190
  }[]): DetectedFramework[];
191
+ type VibePlatform = "lovable" | "bolt" | "replit" | "cursor" | "v0" | "claude-code";
192
+ /**
193
+ * Detect the AI coding platform / scaffold behind a project from tell-tale
194
+ * files, dependencies, and generated-comment headers.
195
+ *
196
+ * Deliberately high-precision: signals are mostly exact config-file paths
197
+ * (`.replit`, `.cursorrules`, `.bolt/`) plus a couple of unambiguous content
198
+ * markers (`lovable-tagger`, `bolt.new`, `v0.dev`). A plain framework project
199
+ * with none of these returns `[]` — we never guess a platform, because a wrong
200
+ * "Detected: X" label reads worse than none. Returns every platform detected
201
+ * (a Lovable app opened in Cursor legitimately reports both).
202
+ */
203
+ declare function detectPlatform(files: {
204
+ path: string;
205
+ content: string;
206
+ }[]): VibePlatform[];
191
207
  type SecurityGrade = "A+" | "A" | "B" | "C" | "D" | "F";
192
208
  interface GradeResult {
193
209
  grade: SecurityGrade;
@@ -318,6 +334,8 @@ declare const llmOutputToSink: CustomRule;
318
334
  declare const secretInLLMPrompt: CustomRule;
319
335
  declare const webhookMissingIdempotency: CustomRule;
320
336
  declare const middlewareMatcherExcludesApi: CustomRule;
337
+ declare const hardcodedCreditCard: CustomRule;
338
+ declare const hardcodedSSN: CustomRule;
321
339
  declare const secretInURLParam: CustomRule;
322
340
  declare const secretLoggedToConsole: CustomRule;
323
341
  declare const secretInErrorResponse: CustomRule;
@@ -509,4 +527,4 @@ declare function getObjectProperty(node: ObjectExpression, key: string): {
509
527
  /** Does this CallExpression spread an expression `matcher` returns true for? */
510
528
  declare function callSpreads(call: CallExpression, matcher: (node: Node) => boolean): boolean;
511
529
 
512
- export { type AIFilterResult, type Confidence, type CustomRule, type DetectedFramework, type Exposure, type FilteredFinding, type Finding, type GradeResult, type ParsedFile, RULE_IMPACTS, type RuleMatch, type SecurityGrade, type Severity, type TaintMap, allCustomRules, allRules, androidDebuggable, blockingMainThread, buildTaintMap, calculateGrade, callSpreads, callbackHell, classifyExposure, clickjacking, clientComponentSecret, clientSideAuth, commandInjection, complianceMap, consoleLogProduction, corsLocalhost, corsServerless, corsWildcard, dangerousInnerHTML, deprecatedTLS, detectFramework, 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, filterFalsePositives, firebaseClientConfig, flaskSecretKey, freeRules, getObjectProperty, getSnippet, ghaExpressionInjection, ghaPermissionsWriteAll, ghaPullRequestTargetCheckout, ghaThirdPartyActionWithSecrets, githubActionsInjection, graphqlCSRFDisabled, graphqlIntrospection, graphqlNoComplexityLimit, graphqlNoDepthLimit, hardcodedAlgoliaAdminKey, hardcodedAnthropicKey, hardcodedCloudflareToken, hardcodedCohereKey, 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, 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, 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, nosqlInjection, openRedirectParams, overlyPermissiveIAM, parseFile, 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, visitBinary, visitCalls, vulnerableDependencies, weakHashing, weakPasswordRequirements, weakRSAKeySize, webhookMissingIdempotency, webhookSignatureVerification, xssVulnerability, xxeVulnerability };
530
+ export { type AIFilterResult, type Confidence, type CustomRule, type DetectedFramework, type Exposure, type FilteredFinding, type Finding, type GradeResult, type ParsedFile, RULE_IMPACTS, type RuleMatch, type SecurityGrade, type Severity, type TaintMap, type VibePlatform, allCustomRules, allRules, androidDebuggable, blockingMainThread, buildTaintMap, calculateGrade, callSpreads, callbackHell, classifyExposure, clickjacking, clientComponentSecret, clientSideAuth, commandInjection, complianceMap, consoleLogProduction, corsLocalhost, corsServerless, corsWildcard, dangerousInnerHTML, deprecatedTLS, 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, filterFalsePositives, 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, 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, nosqlInjection, openRedirectParams, overlyPermissiveIAM, parseFile, 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, visitBinary, visitCalls, vulnerableDependencies, weakHashing, weakPasswordRequirements, weakRSAKeySize, webhookMissingIdempotency, webhookSignatureVerification, xssVulnerability, xxeVulnerability };
package/dist/index.d.ts CHANGED
@@ -188,6 +188,22 @@ declare function detectFramework(files: {
188
188
  path: string;
189
189
  content: string;
190
190
  }[]): DetectedFramework[];
191
+ type VibePlatform = "lovable" | "bolt" | "replit" | "cursor" | "v0" | "claude-code";
192
+ /**
193
+ * Detect the AI coding platform / scaffold behind a project from tell-tale
194
+ * files, dependencies, and generated-comment headers.
195
+ *
196
+ * Deliberately high-precision: signals are mostly exact config-file paths
197
+ * (`.replit`, `.cursorrules`, `.bolt/`) plus a couple of unambiguous content
198
+ * markers (`lovable-tagger`, `bolt.new`, `v0.dev`). A plain framework project
199
+ * with none of these returns `[]` — we never guess a platform, because a wrong
200
+ * "Detected: X" label reads worse than none. Returns every platform detected
201
+ * (a Lovable app opened in Cursor legitimately reports both).
202
+ */
203
+ declare function detectPlatform(files: {
204
+ path: string;
205
+ content: string;
206
+ }[]): VibePlatform[];
191
207
  type SecurityGrade = "A+" | "A" | "B" | "C" | "D" | "F";
192
208
  interface GradeResult {
193
209
  grade: SecurityGrade;
@@ -318,6 +334,8 @@ declare const llmOutputToSink: CustomRule;
318
334
  declare const secretInLLMPrompt: CustomRule;
319
335
  declare const webhookMissingIdempotency: CustomRule;
320
336
  declare const middlewareMatcherExcludesApi: CustomRule;
337
+ declare const hardcodedCreditCard: CustomRule;
338
+ declare const hardcodedSSN: CustomRule;
321
339
  declare const secretInURLParam: CustomRule;
322
340
  declare const secretLoggedToConsole: CustomRule;
323
341
  declare const secretInErrorResponse: CustomRule;
@@ -509,4 +527,4 @@ declare function getObjectProperty(node: ObjectExpression, key: string): {
509
527
  /** Does this CallExpression spread an expression `matcher` returns true for? */
510
528
  declare function callSpreads(call: CallExpression, matcher: (node: Node) => boolean): boolean;
511
529
 
512
- export { type AIFilterResult, type Confidence, type CustomRule, type DetectedFramework, type Exposure, type FilteredFinding, type Finding, type GradeResult, type ParsedFile, RULE_IMPACTS, type RuleMatch, type SecurityGrade, type Severity, type TaintMap, allCustomRules, allRules, androidDebuggable, blockingMainThread, buildTaintMap, calculateGrade, callSpreads, callbackHell, classifyExposure, clickjacking, clientComponentSecret, clientSideAuth, commandInjection, complianceMap, consoleLogProduction, corsLocalhost, corsServerless, corsWildcard, dangerousInnerHTML, deprecatedTLS, detectFramework, 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, filterFalsePositives, firebaseClientConfig, flaskSecretKey, freeRules, getObjectProperty, getSnippet, ghaExpressionInjection, ghaPermissionsWriteAll, ghaPullRequestTargetCheckout, ghaThirdPartyActionWithSecrets, githubActionsInjection, graphqlCSRFDisabled, graphqlIntrospection, graphqlNoComplexityLimit, graphqlNoDepthLimit, hardcodedAlgoliaAdminKey, hardcodedAnthropicKey, hardcodedCloudflareToken, hardcodedCohereKey, 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, 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, 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, nosqlInjection, openRedirectParams, overlyPermissiveIAM, parseFile, 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, visitBinary, visitCalls, vulnerableDependencies, weakHashing, weakPasswordRequirements, weakRSAKeySize, webhookMissingIdempotency, webhookSignatureVerification, xssVulnerability, xxeVulnerability };
530
+ export { type AIFilterResult, type Confidence, type CustomRule, type DetectedFramework, type Exposure, type FilteredFinding, type Finding, type GradeResult, type ParsedFile, RULE_IMPACTS, type RuleMatch, type SecurityGrade, type Severity, type TaintMap, type VibePlatform, allCustomRules, allRules, androidDebuggable, blockingMainThread, buildTaintMap, calculateGrade, callSpreads, callbackHell, classifyExposure, clickjacking, clientComponentSecret, clientSideAuth, commandInjection, complianceMap, consoleLogProduction, corsLocalhost, corsServerless, corsWildcard, dangerousInnerHTML, deprecatedTLS, 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, filterFalsePositives, 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, 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, nosqlInjection, openRedirectParams, overlyPermissiveIAM, parseFile, 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, visitBinary, visitCalls, vulnerableDependencies, weakHashing, weakPasswordRequirements, weakRSAKeySize, webhookMissingIdempotency, webhookSignatureVerification, xssVulnerability, xxeVulnerability };
package/dist/index.js CHANGED
@@ -256,7 +256,9 @@ var RULE_IMPACTS = {
256
256
  VC207: "Model output is attacker-influenceable via prompt injection. Feeding it into eval, new Function, a shell command, a raw SQL string, or a filesystem path turns a crafted or hallucinated response into remote code execution, command injection, SQL injection, or path traversal \u2014 your most dangerous sinks, driven by untrusted text.",
257
257
  VC208: "Interpolating a secret into a prompt ships your API key, token, or password to a third-party model provider, where it persists in their request logs and training-eligible data. A credential that leaves your infrastructure in prompt text should be considered compromised and rotated.",
258
258
  VC209: "Webhooks are delivered at-least-once. Without de-duplicating on the event id, a retried or replayed delivery re-runs the side effect \u2014 a customer is charged twice, a record is duplicated, or an entitlement is granted again. Stripe and Svix both retry on any non-2xx, so this fires in normal operation, not just under attack.",
259
- VC210: "If your auth middleware skips /api, those routes run with no gate unless each one re-checks auth itself. It is the most common way a Next.js app ends up with publicly callable API routes that everyone assumed the middleware was protecting."
259
+ VC210: "If your auth middleware skips /api, those routes run with no gate unless each one re-checks auth itself. It is the most common way a Next.js app ends up with publicly callable API routes that everyone assumed the middleware was protecting.",
260
+ VC211: "A real credit card number in source is cardholder data sitting in git history, CI logs, and every backup \u2014 a direct PCI-DSS violation. Anyone with repo access can read it, and it cannot be un-leaked once committed; the card must be treated as compromised.",
261
+ VC212: "A hardcoded Social Security Number is regulated PII permanently embedded in your git history and backups. It exposes a real person to identity theft, and its presence in source can trigger breach-notification and privacy-law obligations the moment the repo is accessed."
260
262
  };
261
263
 
262
264
  // src/exposure.ts
@@ -3865,6 +3867,31 @@ function detectFramework(files) {
3865
3867
  if (frameworks.size === 0) frameworks.add("unknown");
3866
3868
  return [...frameworks];
3867
3869
  }
3870
+ function detectPlatform(files) {
3871
+ const platforms = /* @__PURE__ */ new Set();
3872
+ for (const { path, content } of files) {
3873
+ const p = path.toLowerCase();
3874
+ if (/(^|\/)lovable\.config\./.test(p) || /lovable-tagger/i.test(content) || /lovable\.dev/i.test(content)) {
3875
+ platforms.add("lovable");
3876
+ }
3877
+ if (/(^|\/)\.bolt\//.test(p) || /(^|\/)\.stackblitzrc$/.test(p) || /bolt\.new/i.test(content)) {
3878
+ platforms.add("bolt");
3879
+ }
3880
+ if (/(^|\/)\.replit$/.test(p) || /(^|\/)replit\.nix$/.test(p)) {
3881
+ platforms.add("replit");
3882
+ }
3883
+ if (/(^|\/)\.cursorrules$/.test(p) || /(^|\/)\.cursor\//.test(p)) {
3884
+ platforms.add("cursor");
3885
+ }
3886
+ if (/(^|\/)claude\.md$/.test(p) || /(^|\/)\.claude\//.test(p)) {
3887
+ platforms.add("claude-code");
3888
+ }
3889
+ if (/v0\.dev/i.test(content) || /generated by v0\b/i.test(content)) {
3890
+ platforms.add("v0");
3891
+ }
3892
+ }
3893
+ return [...platforms];
3894
+ }
3868
3895
  function calculateGrade(findings, _totalFiles) {
3869
3896
  if (findings.length === 0) {
3870
3897
  return { grade: "A+", score: 100, summary: "No security issues detected. Excellent." };
@@ -4797,8 +4824,13 @@ var complianceMap = {
4797
4824
  // VC209–VC210: advisory heuristics
4798
4825
  VC209: { owasp: "A04:2021", cwe: "CWE-799" },
4799
4826
  // webhook missing idempotency
4800
- VC210: { owasp: "A01:2021", cwe: "CWE-862" }
4827
+ VC210: { owasp: "A01:2021", cwe: "CWE-862" },
4801
4828
  // middleware matcher excludes /api
4829
+ // VC211–VC212: hardcoded sensitive personal data (PII) in source
4830
+ VC211: { owasp: "A02:2021", cwe: "CWE-540" },
4831
+ // hardcoded credit card number
4832
+ VC212: { owasp: "A02:2021", cwe: "CWE-540" }
4833
+ // hardcoded US SSN
4802
4834
  };
4803
4835
  var consoleLogProduction = {
4804
4836
  id: "VC097",
@@ -7623,6 +7655,113 @@ var middlewareMatcherExcludesApi = {
7623
7655
  }], content, "VC210");
7624
7656
  }
7625
7657
  };
7658
+ function passesLuhn(digits) {
7659
+ let sum = 0;
7660
+ let alt = false;
7661
+ for (let i = digits.length - 1; i >= 0; i--) {
7662
+ let d = digits.charCodeAt(i) - 48;
7663
+ if (d < 0 || d > 9) return false;
7664
+ if (alt) {
7665
+ d *= 2;
7666
+ if (d > 9) d -= 9;
7667
+ }
7668
+ sum += d;
7669
+ alt = !alt;
7670
+ }
7671
+ return sum % 10 === 0;
7672
+ }
7673
+ function looksLikeIssuerCard(d) {
7674
+ if (/^4/.test(d) && (d.length === 13 || d.length === 16 || d.length === 19)) return true;
7675
+ if (/^5[1-5]/.test(d) && d.length === 16) return true;
7676
+ if (/^2(2[2-9]|[3-6]\d|7[01]|720)/.test(d) && d.length === 16) return true;
7677
+ if (/^3[47]/.test(d) && d.length === 15) return true;
7678
+ if (/^(6011|65|64[4-9])/.test(d) && d.length === 16) return true;
7679
+ return false;
7680
+ }
7681
+ var TEST_CARD_NUMBERS = /* @__PURE__ */ new Set([
7682
+ "4242424242424242",
7683
+ "4111111111111111",
7684
+ "4012888888881881",
7685
+ "4000056655665556",
7686
+ "4000000000000002",
7687
+ "4000000000009995",
7688
+ "5555555555554444",
7689
+ "5200828282828210",
7690
+ "5105105105105100",
7691
+ "2223003122003222",
7692
+ "378282246310005",
7693
+ "371449635398431",
7694
+ "6011111111111117",
7695
+ "6011000990139424",
7696
+ "3056930009020004",
7697
+ "38520000023237"
7698
+ ]);
7699
+ var hardcodedCreditCard = {
7700
+ id: "VC211",
7701
+ title: "Hardcoded credit card number",
7702
+ severity: "high",
7703
+ category: "Information Leakage",
7704
+ description: "A literal credit card number (Luhn-valid, with a real issuer prefix, and not a known network test card) appears in source. Cardholder data does not belong in code \u2014 it lands in git history, logs, and backups, and is a PCI-DSS violation. Use your processor's published test cards for tests, and tokenize real cards.",
7705
+ check(content, filePath) {
7706
+ if (isTestFile(filePath)) return [];
7707
+ const findings = [];
7708
+ const pattern = /(?<![\d.])\d[\d -]{11,21}\d(?![\d.])/g;
7709
+ let m;
7710
+ while ((m = pattern.exec(content)) !== null) {
7711
+ const digits = m[0].replace(/[ -]/g, "");
7712
+ if (digits.length < 13 || digits.length > 19) continue;
7713
+ if (TEST_CARD_NUMBERS.has(digits)) continue;
7714
+ if (!looksLikeIssuerCard(digits)) continue;
7715
+ if (!passesLuhn(digits)) continue;
7716
+ if (isCommentLine(content, m.index)) continue;
7717
+ const lineNum = lineNumberAt(content, m.index);
7718
+ findings.push({
7719
+ rule: "VC211",
7720
+ title: hardcodedCreditCard.title,
7721
+ severity: "high",
7722
+ category: "Information Leakage",
7723
+ file: filePath,
7724
+ line: lineNum,
7725
+ snippet: getSnippet(content, lineNum),
7726
+ fix: "Never store a real card number in source. Tokenize through your payment processor (Stripe, Braintree) and keep only the returned token. For tests, use the processor's published test cards (e.g. Stripe's 4242 4242 4242 4242)."
7727
+ });
7728
+ }
7729
+ return findings;
7730
+ }
7731
+ };
7732
+ var hardcodedSSN = {
7733
+ id: "VC212",
7734
+ title: "Hardcoded US Social Security Number",
7735
+ severity: "high",
7736
+ category: "Information Leakage",
7737
+ description: "A value in SSN format (NNN-NN-NNNN) is assigned to an SSN-named field in source. Social Security Numbers are regulated PII; a literal one leaks into git history, logs, and backups. Store SSNs encrypted at rest and load test data from generated fakes, never a code literal.",
7738
+ check(content, filePath) {
7739
+ if (isTestFile(filePath)) return [];
7740
+ const findings = [];
7741
+ const pattern = /(?:ssn|social[_-]?sec(?:urity)?(?:[_-]?(?:no|num|number))?|taxpayer[_-]?id)\b["']?\s*[:=]\s*["']?(\d{3}-\d{2}-\d{4})/gi;
7742
+ let m;
7743
+ while ((m = pattern.exec(content)) !== null) {
7744
+ const ssn = m[1];
7745
+ const [area, group, serial] = ssn.split("-");
7746
+ if (area === "000" || area === "666" || Number(area) >= 900) continue;
7747
+ if (group === "00" || serial === "0000") continue;
7748
+ if (ssn === "123-45-6789") continue;
7749
+ if (isCommentLine(content, m.index)) continue;
7750
+ const lineNum = lineNumberAt(content, m.index);
7751
+ findings.push({
7752
+ rule: "VC212",
7753
+ title: hardcodedSSN.title,
7754
+ severity: "high",
7755
+ category: "Information Leakage",
7756
+ file: filePath,
7757
+ line: lineNum,
7758
+ snippet: getSnippet(content, lineNum),
7759
+ fix: "Don't hardcode SSNs. Generate fake values for tests (a faker/factory), and store real SSNs with application-level encryption or in a secrets vault \u2014 never as a code literal."
7760
+ });
7761
+ }
7762
+ return findings;
7763
+ }
7764
+ };
7626
7765
  var secretInURLParam = {
7627
7766
  id: "VC146",
7628
7767
  title: "Secret Passed in URL Query Parameter",
@@ -8044,14 +8183,16 @@ var insecureDirectObjectReference = {
8044
8183
  check(content, filePath) {
8045
8184
  if (!filePath.match(/\.(js|ts|jsx|tsx)$/)) return [];
8046
8185
  if (isTestFile(filePath)) return [];
8047
- if (!/\/api\//i.test(filePath)) return [];
8048
- if (!/export\s+(?:async\s+)?function\s+(?:GET|PUT|PATCH|DELETE)/i.test(content)) return [];
8049
- if (!/params\.id|params\.(?:slug|uuid)|req\.params\./i.test(content)) return [];
8050
- if (!/findUnique|findFirst|findById|\.findOne|WHERE.*=.*params|\.get\(.*params/i.test(content)) return [];
8051
- if (/userId|ownerId|createdBy|user_id|owner_id|AND.*user|where.*user|authorize|canAccess|checkPermission|isOwner|belongsTo/i.test(content)) return [];
8052
8186
  if (/admin/i.test(filePath)) return [];
8053
- if (/requireUser|requireUserForApi|getServerSession|auth\(\)/i.test(content)) return [];
8054
- const m = content.match(/params\.id|params\.(?:slug|uuid)|req\.params\./);
8187
+ if (/userId|ownerId|createdBy|user_id|owner_id|AND.*user|where.*user|authorize|canAccess|checkPermission|isOwner|belongsTo/i.test(content)) return [];
8188
+ if (/requireUser|requireUserForApi|requireAuth|withAuth|getServerSession|auth\(\)|req\.user\b|passport|session\.user|isAuthenticated/i.test(content)) return [];
8189
+ if (!/findUnique|findFirst|findById|\.findOne|WHERE.*=.*(?:params|req\.(?:body|query))|\.get\(.*(?:params|req\.(?:body|query))/i.test(content)) return [];
8190
+ const isNextApiIdor = /\/api\//i.test(filePath) && /export\s+(?:async\s+)?function\s+(?:GET|PUT|PATCH|DELETE)/i.test(content) && /params\.id|params\.(?:slug|uuid)|req\.params\./i.test(content);
8191
+ const hasExpressHandler = /\.(get|post|put|patch|delete)\s*\(\s*["'`][^"'`]*["'`]\s*,/i.test(content);
8192
+ const readsObjectRef = /req\.params\b|req\.(?:body|query)\.\w*id\b/i.test(content);
8193
+ const isExpressIdor = hasExpressHandler && readsObjectRef;
8194
+ if (!isNextApiIdor && !isExpressIdor) return [];
8195
+ const m = content.match(/params\.id|params\.(?:slug|uuid)|req\.params\.\w+|req\.params\b|req\.(?:body|query)\.\w*id/i);
8055
8196
  if (!m || m.index === void 0) return [];
8056
8197
  const lineNum = lineNumberAt(content, m.index);
8057
8198
  return [{
@@ -8062,7 +8203,7 @@ var insecureDirectObjectReference = {
8062
8203
  file: filePath,
8063
8204
  line: lineNum,
8064
8205
  snippet: getSnippet(content, lineNum),
8065
- fix: "Add an ownership check: verify the requesting user owns the record before returning it. Example: WHERE id = params.id AND userId = session.userId"
8206
+ fix: "Add an ownership check: verify the requesting user owns the record before returning it. Example: WHERE id = req.params.id AND userId = req.user.id"
8066
8207
  }];
8067
8208
  }
8068
8209
  };
@@ -8351,7 +8492,10 @@ var allCustomRules = [
8351
8492
  // VC204–VC206: GraphQL server hardening
8352
8493
  graphqlNoDepthLimit,
8353
8494
  graphqlNoComplexityLimit,
8354
- graphqlCSRFDisabled
8495
+ graphqlCSRFDisabled,
8496
+ // VC211–VC212: hardcoded sensitive personal data (PII)
8497
+ hardcodedCreditCard,
8498
+ hardcodedSSN
8355
8499
  ];
8356
8500
  function runCustomRules(content, filePath, disabledRules = [], tier = "free", extraRules = []) {
8357
8501
  const findings = [];
@@ -8734,6 +8878,7 @@ export {
8734
8878
  dangerousInnerHTML,
8735
8879
  deprecatedTLS,
8736
8880
  detectFramework,
8881
+ detectPlatform,
8737
8882
  disabledTLSVerification,
8738
8883
  djangoDebug,
8739
8884
  dockerCopySensitive,
@@ -8779,6 +8924,7 @@ export {
8779
8924
  hardcodedAnthropicKey,
8780
8925
  hardcodedCloudflareToken,
8781
8926
  hardcodedCohereKey,
8927
+ hardcodedCreditCard,
8782
8928
  hardcodedDatadogKey,
8783
8929
  hardcodedDiscordToken,
8784
8930
  hardcodedEncryptionKey,
@@ -8808,6 +8954,7 @@ export {
8808
8954
  hardcodedRailwayToken,
8809
8955
  hardcodedReplicateKey,
8810
8956
  hardcodedResendKey,
8957
+ hardcodedSSN,
8811
8958
  hardcodedSecrets,
8812
8959
  hardcodedSendGridKey,
8813
8960
  hardcodedSentryAuthToken,