xploitscan-shared-rules 1.15.2 → 1.16.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 +187 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +119 -1
- package/dist/index.d.ts +119 -1
- package/dist/index.js +180 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -578,6 +578,124 @@ declare function scanEntropy(files: {
|
|
|
578
578
|
content: string;
|
|
579
579
|
}[]): Finding[];
|
|
580
580
|
|
|
581
|
+
/**
|
|
582
|
+
* URL recon — what can be learned about a deployed app from what it already
|
|
583
|
+
* serves the public.
|
|
584
|
+
*
|
|
585
|
+
* Everything here is a PURE function over strings the caller has already
|
|
586
|
+
* fetched. No network access lives in this module, which is what makes the
|
|
587
|
+
* detection logic unit-testable and keeps the fetching — the dangerous part —
|
|
588
|
+
* in one auditable place in the caller.
|
|
589
|
+
*
|
|
590
|
+
* Scope, deliberately narrow:
|
|
591
|
+
*
|
|
592
|
+
* IN Reading what a site voluntarily serves to any browser: its HTML, its
|
|
593
|
+
* JavaScript bundles, its response headers. This is the same data a
|
|
594
|
+
* visitor's devtools shows, and no more.
|
|
595
|
+
*
|
|
596
|
+
* OUT Probing for vulnerabilities. No injection payloads, no auth-bypass
|
|
597
|
+
* attempts, no querying somebody's database with a key we found. Those
|
|
598
|
+
* are unauthorized security testing against a host the operator has not
|
|
599
|
+
* proven they own, and this product does not do that.
|
|
600
|
+
*
|
|
601
|
+
* The distinction matters commercially too: "your source maps are public" is a
|
|
602
|
+
* finding we can hand to a stranger safely, because acting on it requires
|
|
603
|
+
* access they already have. "Your database is unprotected, here is the key" is
|
|
604
|
+
* an attack map.
|
|
605
|
+
*/
|
|
606
|
+
/**
|
|
607
|
+
* Is a dotted-quad or IPv6 literal outside the publicly routable ranges?
|
|
608
|
+
*
|
|
609
|
+
* Exported because the caller MUST re-check this against the address DNS
|
|
610
|
+
* actually resolved to, not merely against the hostname the user typed.
|
|
611
|
+
* Checking only the hostname is defeated by pointing `evil.example.com` at
|
|
612
|
+
* 169.254.169.254 — the DNS-rebinding shape — and by any of the dozens of
|
|
613
|
+
* decimal / octal / IPv4-mapped-IPv6 spellings of a private address.
|
|
614
|
+
*/
|
|
615
|
+
declare function isPrivateAddress(address: string): boolean;
|
|
616
|
+
interface TargetRejection {
|
|
617
|
+
ok: false;
|
|
618
|
+
reason: string;
|
|
619
|
+
}
|
|
620
|
+
interface TargetAccepted {
|
|
621
|
+
ok: true;
|
|
622
|
+
url: string;
|
|
623
|
+
hostname: string;
|
|
624
|
+
}
|
|
625
|
+
type TargetCheck = TargetAccepted | TargetRejection;
|
|
626
|
+
/**
|
|
627
|
+
* Normalise and vet a user-supplied scan target.
|
|
628
|
+
*
|
|
629
|
+
* Accepts bare domains ("example.com") because that is what people paste, and
|
|
630
|
+
* upgrades them to https. Rejects anything that is not a public http(s)
|
|
631
|
+
* endpoint. This is a necessary gate, never a sufficient one — see
|
|
632
|
+
* isPrivateAddress on why the resolved IP must be checked separately.
|
|
633
|
+
*/
|
|
634
|
+
declare function parseScanTarget(input: string): TargetCheck;
|
|
635
|
+
interface BuilderFingerprint {
|
|
636
|
+
id: string;
|
|
637
|
+
name: string;
|
|
638
|
+
/** What we actually saw. Shown to the user — never assert without evidence. */
|
|
639
|
+
evidence: string;
|
|
640
|
+
}
|
|
641
|
+
declare function detectBuilder(haystack: string): BuilderFingerprint | null;
|
|
642
|
+
/**
|
|
643
|
+
* Extract `//# sourceMappingURL=` references from a bundle.
|
|
644
|
+
*
|
|
645
|
+
* This is the highest-value thing a URL scan can find. A production build that
|
|
646
|
+
* ships its source maps is publishing its original TypeScript — comments,
|
|
647
|
+
* internal names, dead code, and often the server-side helpers that were
|
|
648
|
+
* tree-shaken from the runtime but not from the map. It is a real finding on
|
|
649
|
+
* its own, and it is also the bridge to the actual product: given the maps we
|
|
650
|
+
* can reconstruct sources and run the full rule set against real code, with no
|
|
651
|
+
* repository access at all.
|
|
652
|
+
*
|
|
653
|
+
* Data-URI maps are ignored: inline maps are a bundler default in development
|
|
654
|
+
* and expose nothing that the served bundle did not already contain.
|
|
655
|
+
*/
|
|
656
|
+
declare function findSourceMapRefs(js: string, bundleUrl: string): string[];
|
|
657
|
+
interface ExposedConfig {
|
|
658
|
+
kind: "supabase" | "firebase";
|
|
659
|
+
/** Non-secret identifier, safe to echo back (project ref, project id). */
|
|
660
|
+
projectRef: string | null;
|
|
661
|
+
detail: string;
|
|
662
|
+
}
|
|
663
|
+
/**
|
|
664
|
+
* Backend configuration that a client bundle necessarily contains.
|
|
665
|
+
*
|
|
666
|
+
* IMPORTANT: finding these is NOT a vulnerability report. A Supabase anon key
|
|
667
|
+
* is designed to ship to the browser; every Supabase app has one. What matters
|
|
668
|
+
* is that it means the app's entire data-access security rests on row-level
|
|
669
|
+
* security being configured correctly — which cannot be determined from
|
|
670
|
+
* outside without querying their database, and we will not do that.
|
|
671
|
+
*
|
|
672
|
+
* So this is reported as an architectural fact plus a question the owner
|
|
673
|
+
* should answer, never as "you are exposed". Overstating it would be both
|
|
674
|
+
* wrong and the kind of scare-marketing this product exists to be the opposite
|
|
675
|
+
* of.
|
|
676
|
+
*
|
|
677
|
+
* A `service_role` key is a different matter entirely — that one is never
|
|
678
|
+
* supposed to reach a browser — and is flagged by the existing VC004 rule when
|
|
679
|
+
* the reconstructed source is scanned.
|
|
680
|
+
*/
|
|
681
|
+
declare function detectExposedConfig(js: string): ExposedConfig[];
|
|
682
|
+
interface HeaderFinding {
|
|
683
|
+
header: string;
|
|
684
|
+
severity: "medium" | "low" | "info";
|
|
685
|
+
message: string;
|
|
686
|
+
}
|
|
687
|
+
/**
|
|
688
|
+
* Header hygiene. Deliberately the LAST thing reported, and never the headline.
|
|
689
|
+
*
|
|
690
|
+
* securityheaders.com and Mozilla Observatory do this for free and have done
|
|
691
|
+
* for a decade. Leading with it would tell a visitor we are a commodity tool
|
|
692
|
+
* competing with something free, when the differentiator is everything above.
|
|
693
|
+
* It is included because its absence is conspicuous, not because it sells.
|
|
694
|
+
*/
|
|
695
|
+
declare function assessHeaders(headers: Record<string, string>): HeaderFinding[];
|
|
696
|
+
/** Script `src` URLs in an HTML document, resolved against the page URL. */
|
|
697
|
+
declare function extractScriptUrls(html: string, pageUrl: string, limit?: number): string[];
|
|
698
|
+
|
|
581
699
|
/**
|
|
582
700
|
* Centralized Babel parser with per-file caching.
|
|
583
701
|
*
|
|
@@ -689,4 +807,4 @@ declare function getObjectProperty(node: ObjectExpression, key: string): {
|
|
|
689
807
|
/** Does this CallExpression spread an expression `matcher` returns true for? */
|
|
690
808
|
declare function callSpreads(call: CallExpression, matcher: (node: Node) => boolean): boolean;
|
|
691
809
|
|
|
692
|
-
export { type AIFilterResult, type Confidence, type CustomRule, type DetectedFramework, type Exposure, type FilteredFinding, type Finding, type GradeOptions, type GradeResult, NON_APP_PATH_PATTERNS, 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, 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, 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 };
|
|
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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -578,6 +578,124 @@ declare function scanEntropy(files: {
|
|
|
578
578
|
content: string;
|
|
579
579
|
}[]): Finding[];
|
|
580
580
|
|
|
581
|
+
/**
|
|
582
|
+
* URL recon — what can be learned about a deployed app from what it already
|
|
583
|
+
* serves the public.
|
|
584
|
+
*
|
|
585
|
+
* Everything here is a PURE function over strings the caller has already
|
|
586
|
+
* fetched. No network access lives in this module, which is what makes the
|
|
587
|
+
* detection logic unit-testable and keeps the fetching — the dangerous part —
|
|
588
|
+
* in one auditable place in the caller.
|
|
589
|
+
*
|
|
590
|
+
* Scope, deliberately narrow:
|
|
591
|
+
*
|
|
592
|
+
* IN Reading what a site voluntarily serves to any browser: its HTML, its
|
|
593
|
+
* JavaScript bundles, its response headers. This is the same data a
|
|
594
|
+
* visitor's devtools shows, and no more.
|
|
595
|
+
*
|
|
596
|
+
* OUT Probing for vulnerabilities. No injection payloads, no auth-bypass
|
|
597
|
+
* attempts, no querying somebody's database with a key we found. Those
|
|
598
|
+
* are unauthorized security testing against a host the operator has not
|
|
599
|
+
* proven they own, and this product does not do that.
|
|
600
|
+
*
|
|
601
|
+
* The distinction matters commercially too: "your source maps are public" is a
|
|
602
|
+
* finding we can hand to a stranger safely, because acting on it requires
|
|
603
|
+
* access they already have. "Your database is unprotected, here is the key" is
|
|
604
|
+
* an attack map.
|
|
605
|
+
*/
|
|
606
|
+
/**
|
|
607
|
+
* Is a dotted-quad or IPv6 literal outside the publicly routable ranges?
|
|
608
|
+
*
|
|
609
|
+
* Exported because the caller MUST re-check this against the address DNS
|
|
610
|
+
* actually resolved to, not merely against the hostname the user typed.
|
|
611
|
+
* Checking only the hostname is defeated by pointing `evil.example.com` at
|
|
612
|
+
* 169.254.169.254 — the DNS-rebinding shape — and by any of the dozens of
|
|
613
|
+
* decimal / octal / IPv4-mapped-IPv6 spellings of a private address.
|
|
614
|
+
*/
|
|
615
|
+
declare function isPrivateAddress(address: string): boolean;
|
|
616
|
+
interface TargetRejection {
|
|
617
|
+
ok: false;
|
|
618
|
+
reason: string;
|
|
619
|
+
}
|
|
620
|
+
interface TargetAccepted {
|
|
621
|
+
ok: true;
|
|
622
|
+
url: string;
|
|
623
|
+
hostname: string;
|
|
624
|
+
}
|
|
625
|
+
type TargetCheck = TargetAccepted | TargetRejection;
|
|
626
|
+
/**
|
|
627
|
+
* Normalise and vet a user-supplied scan target.
|
|
628
|
+
*
|
|
629
|
+
* Accepts bare domains ("example.com") because that is what people paste, and
|
|
630
|
+
* upgrades them to https. Rejects anything that is not a public http(s)
|
|
631
|
+
* endpoint. This is a necessary gate, never a sufficient one — see
|
|
632
|
+
* isPrivateAddress on why the resolved IP must be checked separately.
|
|
633
|
+
*/
|
|
634
|
+
declare function parseScanTarget(input: string): TargetCheck;
|
|
635
|
+
interface BuilderFingerprint {
|
|
636
|
+
id: string;
|
|
637
|
+
name: string;
|
|
638
|
+
/** What we actually saw. Shown to the user — never assert without evidence. */
|
|
639
|
+
evidence: string;
|
|
640
|
+
}
|
|
641
|
+
declare function detectBuilder(haystack: string): BuilderFingerprint | null;
|
|
642
|
+
/**
|
|
643
|
+
* Extract `//# sourceMappingURL=` references from a bundle.
|
|
644
|
+
*
|
|
645
|
+
* This is the highest-value thing a URL scan can find. A production build that
|
|
646
|
+
* ships its source maps is publishing its original TypeScript — comments,
|
|
647
|
+
* internal names, dead code, and often the server-side helpers that were
|
|
648
|
+
* tree-shaken from the runtime but not from the map. It is a real finding on
|
|
649
|
+
* its own, and it is also the bridge to the actual product: given the maps we
|
|
650
|
+
* can reconstruct sources and run the full rule set against real code, with no
|
|
651
|
+
* repository access at all.
|
|
652
|
+
*
|
|
653
|
+
* Data-URI maps are ignored: inline maps are a bundler default in development
|
|
654
|
+
* and expose nothing that the served bundle did not already contain.
|
|
655
|
+
*/
|
|
656
|
+
declare function findSourceMapRefs(js: string, bundleUrl: string): string[];
|
|
657
|
+
interface ExposedConfig {
|
|
658
|
+
kind: "supabase" | "firebase";
|
|
659
|
+
/** Non-secret identifier, safe to echo back (project ref, project id). */
|
|
660
|
+
projectRef: string | null;
|
|
661
|
+
detail: string;
|
|
662
|
+
}
|
|
663
|
+
/**
|
|
664
|
+
* Backend configuration that a client bundle necessarily contains.
|
|
665
|
+
*
|
|
666
|
+
* IMPORTANT: finding these is NOT a vulnerability report. A Supabase anon key
|
|
667
|
+
* is designed to ship to the browser; every Supabase app has one. What matters
|
|
668
|
+
* is that it means the app's entire data-access security rests on row-level
|
|
669
|
+
* security being configured correctly — which cannot be determined from
|
|
670
|
+
* outside without querying their database, and we will not do that.
|
|
671
|
+
*
|
|
672
|
+
* So this is reported as an architectural fact plus a question the owner
|
|
673
|
+
* should answer, never as "you are exposed". Overstating it would be both
|
|
674
|
+
* wrong and the kind of scare-marketing this product exists to be the opposite
|
|
675
|
+
* of.
|
|
676
|
+
*
|
|
677
|
+
* A `service_role` key is a different matter entirely — that one is never
|
|
678
|
+
* supposed to reach a browser — and is flagged by the existing VC004 rule when
|
|
679
|
+
* the reconstructed source is scanned.
|
|
680
|
+
*/
|
|
681
|
+
declare function detectExposedConfig(js: string): ExposedConfig[];
|
|
682
|
+
interface HeaderFinding {
|
|
683
|
+
header: string;
|
|
684
|
+
severity: "medium" | "low" | "info";
|
|
685
|
+
message: string;
|
|
686
|
+
}
|
|
687
|
+
/**
|
|
688
|
+
* Header hygiene. Deliberately the LAST thing reported, and never the headline.
|
|
689
|
+
*
|
|
690
|
+
* securityheaders.com and Mozilla Observatory do this for free and have done
|
|
691
|
+
* for a decade. Leading with it would tell a visitor we are a commodity tool
|
|
692
|
+
* competing with something free, when the differentiator is everything above.
|
|
693
|
+
* It is included because its absence is conspicuous, not because it sells.
|
|
694
|
+
*/
|
|
695
|
+
declare function assessHeaders(headers: Record<string, string>): HeaderFinding[];
|
|
696
|
+
/** Script `src` URLs in an HTML document, resolved against the page URL. */
|
|
697
|
+
declare function extractScriptUrls(html: string, pageUrl: string, limit?: number): string[];
|
|
698
|
+
|
|
581
699
|
/**
|
|
582
700
|
* Centralized Babel parser with per-file caching.
|
|
583
701
|
*
|
|
@@ -689,4 +807,4 @@ declare function getObjectProperty(node: ObjectExpression, key: string): {
|
|
|
689
807
|
/** Does this CallExpression spread an expression `matcher` returns true for? */
|
|
690
808
|
declare function callSpreads(call: CallExpression, matcher: (node: Node) => boolean): boolean;
|
|
691
809
|
|
|
692
|
-
export { type AIFilterResult, type Confidence, type CustomRule, type DetectedFramework, type Exposure, type FilteredFinding, type Finding, type GradeOptions, type GradeResult, NON_APP_PATH_PATTERNS, 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, 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, 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 };
|
|
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 };
|
package/dist/index.js
CHANGED
|
@@ -9032,12 +9032,186 @@ function scanEntropy(files) {
|
|
|
9032
9032
|
}
|
|
9033
9033
|
return findings;
|
|
9034
9034
|
}
|
|
9035
|
+
|
|
9036
|
+
// src/url-recon.ts
|
|
9037
|
+
var BLOCKED_HOSTNAMES = /* @__PURE__ */ new Set([
|
|
9038
|
+
"localhost",
|
|
9039
|
+
"127.0.0.1",
|
|
9040
|
+
"0.0.0.0",
|
|
9041
|
+
"::1",
|
|
9042
|
+
"[::1]",
|
|
9043
|
+
"metadata.google.internal",
|
|
9044
|
+
"metadata.goog",
|
|
9045
|
+
"instance-data"
|
|
9046
|
+
]);
|
|
9047
|
+
var BLOCKED_SUFFIXES = [".local", ".localhost", ".internal", ".home.arpa", ".cluster.local"];
|
|
9048
|
+
function isPrivateAddress(address) {
|
|
9049
|
+
const addr = address.trim().toLowerCase().replace(/^\[|\]$/g, "");
|
|
9050
|
+
const mapped = addr.match(/^::ffff:(\d+\.\d+\.\d+\.\d+)$/);
|
|
9051
|
+
if (mapped) return isPrivateAddress(mapped[1]);
|
|
9052
|
+
const v4 = addr.match(/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/);
|
|
9053
|
+
if (v4) {
|
|
9054
|
+
const [a, b] = [Number(v4[1]), Number(v4[2])];
|
|
9055
|
+
if ([a, Number(v4[2]), Number(v4[3]), Number(v4[4])].some((o) => o > 255)) return true;
|
|
9056
|
+
if (a === 0) return true;
|
|
9057
|
+
if (a === 10) return true;
|
|
9058
|
+
if (a === 127) return true;
|
|
9059
|
+
if (a === 169 && b === 254) return true;
|
|
9060
|
+
if (a === 172 && b >= 16 && b <= 31) return true;
|
|
9061
|
+
if (a === 192 && b === 168) return true;
|
|
9062
|
+
if (a === 100 && b >= 64 && b <= 127) return true;
|
|
9063
|
+
if (a === 192 && b === 0) return true;
|
|
9064
|
+
if (a === 198 && (b === 18 || b === 19)) return true;
|
|
9065
|
+
if (a >= 224) return true;
|
|
9066
|
+
return false;
|
|
9067
|
+
}
|
|
9068
|
+
if (addr === "::" || addr === "::1") return true;
|
|
9069
|
+
if (/^f[cd][0-9a-f]{2}:/.test(addr)) return true;
|
|
9070
|
+
if (/^fe[89ab][0-9a-f]:/.test(addr)) return true;
|
|
9071
|
+
return false;
|
|
9072
|
+
}
|
|
9073
|
+
function parseScanTarget(input) {
|
|
9074
|
+
const raw = (input || "").trim();
|
|
9075
|
+
if (!raw) return { ok: false, reason: "Enter a URL to scan." };
|
|
9076
|
+
if (raw.length > 2048) return { ok: false, reason: "That URL is too long." };
|
|
9077
|
+
const withScheme = /^[a-z][a-z0-9+.-]*:\/\//i.test(raw) ? raw : `https://${raw}`;
|
|
9078
|
+
let url;
|
|
9079
|
+
try {
|
|
9080
|
+
url = new URL(withScheme);
|
|
9081
|
+
} catch {
|
|
9082
|
+
return { ok: false, reason: "That doesn't look like a valid URL." };
|
|
9083
|
+
}
|
|
9084
|
+
if (url.protocol !== "http:" && url.protocol !== "https:") {
|
|
9085
|
+
return { ok: false, reason: "Only http and https URLs can be scanned." };
|
|
9086
|
+
}
|
|
9087
|
+
if (url.username || url.password) {
|
|
9088
|
+
return { ok: false, reason: "Remove the username and password from the URL." };
|
|
9089
|
+
}
|
|
9090
|
+
if (url.port && url.port !== "80" && url.port !== "443") {
|
|
9091
|
+
return { ok: false, reason: "Only the standard web ports (80 and 443) can be scanned." };
|
|
9092
|
+
}
|
|
9093
|
+
const host = url.hostname.toLowerCase();
|
|
9094
|
+
if (BLOCKED_HOSTNAMES.has(host)) {
|
|
9095
|
+
return { ok: false, reason: "That address is not publicly reachable." };
|
|
9096
|
+
}
|
|
9097
|
+
if (BLOCKED_SUFFIXES.some((s) => host.endsWith(s))) {
|
|
9098
|
+
return { ok: false, reason: "That address is not publicly reachable." };
|
|
9099
|
+
}
|
|
9100
|
+
if (isPrivateAddress(host)) {
|
|
9101
|
+
return { ok: false, reason: "That address is not publicly reachable." };
|
|
9102
|
+
}
|
|
9103
|
+
if (!host.includes(".")) {
|
|
9104
|
+
return { ok: false, reason: "Enter a full domain name." };
|
|
9105
|
+
}
|
|
9106
|
+
return { ok: true, url: url.toString(), hostname: host };
|
|
9107
|
+
}
|
|
9108
|
+
var BUILDER_SIGNATURES = [
|
|
9109
|
+
{
|
|
9110
|
+
id: "lovable",
|
|
9111
|
+
name: "Lovable",
|
|
9112
|
+
patterns: [/lovable-tagger/i, /lovable\.dev/i, /data-lov-id=/i, /gpteng\.co/i]
|
|
9113
|
+
},
|
|
9114
|
+
{ id: "v0", name: "v0", patterns: [/v0-user-next/i, /v0\.dev/i, /_next\/static.*v0-/i] },
|
|
9115
|
+
{ id: "bolt", name: "Bolt", patterns: [/bolt-vite-react/i, /stackblitz/i, /bolt\.new/i] },
|
|
9116
|
+
{ id: "base44", name: "Base44", patterns: [/@base44\/sdk/i, /base44\.app/i, /base44\.com/i] }
|
|
9117
|
+
];
|
|
9118
|
+
function detectBuilder(haystack) {
|
|
9119
|
+
for (const sig of BUILDER_SIGNATURES) {
|
|
9120
|
+
for (const p of sig.patterns) {
|
|
9121
|
+
const m = haystack.match(p);
|
|
9122
|
+
if (m) return { id: sig.id, name: sig.name, evidence: m[0].slice(0, 120) };
|
|
9123
|
+
}
|
|
9124
|
+
}
|
|
9125
|
+
return null;
|
|
9126
|
+
}
|
|
9127
|
+
function findSourceMapRefs(js, bundleUrl) {
|
|
9128
|
+
const out = [];
|
|
9129
|
+
const re = /[#@]\s*sourceMappingURL\s*=\s*([^\s*'"]+)/g;
|
|
9130
|
+
let m;
|
|
9131
|
+
while ((m = re.exec(js)) !== null) {
|
|
9132
|
+
const ref = m[1].trim();
|
|
9133
|
+
if (!ref || ref.startsWith("data:")) continue;
|
|
9134
|
+
try {
|
|
9135
|
+
out.push(new URL(ref, bundleUrl).toString());
|
|
9136
|
+
} catch {
|
|
9137
|
+
}
|
|
9138
|
+
}
|
|
9139
|
+
return [...new Set(out)];
|
|
9140
|
+
}
|
|
9141
|
+
function detectExposedConfig(js) {
|
|
9142
|
+
const out = [];
|
|
9143
|
+
const supabase = js.match(/https:\/\/([a-z0-9]{16,32})\.supabase\.co/i);
|
|
9144
|
+
if (supabase) {
|
|
9145
|
+
out.push({
|
|
9146
|
+
kind: "supabase",
|
|
9147
|
+
projectRef: supabase[1],
|
|
9148
|
+
detail: "A Supabase project URL is present in the client bundle. This is normal and expected \u2014 but it means row-level security is the only thing standing between a visitor and your data."
|
|
9149
|
+
});
|
|
9150
|
+
}
|
|
9151
|
+
const firebase = js.match(/["']?projectId["']?\s*:\s*["']([a-z0-9-]{4,60})["']/i);
|
|
9152
|
+
if (firebase && /firebase/i.test(js)) {
|
|
9153
|
+
out.push({
|
|
9154
|
+
kind: "firebase",
|
|
9155
|
+
projectRef: firebase[1],
|
|
9156
|
+
detail: "A Firebase project configuration is present in the client bundle. This is normal and expected \u2014 but it means your Firestore/Storage rules are the only access control."
|
|
9157
|
+
});
|
|
9158
|
+
}
|
|
9159
|
+
return out;
|
|
9160
|
+
}
|
|
9161
|
+
function assessHeaders(headers) {
|
|
9162
|
+
const h = {};
|
|
9163
|
+
for (const [k, v] of Object.entries(headers)) h[k.toLowerCase()] = v;
|
|
9164
|
+
const out = [];
|
|
9165
|
+
if (!h["content-security-policy"]) {
|
|
9166
|
+
out.push({
|
|
9167
|
+
header: "Content-Security-Policy",
|
|
9168
|
+
severity: "medium",
|
|
9169
|
+
message: "No CSP. A single injected script has nothing stopping it from loading or exfiltrating."
|
|
9170
|
+
});
|
|
9171
|
+
}
|
|
9172
|
+
if (!h["strict-transport-security"]) {
|
|
9173
|
+
out.push({
|
|
9174
|
+
header: "Strict-Transport-Security",
|
|
9175
|
+
severity: "medium",
|
|
9176
|
+
message: "No HSTS. A first visit over http can be intercepted before the redirect to https."
|
|
9177
|
+
});
|
|
9178
|
+
}
|
|
9179
|
+
if (!h["x-content-type-options"]) {
|
|
9180
|
+
out.push({
|
|
9181
|
+
header: "X-Content-Type-Options",
|
|
9182
|
+
severity: "low",
|
|
9183
|
+
message: "Missing nosniff. Browsers may re-interpret a response as a type you did not intend."
|
|
9184
|
+
});
|
|
9185
|
+
}
|
|
9186
|
+
if (!h["referrer-policy"]) {
|
|
9187
|
+
out.push({
|
|
9188
|
+
header: "Referrer-Policy",
|
|
9189
|
+
severity: "low",
|
|
9190
|
+
message: "No referrer policy. Full URLs \u2014 including any ids in the path \u2014 leak to third parties."
|
|
9191
|
+
});
|
|
9192
|
+
}
|
|
9193
|
+
return out;
|
|
9194
|
+
}
|
|
9195
|
+
function extractScriptUrls(html, pageUrl, limit = 12) {
|
|
9196
|
+
const out = [];
|
|
9197
|
+
const re = /<script\b[^>]*\bsrc\s*=\s*["']([^"']+)["']/gi;
|
|
9198
|
+
let m;
|
|
9199
|
+
while ((m = re.exec(html)) !== null && out.length < limit) {
|
|
9200
|
+
try {
|
|
9201
|
+
const u = new URL(m[1], pageUrl);
|
|
9202
|
+
if (u.protocol === "http:" || u.protocol === "https:") out.push(u.toString());
|
|
9203
|
+
} catch {
|
|
9204
|
+
}
|
|
9205
|
+
}
|
|
9206
|
+
return [...new Set(out)];
|
|
9207
|
+
}
|
|
9035
9208
|
export {
|
|
9036
9209
|
NON_APP_PATH_PATTERNS,
|
|
9037
9210
|
RULE_IMPACTS,
|
|
9038
9211
|
allCustomRules,
|
|
9039
9212
|
allRules,
|
|
9040
9213
|
androidDebuggable,
|
|
9214
|
+
assessHeaders,
|
|
9041
9215
|
blockingMainThread,
|
|
9042
9216
|
buildTaintMap,
|
|
9043
9217
|
calculateGrade,
|
|
@@ -9055,6 +9229,8 @@ export {
|
|
|
9055
9229
|
corsWildcard,
|
|
9056
9230
|
dangerousInnerHTML,
|
|
9057
9231
|
deprecatedTLS,
|
|
9232
|
+
detectBuilder,
|
|
9233
|
+
detectExposedConfig,
|
|
9058
9234
|
detectFramework,
|
|
9059
9235
|
detectPlatform,
|
|
9060
9236
|
disabledTLSVerification,
|
|
@@ -9083,7 +9259,9 @@ export {
|
|
|
9083
9259
|
exposedServerActions,
|
|
9084
9260
|
exposedSourceMaps,
|
|
9085
9261
|
exposedStackTraces,
|
|
9262
|
+
extractScriptUrls,
|
|
9086
9263
|
filterFalsePositives,
|
|
9264
|
+
findSourceMapRefs,
|
|
9087
9265
|
firebaseClientConfig,
|
|
9088
9266
|
flaskSecretKey,
|
|
9089
9267
|
freeRules,
|
|
@@ -9160,6 +9338,7 @@ export {
|
|
|
9160
9338
|
ipcPathTraversal,
|
|
9161
9339
|
isCalleeNamed,
|
|
9162
9340
|
isMethodCall,
|
|
9341
|
+
isPrivateAddress,
|
|
9163
9342
|
isVendoredFinding,
|
|
9164
9343
|
isVendoredPath,
|
|
9165
9344
|
javaDeserialization,
|
|
@@ -9207,6 +9386,7 @@ export {
|
|
|
9207
9386
|
openRedirectParams,
|
|
9208
9387
|
overlyPermissiveIAM,
|
|
9209
9388
|
parseFile,
|
|
9389
|
+
parseScanTarget,
|
|
9210
9390
|
pathTraversal,
|
|
9211
9391
|
pickleDeserialization,
|
|
9212
9392
|
piiInLogs,
|