xploitscan-shared-rules 1.28.1 → 1.29.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 +224 -0
- 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 +223 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1336,6 +1336,36 @@ interface QualityFile {
|
|
|
1336
1336
|
isServer: boolean;
|
|
1337
1337
|
}
|
|
1338
1338
|
|
|
1339
|
+
/**
|
|
1340
|
+
* Worked examples for the quality catalogue, one vulnerable/safe pair per rule.
|
|
1341
|
+
*
|
|
1342
|
+
* These are published on xploitscan.com/quality/<id>, which is the reason they
|
|
1343
|
+
* are here and not in the web package: `quality.test.ts` runs every one of them
|
|
1344
|
+
* through the real scanner and asserts that the vulnerable sample fires its own
|
|
1345
|
+
* rule and the safe sample does not. A page that shows a reader "this is what
|
|
1346
|
+
* we catch" has to be right, and the only way to keep it right through a year
|
|
1347
|
+
* of rule edits is to make a wrong example fail the build.
|
|
1348
|
+
*
|
|
1349
|
+
* Writing them this way also found things. QA002's first draft ended in
|
|
1350
|
+
* `setRevoked(true)`, which is not a success assertion the rule recognises, so
|
|
1351
|
+
* the "vulnerable" sample was quietly correct code. QA004's used a bare
|
|
1352
|
+
* comparison rather than an interpolated secret, and QA005's had no click
|
|
1353
|
+
* affordance. All three would have shipped as documentation of behaviour the
|
|
1354
|
+
* scanner does not have.
|
|
1355
|
+
*/
|
|
1356
|
+
interface QualityExample {
|
|
1357
|
+
/** Path the sample is scanned at — several rules gate on the path shape. */
|
|
1358
|
+
path: string;
|
|
1359
|
+
language: string;
|
|
1360
|
+
/** Fires the rule. */
|
|
1361
|
+
vulnerable: string;
|
|
1362
|
+
/** The same code, corrected. Must NOT fire the rule. */
|
|
1363
|
+
safe: string;
|
|
1364
|
+
/** What changed between them, in one sentence. */
|
|
1365
|
+
difference: string;
|
|
1366
|
+
}
|
|
1367
|
+
declare const QUALITY_EXAMPLES: Record<string, QualityExample>;
|
|
1368
|
+
|
|
1339
1369
|
/**
|
|
1340
1370
|
* The quality catalogue.
|
|
1341
1371
|
*
|
|
@@ -1356,4 +1386,4 @@ declare function scanQuality(files: {
|
|
|
1356
1386
|
content: string;
|
|
1357
1387
|
}[], rules?: QualityRule[]): Finding[];
|
|
1358
1388
|
|
|
1359
|
-
export { type AIFilterResult, type AppRoute, type BuilderFingerprint, CHECKABLE_CLAIMS, type Confidence, type CustomRule, type DetectedFramework, type ExposedConfig, type Exposure, FREE_RULE_COUNT, type FilteredFinding, type Finding, type GradeOptions, type GradeResult, type HeaderFinding, INTENT_EXPECTATIONS, type IntentExpectation, type IntentMismatch, type IntentOrigin, type IntentReport, type IntentStatement, MODEL_ANALYSIS, MODEL_POLICY_REVIEWED, MODEL_REVIEW_INTERVAL_DAYS, MODEL_TEMPERATURE, MODEL_TRIAGE, NON_APP_PATH_PATTERNS, PRO_RULE_COUNT, type ParsedFile, type ProjectContext, type QualityContext, type QualityFile, type QualityHit, type QualityRule, RULE_IMPACTS, type RouteFramework, type RouteTable, type RuleMatch, type SecurityGrade, type Severity, TEST_FILE_PATTERN, TOTAL_RULE_COUNT, type TaintMap, type TargetCheck, type VibePlatform, accountStateFromWebStorage, allCustomRules, allRules, androidDebuggable, assessHeaders, blockingMainThread, buildProjectContext, buildTaintMap, calculateGrade, callSpreads, callbackHell, checkIntent, classifyExposure, classifyStatement, 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, harvestIntent, 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, maskComments, 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, qualityRules, raceCondition, rdsPubliclyAccessible, reflectedCORSOrigin, regexDos, routeForFile, runCustomRules, s3BucketNoEncryption, scanEntropy, scanQuality, 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 };
|
|
1389
|
+
export { type AIFilterResult, type AppRoute, type BuilderFingerprint, CHECKABLE_CLAIMS, type Confidence, type CustomRule, type DetectedFramework, type ExposedConfig, type Exposure, FREE_RULE_COUNT, type FilteredFinding, type Finding, type GradeOptions, type GradeResult, type HeaderFinding, INTENT_EXPECTATIONS, type IntentExpectation, type IntentMismatch, type IntentOrigin, type IntentReport, type IntentStatement, MODEL_ANALYSIS, MODEL_POLICY_REVIEWED, MODEL_REVIEW_INTERVAL_DAYS, MODEL_TEMPERATURE, MODEL_TRIAGE, NON_APP_PATH_PATTERNS, PRO_RULE_COUNT, type ParsedFile, type ProjectContext, QUALITY_EXAMPLES, type QualityContext, type QualityExample, type QualityFile, type QualityHit, type QualityRule, RULE_IMPACTS, type RouteFramework, type RouteTable, type RuleMatch, type SecurityGrade, type Severity, TEST_FILE_PATTERN, TOTAL_RULE_COUNT, type TaintMap, type TargetCheck, type VibePlatform, accountStateFromWebStorage, allCustomRules, allRules, androidDebuggable, assessHeaders, blockingMainThread, buildProjectContext, buildTaintMap, calculateGrade, callSpreads, callbackHell, checkIntent, classifyExposure, classifyStatement, 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, harvestIntent, 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, maskComments, 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, qualityRules, raceCondition, rdsPubliclyAccessible, reflectedCORSOrigin, regexDos, routeForFile, runCustomRules, s3BucketNoEncryption, scanEntropy, scanQuality, 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
|
@@ -1336,6 +1336,36 @@ interface QualityFile {
|
|
|
1336
1336
|
isServer: boolean;
|
|
1337
1337
|
}
|
|
1338
1338
|
|
|
1339
|
+
/**
|
|
1340
|
+
* Worked examples for the quality catalogue, one vulnerable/safe pair per rule.
|
|
1341
|
+
*
|
|
1342
|
+
* These are published on xploitscan.com/quality/<id>, which is the reason they
|
|
1343
|
+
* are here and not in the web package: `quality.test.ts` runs every one of them
|
|
1344
|
+
* through the real scanner and asserts that the vulnerable sample fires its own
|
|
1345
|
+
* rule and the safe sample does not. A page that shows a reader "this is what
|
|
1346
|
+
* we catch" has to be right, and the only way to keep it right through a year
|
|
1347
|
+
* of rule edits is to make a wrong example fail the build.
|
|
1348
|
+
*
|
|
1349
|
+
* Writing them this way also found things. QA002's first draft ended in
|
|
1350
|
+
* `setRevoked(true)`, which is not a success assertion the rule recognises, so
|
|
1351
|
+
* the "vulnerable" sample was quietly correct code. QA004's used a bare
|
|
1352
|
+
* comparison rather than an interpolated secret, and QA005's had no click
|
|
1353
|
+
* affordance. All three would have shipped as documentation of behaviour the
|
|
1354
|
+
* scanner does not have.
|
|
1355
|
+
*/
|
|
1356
|
+
interface QualityExample {
|
|
1357
|
+
/** Path the sample is scanned at — several rules gate on the path shape. */
|
|
1358
|
+
path: string;
|
|
1359
|
+
language: string;
|
|
1360
|
+
/** Fires the rule. */
|
|
1361
|
+
vulnerable: string;
|
|
1362
|
+
/** The same code, corrected. Must NOT fire the rule. */
|
|
1363
|
+
safe: string;
|
|
1364
|
+
/** What changed between them, in one sentence. */
|
|
1365
|
+
difference: string;
|
|
1366
|
+
}
|
|
1367
|
+
declare const QUALITY_EXAMPLES: Record<string, QualityExample>;
|
|
1368
|
+
|
|
1339
1369
|
/**
|
|
1340
1370
|
* The quality catalogue.
|
|
1341
1371
|
*
|
|
@@ -1356,4 +1386,4 @@ declare function scanQuality(files: {
|
|
|
1356
1386
|
content: string;
|
|
1357
1387
|
}[], rules?: QualityRule[]): Finding[];
|
|
1358
1388
|
|
|
1359
|
-
export { type AIFilterResult, type AppRoute, type BuilderFingerprint, CHECKABLE_CLAIMS, type Confidence, type CustomRule, type DetectedFramework, type ExposedConfig, type Exposure, FREE_RULE_COUNT, type FilteredFinding, type Finding, type GradeOptions, type GradeResult, type HeaderFinding, INTENT_EXPECTATIONS, type IntentExpectation, type IntentMismatch, type IntentOrigin, type IntentReport, type IntentStatement, MODEL_ANALYSIS, MODEL_POLICY_REVIEWED, MODEL_REVIEW_INTERVAL_DAYS, MODEL_TEMPERATURE, MODEL_TRIAGE, NON_APP_PATH_PATTERNS, PRO_RULE_COUNT, type ParsedFile, type ProjectContext, type QualityContext, type QualityFile, type QualityHit, type QualityRule, RULE_IMPACTS, type RouteFramework, type RouteTable, type RuleMatch, type SecurityGrade, type Severity, TEST_FILE_PATTERN, TOTAL_RULE_COUNT, type TaintMap, type TargetCheck, type VibePlatform, accountStateFromWebStorage, allCustomRules, allRules, androidDebuggable, assessHeaders, blockingMainThread, buildProjectContext, buildTaintMap, calculateGrade, callSpreads, callbackHell, checkIntent, classifyExposure, classifyStatement, 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, harvestIntent, 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, maskComments, 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, qualityRules, raceCondition, rdsPubliclyAccessible, reflectedCORSOrigin, regexDos, routeForFile, runCustomRules, s3BucketNoEncryption, scanEntropy, scanQuality, 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 };
|
|
1389
|
+
export { type AIFilterResult, type AppRoute, type BuilderFingerprint, CHECKABLE_CLAIMS, type Confidence, type CustomRule, type DetectedFramework, type ExposedConfig, type Exposure, FREE_RULE_COUNT, type FilteredFinding, type Finding, type GradeOptions, type GradeResult, type HeaderFinding, INTENT_EXPECTATIONS, type IntentExpectation, type IntentMismatch, type IntentOrigin, type IntentReport, type IntentStatement, MODEL_ANALYSIS, MODEL_POLICY_REVIEWED, MODEL_REVIEW_INTERVAL_DAYS, MODEL_TEMPERATURE, MODEL_TRIAGE, NON_APP_PATH_PATTERNS, PRO_RULE_COUNT, type ParsedFile, type ProjectContext, QUALITY_EXAMPLES, type QualityContext, type QualityExample, type QualityFile, type QualityHit, type QualityRule, RULE_IMPACTS, type RouteFramework, type RouteTable, type RuleMatch, type SecurityGrade, type Severity, TEST_FILE_PATTERN, TOTAL_RULE_COUNT, type TaintMap, type TargetCheck, type VibePlatform, accountStateFromWebStorage, allCustomRules, allRules, androidDebuggable, assessHeaders, blockingMainThread, buildProjectContext, buildTaintMap, calculateGrade, callSpreads, callbackHell, checkIntent, classifyExposure, classifyStatement, 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, harvestIntent, 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, maskComments, 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, qualityRules, raceCondition, rdsPubliclyAccessible, reflectedCORSOrigin, regexDos, routeForFile, runCustomRules, s3BucketNoEncryption, scanEntropy, scanQuality, 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
|
@@ -12296,6 +12296,228 @@ var unassociatedLabel = {
|
|
|
12296
12296
|
}
|
|
12297
12297
|
};
|
|
12298
12298
|
|
|
12299
|
+
// src/quality/examples.ts
|
|
12300
|
+
var QUALITY_EXAMPLES = {
|
|
12301
|
+
QA001: {
|
|
12302
|
+
path: "supabase/functions/list-items/index.ts",
|
|
12303
|
+
language: "typescript",
|
|
12304
|
+
difference: "The catch answers with 500 and an error instead of 200 and an empty list, so the caller can tell a broken query from an account with no items.",
|
|
12305
|
+
vulnerable: `Deno.serve(async (req) => {
|
|
12306
|
+
try {
|
|
12307
|
+
const { data } = await supabase.from("items").select("*");
|
|
12308
|
+
return new Response(JSON.stringify({ items: data }), { status: 200 });
|
|
12309
|
+
} catch (err) {
|
|
12310
|
+
console.error(err);
|
|
12311
|
+
return new Response(JSON.stringify({ items: [] }), { status: 200 });
|
|
12312
|
+
}
|
|
12313
|
+
});`,
|
|
12314
|
+
safe: `Deno.serve(async (req) => {
|
|
12315
|
+
try {
|
|
12316
|
+
const { data } = await supabase.from("items").select("*");
|
|
12317
|
+
return new Response(JSON.stringify({ items: data }), { status: 200 });
|
|
12318
|
+
} catch (err) {
|
|
12319
|
+
console.error(err);
|
|
12320
|
+
return new Response(JSON.stringify({ error: "Could not load items" }), { status: 500 });
|
|
12321
|
+
}
|
|
12322
|
+
});`
|
|
12323
|
+
},
|
|
12324
|
+
QA002: {
|
|
12325
|
+
path: "app/settings/ApiKeyRow.tsx",
|
|
12326
|
+
language: "tsx",
|
|
12327
|
+
difference: "The failure branch tells the user instead of returning silently, so a revoke that did not happen cannot show as one that did.",
|
|
12328
|
+
vulnerable: `"use client";
|
|
12329
|
+
import { toast } from "sonner";
|
|
12330
|
+
|
|
12331
|
+
export function ApiKeyRow({ keyId }) {
|
|
12332
|
+
async function handleRevoke() {
|
|
12333
|
+
const res = await fetch(\`/api/keys/\${keyId}/revoke\`, { method: "POST" });
|
|
12334
|
+
if (!res.ok) return;
|
|
12335
|
+
toast.success("API key revoked");
|
|
12336
|
+
}
|
|
12337
|
+
|
|
12338
|
+
return <button onClick={handleRevoke}>Revoke</button>;
|
|
12339
|
+
}`,
|
|
12340
|
+
safe: `"use client";
|
|
12341
|
+
import { toast } from "sonner";
|
|
12342
|
+
|
|
12343
|
+
export function ApiKeyRow({ keyId }) {
|
|
12344
|
+
async function handleRevoke() {
|
|
12345
|
+
const res = await fetch(\`/api/keys/\${keyId}/revoke\`, { method: "POST" });
|
|
12346
|
+
if (!res.ok) {
|
|
12347
|
+
toast.error("Could not revoke the key. Try again.");
|
|
12348
|
+
return;
|
|
12349
|
+
}
|
|
12350
|
+
toast.success("API key revoked");
|
|
12351
|
+
}
|
|
12352
|
+
|
|
12353
|
+
return <button onClick={handleRevoke}>Revoke</button>;
|
|
12354
|
+
}`
|
|
12355
|
+
},
|
|
12356
|
+
QA003: {
|
|
12357
|
+
path: "app/api/billing/webhook/route.ts",
|
|
12358
|
+
language: "typescript",
|
|
12359
|
+
difference: "The catch rethrows, so the row is not left saying a credit was issued that never left Stripe \u2014 and the webhook is redelivered.",
|
|
12360
|
+
vulnerable: `export async function POST(req) {
|
|
12361
|
+
const referral = await db.get("SELECT id FROM referrals WHERE status = 'pending' LIMIT 1");
|
|
12362
|
+
await db.run("UPDATE referrals SET status = 'rewarded' WHERE id = ?", referral.id);
|
|
12363
|
+
try {
|
|
12364
|
+
await stripe.customers.createBalanceTransaction(customerId, { amount: -1000, currency: "usd" });
|
|
12365
|
+
} catch (err) {
|
|
12366
|
+
logError("credit failed", err);
|
|
12367
|
+
}
|
|
12368
|
+
return new Response(JSON.stringify({ ok: true }), { status: 200 });
|
|
12369
|
+
}`,
|
|
12370
|
+
safe: `export async function POST(req) {
|
|
12371
|
+
const referral = await db.get("SELECT id FROM referrals WHERE status = 'pending' LIMIT 1");
|
|
12372
|
+
await db.run("UPDATE referrals SET status = 'rewarded' WHERE id = ?", referral.id);
|
|
12373
|
+
try {
|
|
12374
|
+
await stripe.customers.createBalanceTransaction(customerId, { amount: -1000, currency: "usd" });
|
|
12375
|
+
} catch (err) {
|
|
12376
|
+
logError("credit failed", err);
|
|
12377
|
+
throw err;
|
|
12378
|
+
}
|
|
12379
|
+
return new Response(JSON.stringify({ ok: true }), { status: 200 });
|
|
12380
|
+
}`
|
|
12381
|
+
},
|
|
12382
|
+
QA004: {
|
|
12383
|
+
path: "app/api/cron/cleanup/route.ts",
|
|
12384
|
+
language: "typescript",
|
|
12385
|
+
difference: 'The secret is read once and the handler refuses to run without it, so an unset variable can no longer make the comparison succeed against "Bearer undefined".',
|
|
12386
|
+
vulnerable: `export async function GET(req) {
|
|
12387
|
+
const auth = req.headers.get("authorization");
|
|
12388
|
+
if (auth !== \`Bearer \${process.env.CRON_SECRET}\`) {
|
|
12389
|
+
return new Response("Unauthorized", { status: 401 });
|
|
12390
|
+
}
|
|
12391
|
+
await purgeExpiredRows();
|
|
12392
|
+
return new Response("ok");
|
|
12393
|
+
}`,
|
|
12394
|
+
safe: `export async function GET(req) {
|
|
12395
|
+
const secret = process.env.CRON_SECRET;
|
|
12396
|
+
if (!secret) throw new Error("CRON_SECRET is not set");
|
|
12397
|
+
const auth = req.headers.get("authorization");
|
|
12398
|
+
if (auth !== \`Bearer \${secret}\`) {
|
|
12399
|
+
return new Response("Unauthorized", { status: 401 });
|
|
12400
|
+
}
|
|
12401
|
+
await purgeExpiredRows();
|
|
12402
|
+
return new Response("ok");
|
|
12403
|
+
}`
|
|
12404
|
+
},
|
|
12405
|
+
QA005: {
|
|
12406
|
+
path: "app/components/SortableTable.tsx",
|
|
12407
|
+
language: "tsx",
|
|
12408
|
+
difference: "The handler moves onto a real button, which the browser makes focusable, Enter- and Space-activatable, and announces as a control.",
|
|
12409
|
+
vulnerable: `export function SortableTable({ rows, onSort }) {
|
|
12410
|
+
return (
|
|
12411
|
+
<table>
|
|
12412
|
+
<thead>
|
|
12413
|
+
<tr>
|
|
12414
|
+
<th className="cursor-pointer select-none" onClick={() => onSort("name")}>
|
|
12415
|
+
Name
|
|
12416
|
+
</th>
|
|
12417
|
+
</tr>
|
|
12418
|
+
</thead>
|
|
12419
|
+
</table>
|
|
12420
|
+
);
|
|
12421
|
+
}`,
|
|
12422
|
+
safe: `export function SortableTable({ rows, onSort }) {
|
|
12423
|
+
return (
|
|
12424
|
+
<table>
|
|
12425
|
+
<thead>
|
|
12426
|
+
<tr>
|
|
12427
|
+
<th>
|
|
12428
|
+
<button type="button" className="cursor-pointer select-none" onClick={() => onSort("name")}>
|
|
12429
|
+
Name
|
|
12430
|
+
</button>
|
|
12431
|
+
</th>
|
|
12432
|
+
</tr>
|
|
12433
|
+
</thead>
|
|
12434
|
+
</table>
|
|
12435
|
+
);
|
|
12436
|
+
}`
|
|
12437
|
+
},
|
|
12438
|
+
QA006: {
|
|
12439
|
+
path: "app/components/ConfirmDialog.tsx",
|
|
12440
|
+
language: "tsx",
|
|
12441
|
+
difference: "The panel declares itself a modal dialog, takes focus when it opens and closes on Escape, so a screen reader announces it and a keyboard can reach and leave it.",
|
|
12442
|
+
vulnerable: `export function ConfirmDialog({ open, onClose, onConfirm }) {
|
|
12443
|
+
if (!open) return null;
|
|
12444
|
+
return (
|
|
12445
|
+
<div className="fixed inset-0 bg-black/50 flex items-center justify-center">
|
|
12446
|
+
<div className="bg-white rounded-xl p-6">
|
|
12447
|
+
<h2>Delete this project?</h2>
|
|
12448
|
+
<button onClick={onClose}>Cancel</button>
|
|
12449
|
+
<button onClick={onConfirm}>Delete</button>
|
|
12450
|
+
</div>
|
|
12451
|
+
</div>
|
|
12452
|
+
);
|
|
12453
|
+
}`,
|
|
12454
|
+
safe: `export function ConfirmDialog({ open, onClose, onConfirm }) {
|
|
12455
|
+
const ref = useRef(null);
|
|
12456
|
+
useEffect(() => {
|
|
12457
|
+
if (!open) return;
|
|
12458
|
+
ref.current?.focus();
|
|
12459
|
+
const onKey = (e) => { if (e.key === "Escape") onClose(); };
|
|
12460
|
+
document.addEventListener("keydown", onKey);
|
|
12461
|
+
return () => document.removeEventListener("keydown", onKey);
|
|
12462
|
+
}, [open, onClose]);
|
|
12463
|
+
|
|
12464
|
+
if (!open) return null;
|
|
12465
|
+
return (
|
|
12466
|
+
<div className="fixed inset-0 bg-black/50 flex items-center justify-center">
|
|
12467
|
+
<div
|
|
12468
|
+
role="dialog"
|
|
12469
|
+
aria-modal="true"
|
|
12470
|
+
aria-labelledby="confirm-title"
|
|
12471
|
+
ref={ref}
|
|
12472
|
+
tabIndex={-1}
|
|
12473
|
+
className="bg-white rounded-xl p-6"
|
|
12474
|
+
>
|
|
12475
|
+
<h2 id="confirm-title">Delete this project?</h2>
|
|
12476
|
+
<button onClick={onClose}>Cancel</button>
|
|
12477
|
+
<button onClick={onConfirm}>Delete</button>
|
|
12478
|
+
</div>
|
|
12479
|
+
</div>
|
|
12480
|
+
);
|
|
12481
|
+
}`
|
|
12482
|
+
},
|
|
12483
|
+
QA007: {
|
|
12484
|
+
path: "app/api/orders/route.ts",
|
|
12485
|
+
language: "typescript",
|
|
12486
|
+
difference: "The query takes a bounded page, so one account with years of history cannot decide how much memory the request uses.",
|
|
12487
|
+
vulnerable: `export async function GET(req) {
|
|
12488
|
+
const userId = await requireUser(req);
|
|
12489
|
+
const orders = await prisma.order.findMany({ where: { userId } });
|
|
12490
|
+
return Response.json({ orders });
|
|
12491
|
+
}`,
|
|
12492
|
+
safe: `export async function GET(req) {
|
|
12493
|
+
const userId = await requireUser(req);
|
|
12494
|
+
const orders = await prisma.order.findMany({ where: { userId }, take: 50 });
|
|
12495
|
+
return Response.json({ orders });
|
|
12496
|
+
}`
|
|
12497
|
+
},
|
|
12498
|
+
QA008: {
|
|
12499
|
+
path: "app/components/SignupForm.tsx",
|
|
12500
|
+
language: "tsx",
|
|
12501
|
+
difference: "The label points at the input, so a screen reader reads the field's name and clicking the text focuses the field.",
|
|
12502
|
+
vulnerable: `export function SignupForm() {
|
|
12503
|
+
return (
|
|
12504
|
+
<form>
|
|
12505
|
+
<label>Email address</label>
|
|
12506
|
+
<input type="email" name="email" />
|
|
12507
|
+
</form>
|
|
12508
|
+
);
|
|
12509
|
+
}`,
|
|
12510
|
+
safe: `export function SignupForm() {
|
|
12511
|
+
return (
|
|
12512
|
+
<form>
|
|
12513
|
+
<label htmlFor="email">Email address</label>
|
|
12514
|
+
<input id="email" type="email" name="email" />
|
|
12515
|
+
</form>
|
|
12516
|
+
);
|
|
12517
|
+
}`
|
|
12518
|
+
}
|
|
12519
|
+
};
|
|
12520
|
+
|
|
12299
12521
|
// src/quality/index.ts
|
|
12300
12522
|
var qualityRules = [
|
|
12301
12523
|
silentFailedRead,
|
|
@@ -12351,6 +12573,7 @@ export {
|
|
|
12351
12573
|
MODEL_TRIAGE,
|
|
12352
12574
|
NON_APP_PATH_PATTERNS,
|
|
12353
12575
|
PRO_RULE_COUNT,
|
|
12576
|
+
QUALITY_EXAMPLES,
|
|
12354
12577
|
RULE_IMPACTS,
|
|
12355
12578
|
TEST_FILE_PATTERN,
|
|
12356
12579
|
TOTAL_RULE_COUNT,
|