xploitscan-shared-rules 2.4.10 → 2.4.11
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 +185 -29
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +8 -2
- package/dist/index.d.ts +8 -2
- package/dist/index.js +184 -29
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -160,7 +160,7 @@ interface CustomRule {
|
|
|
160
160
|
* before a scan can be saved without enough provenance to explain a changed
|
|
161
161
|
* grade.
|
|
162
162
|
*/
|
|
163
|
-
declare const SCANNER_VERSION = "2.4.
|
|
163
|
+
declare const SCANNER_VERSION = "2.4.11";
|
|
164
164
|
|
|
165
165
|
/**
|
|
166
166
|
* Line-oriented helpers shared by every rule. Pure string manipulation — no fs
|
|
@@ -1134,6 +1134,12 @@ declare const exposedEnvFile: CustomRule;
|
|
|
1134
1134
|
* objects are left as they are, which can only suppress a finding.
|
|
1135
1135
|
*/
|
|
1136
1136
|
declare function maskOutboundAuthNoise(code: string): string;
|
|
1137
|
+
/**
|
|
1138
|
+
* Writes that make a `"use server"` export a real mutation. Shared with
|
|
1139
|
+
* VC064, which walks each pattern once per file. No `g` flag: `.test()`
|
|
1140
|
+
* must not advance `lastIndex`.
|
|
1141
|
+
*/
|
|
1142
|
+
declare const SERVER_ACTION_WRITE_RE: RegExp[];
|
|
1137
1143
|
declare const missingAuthMiddleware: CustomRule;
|
|
1138
1144
|
declare const supabaseNoRLS: CustomRule;
|
|
1139
1145
|
declare const stripeWebhookUnprotected: CustomRule;
|
|
@@ -1684,4 +1690,4 @@ input: {
|
|
|
1684
1690
|
content: string;
|
|
1685
1691
|
}[] | QualityContext, rules?: QualityRule[]): Finding[];
|
|
1686
1692
|
|
|
1687
|
-
export { type AIFilterResult, type AppRoute, type BuilderFingerprint, CHECKABLE_CLAIMS, type Confidence, type CustomRule, DOTENV_ASSIGN_RE, type DetectedFramework, type ExposedConfig, type Exposure, FREE_RULE_COUNT, type FilteredFinding, type Finding, GRADE_FINDINGS_PER_RULE, 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, PUBLIC_ENV_PREFIX_RE, type ParsedFile, type ProjectContext, QUALITY_EXAMPLES, type QualityContext, type QualityExample, type QualityFile, type QualityHit, type QualityRule, RULE_IMPACTS, type RouteFramework, type RouteTable, type RuleMatch, SCANNER_VERSION, type SecurityGrade, type Severity, TEST_FILE_PATTERN, TOTAL_RULE_COUNT, type TaintMap, type TargetCheck, type VibePlatform, allRules, assessHeaders, astMatch, buildProjectContext, buildQualityContext, buildReviewPrompt, buildTaintMap, calculateGrade, callSpreads, checkIntent, classifyExposure, classifyPublicEnvVar, classifyStatement, clientSideAuth, complianceMap, consoleLogProduction, corsWildcard, dangerousInnerHTML, deduplicateFindings, detectBuilder, detectExposedConfig, detectFramework, detectPlatform, disabledTLSVerification, dotenvValue, emptyCatchBlock, enclosingHandler, envNotGitignored, evalUsage, exposedAuthSecret, exposedDebugMode, exposedEnvFile, exposedStackTraces, extractRoutes, extractScriptUrls, filterFalsePositives, filterSilenced, findMatches, findMatchesAt, findSourceMapRefs, freeRules, getObjectProperty, getSnippet, gradeRuleFamily, hardcodedJWTSecret, hardcodedSecrets, harvestIntent, insecureCookies, insecureRandomness, isCalleeNamed, isClientTarget, isCommentLine, isDotenvPath, isInlineSilenced, isInsideFixMessage, isLineSilenced, isLive, isMethodCall, isPrivateAddress, isProtectedFromAiRemoval, isSbomPath, isServerSideFile, isServerTarget, isTestFile, isTestPath, isUngradedFinding, isVendoredFinding, isVendoredPath, lineNumberAt, lineTextAt, maskComments, maskOutboundAuthNoise, missingAuthMiddleware, missingCSP, missingErrorBoundary, missingHTTPS, missingLockFile, newDataFence, nextPublicSecret, noRateLimiting, normalizeScanPath, packReviewBatches, parseFile, parseScanTarget, parseSupabaseConfig, qualityRules, replaceBlockComments, routeForFile, runCustomRules, scanConfigs, scanDependencies, scanEntropy, scanMultiFile, scanQuality, sqlInjection, stripeWebhookUnprotected, supabaseFunctionName, supabaseNoRLS, todoLeftInCode, tryParse, unmeasuredQualityRules, unvalidatedRedirect, vendoredReason, visitBinary, visitCalls, weakHashing, xssVulnerability };
|
|
1693
|
+
export { type AIFilterResult, type AppRoute, type BuilderFingerprint, CHECKABLE_CLAIMS, type Confidence, type CustomRule, DOTENV_ASSIGN_RE, type DetectedFramework, type ExposedConfig, type Exposure, FREE_RULE_COUNT, type FilteredFinding, type Finding, GRADE_FINDINGS_PER_RULE, 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, PUBLIC_ENV_PREFIX_RE, type ParsedFile, type ProjectContext, QUALITY_EXAMPLES, type QualityContext, type QualityExample, type QualityFile, type QualityHit, type QualityRule, RULE_IMPACTS, type RouteFramework, type RouteTable, type RuleMatch, SCANNER_VERSION, SERVER_ACTION_WRITE_RE, type SecurityGrade, type Severity, TEST_FILE_PATTERN, TOTAL_RULE_COUNT, type TaintMap, type TargetCheck, type VibePlatform, allRules, assessHeaders, astMatch, buildProjectContext, buildQualityContext, buildReviewPrompt, buildTaintMap, calculateGrade, callSpreads, checkIntent, classifyExposure, classifyPublicEnvVar, classifyStatement, clientSideAuth, complianceMap, consoleLogProduction, corsWildcard, dangerousInnerHTML, deduplicateFindings, detectBuilder, detectExposedConfig, detectFramework, detectPlatform, disabledTLSVerification, dotenvValue, emptyCatchBlock, enclosingHandler, envNotGitignored, evalUsage, exposedAuthSecret, exposedDebugMode, exposedEnvFile, exposedStackTraces, extractRoutes, extractScriptUrls, filterFalsePositives, filterSilenced, findMatches, findMatchesAt, findSourceMapRefs, freeRules, getObjectProperty, getSnippet, gradeRuleFamily, hardcodedJWTSecret, hardcodedSecrets, harvestIntent, insecureCookies, insecureRandomness, isCalleeNamed, isClientTarget, isCommentLine, isDotenvPath, isInlineSilenced, isInsideFixMessage, isLineSilenced, isLive, isMethodCall, isPrivateAddress, isProtectedFromAiRemoval, isSbomPath, isServerSideFile, isServerTarget, isTestFile, isTestPath, isUngradedFinding, isVendoredFinding, isVendoredPath, lineNumberAt, lineTextAt, maskComments, maskOutboundAuthNoise, missingAuthMiddleware, missingCSP, missingErrorBoundary, missingHTTPS, missingLockFile, newDataFence, nextPublicSecret, noRateLimiting, normalizeScanPath, packReviewBatches, parseFile, parseScanTarget, parseSupabaseConfig, qualityRules, replaceBlockComments, routeForFile, runCustomRules, scanConfigs, scanDependencies, scanEntropy, scanMultiFile, scanQuality, sqlInjection, stripeWebhookUnprotected, supabaseFunctionName, supabaseNoRLS, todoLeftInCode, tryParse, unmeasuredQualityRules, unvalidatedRedirect, vendoredReason, visitBinary, visitCalls, weakHashing, xssVulnerability };
|
package/dist/index.d.ts
CHANGED
|
@@ -160,7 +160,7 @@ interface CustomRule {
|
|
|
160
160
|
* before a scan can be saved without enough provenance to explain a changed
|
|
161
161
|
* grade.
|
|
162
162
|
*/
|
|
163
|
-
declare const SCANNER_VERSION = "2.4.
|
|
163
|
+
declare const SCANNER_VERSION = "2.4.11";
|
|
164
164
|
|
|
165
165
|
/**
|
|
166
166
|
* Line-oriented helpers shared by every rule. Pure string manipulation — no fs
|
|
@@ -1134,6 +1134,12 @@ declare const exposedEnvFile: CustomRule;
|
|
|
1134
1134
|
* objects are left as they are, which can only suppress a finding.
|
|
1135
1135
|
*/
|
|
1136
1136
|
declare function maskOutboundAuthNoise(code: string): string;
|
|
1137
|
+
/**
|
|
1138
|
+
* Writes that make a `"use server"` export a real mutation. Shared with
|
|
1139
|
+
* VC064, which walks each pattern once per file. No `g` flag: `.test()`
|
|
1140
|
+
* must not advance `lastIndex`.
|
|
1141
|
+
*/
|
|
1142
|
+
declare const SERVER_ACTION_WRITE_RE: RegExp[];
|
|
1137
1143
|
declare const missingAuthMiddleware: CustomRule;
|
|
1138
1144
|
declare const supabaseNoRLS: CustomRule;
|
|
1139
1145
|
declare const stripeWebhookUnprotected: CustomRule;
|
|
@@ -1684,4 +1690,4 @@ input: {
|
|
|
1684
1690
|
content: string;
|
|
1685
1691
|
}[] | QualityContext, rules?: QualityRule[]): Finding[];
|
|
1686
1692
|
|
|
1687
|
-
export { type AIFilterResult, type AppRoute, type BuilderFingerprint, CHECKABLE_CLAIMS, type Confidence, type CustomRule, DOTENV_ASSIGN_RE, type DetectedFramework, type ExposedConfig, type Exposure, FREE_RULE_COUNT, type FilteredFinding, type Finding, GRADE_FINDINGS_PER_RULE, 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, PUBLIC_ENV_PREFIX_RE, type ParsedFile, type ProjectContext, QUALITY_EXAMPLES, type QualityContext, type QualityExample, type QualityFile, type QualityHit, type QualityRule, RULE_IMPACTS, type RouteFramework, type RouteTable, type RuleMatch, SCANNER_VERSION, type SecurityGrade, type Severity, TEST_FILE_PATTERN, TOTAL_RULE_COUNT, type TaintMap, type TargetCheck, type VibePlatform, allRules, assessHeaders, astMatch, buildProjectContext, buildQualityContext, buildReviewPrompt, buildTaintMap, calculateGrade, callSpreads, checkIntent, classifyExposure, classifyPublicEnvVar, classifyStatement, clientSideAuth, complianceMap, consoleLogProduction, corsWildcard, dangerousInnerHTML, deduplicateFindings, detectBuilder, detectExposedConfig, detectFramework, detectPlatform, disabledTLSVerification, dotenvValue, emptyCatchBlock, enclosingHandler, envNotGitignored, evalUsage, exposedAuthSecret, exposedDebugMode, exposedEnvFile, exposedStackTraces, extractRoutes, extractScriptUrls, filterFalsePositives, filterSilenced, findMatches, findMatchesAt, findSourceMapRefs, freeRules, getObjectProperty, getSnippet, gradeRuleFamily, hardcodedJWTSecret, hardcodedSecrets, harvestIntent, insecureCookies, insecureRandomness, isCalleeNamed, isClientTarget, isCommentLine, isDotenvPath, isInlineSilenced, isInsideFixMessage, isLineSilenced, isLive, isMethodCall, isPrivateAddress, isProtectedFromAiRemoval, isSbomPath, isServerSideFile, isServerTarget, isTestFile, isTestPath, isUngradedFinding, isVendoredFinding, isVendoredPath, lineNumberAt, lineTextAt, maskComments, maskOutboundAuthNoise, missingAuthMiddleware, missingCSP, missingErrorBoundary, missingHTTPS, missingLockFile, newDataFence, nextPublicSecret, noRateLimiting, normalizeScanPath, packReviewBatches, parseFile, parseScanTarget, parseSupabaseConfig, qualityRules, replaceBlockComments, routeForFile, runCustomRules, scanConfigs, scanDependencies, scanEntropy, scanMultiFile, scanQuality, sqlInjection, stripeWebhookUnprotected, supabaseFunctionName, supabaseNoRLS, todoLeftInCode, tryParse, unmeasuredQualityRules, unvalidatedRedirect, vendoredReason, visitBinary, visitCalls, weakHashing, xssVulnerability };
|
|
1693
|
+
export { type AIFilterResult, type AppRoute, type BuilderFingerprint, CHECKABLE_CLAIMS, type Confidence, type CustomRule, DOTENV_ASSIGN_RE, type DetectedFramework, type ExposedConfig, type Exposure, FREE_RULE_COUNT, type FilteredFinding, type Finding, GRADE_FINDINGS_PER_RULE, 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, PUBLIC_ENV_PREFIX_RE, type ParsedFile, type ProjectContext, QUALITY_EXAMPLES, type QualityContext, type QualityExample, type QualityFile, type QualityHit, type QualityRule, RULE_IMPACTS, type RouteFramework, type RouteTable, type RuleMatch, SCANNER_VERSION, SERVER_ACTION_WRITE_RE, type SecurityGrade, type Severity, TEST_FILE_PATTERN, TOTAL_RULE_COUNT, type TaintMap, type TargetCheck, type VibePlatform, allRules, assessHeaders, astMatch, buildProjectContext, buildQualityContext, buildReviewPrompt, buildTaintMap, calculateGrade, callSpreads, checkIntent, classifyExposure, classifyPublicEnvVar, classifyStatement, clientSideAuth, complianceMap, consoleLogProduction, corsWildcard, dangerousInnerHTML, deduplicateFindings, detectBuilder, detectExposedConfig, detectFramework, detectPlatform, disabledTLSVerification, dotenvValue, emptyCatchBlock, enclosingHandler, envNotGitignored, evalUsage, exposedAuthSecret, exposedDebugMode, exposedEnvFile, exposedStackTraces, extractRoutes, extractScriptUrls, filterFalsePositives, filterSilenced, findMatches, findMatchesAt, findSourceMapRefs, freeRules, getObjectProperty, getSnippet, gradeRuleFamily, hardcodedJWTSecret, hardcodedSecrets, harvestIntent, insecureCookies, insecureRandomness, isCalleeNamed, isClientTarget, isCommentLine, isDotenvPath, isInlineSilenced, isInsideFixMessage, isLineSilenced, isLive, isMethodCall, isPrivateAddress, isProtectedFromAiRemoval, isSbomPath, isServerSideFile, isServerTarget, isTestFile, isTestPath, isUngradedFinding, isVendoredFinding, isVendoredPath, lineNumberAt, lineTextAt, maskComments, maskOutboundAuthNoise, missingAuthMiddleware, missingCSP, missingErrorBoundary, missingHTTPS, missingLockFile, newDataFence, nextPublicSecret, noRateLimiting, normalizeScanPath, packReviewBatches, parseFile, parseScanTarget, parseSupabaseConfig, qualityRules, replaceBlockComments, routeForFile, runCustomRules, scanConfigs, scanDependencies, scanEntropy, scanMultiFile, scanQuality, sqlInjection, stripeWebhookUnprotected, supabaseFunctionName, supabaseNoRLS, todoLeftInCode, tryParse, unmeasuredQualityRules, unvalidatedRedirect, vendoredReason, visitBinary, visitCalls, weakHashing, xssVulnerability };
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/version.ts
|
|
2
|
-
var SCANNER_VERSION = "2.4.
|
|
2
|
+
var SCANNER_VERSION = "2.4.11";
|
|
3
3
|
|
|
4
4
|
// src/snippet.ts
|
|
5
5
|
var cacheContent = null;
|
|
@@ -514,7 +514,7 @@ function isTestPath(filePath) {
|
|
|
514
514
|
if (/(?:^|\/)testing(?:\/|$)/i.test(normalized)) return true;
|
|
515
515
|
return false;
|
|
516
516
|
}
|
|
517
|
-
var SBOM_FILE_RE = /(?:^|\/)(?:[^/]*\.spdx(?:\.json)?|[^/]*\.cdx\.json|[^/]*\.cdx\.xml|bom\.json|sbom[^/]*\.json|[^/]*\.sbom\.json|[^/]*cyclonedx[^/]*\.(?:json|xml))$/i;
|
|
517
|
+
var SBOM_FILE_RE = /(?:^|\/)(?:[^/]*\.spdx(?:\.json)?|[^/]*\.cdx\.json|[^/]*\.cdx\.xml|bom\.(?:json|xml)|sbom[^/]*\.json|[^/]*\.sbom\.json|[^/]*cyclonedx[^/]*\.(?:json|xml))$/i;
|
|
518
518
|
function isSbomPath(filePath) {
|
|
519
519
|
return SBOM_FILE_RE.test(normalize(filePath));
|
|
520
520
|
}
|
|
@@ -1852,13 +1852,40 @@ function dbUrlLacksRealCredential(url) {
|
|
|
1852
1852
|
const userinfo = rest.slice(0, at);
|
|
1853
1853
|
const colon = userinfo.indexOf(":");
|
|
1854
1854
|
const user = colon < 0 ? userinfo : userinfo.slice(0, colon);
|
|
1855
|
-
const
|
|
1855
|
+
const rawPass = colon < 0 ? "" : userinfo.slice(colon + 1);
|
|
1856
|
+
const pass = colon < 0 ? "" : decodeURIComponentSafe(rawPass);
|
|
1856
1857
|
if (!pass) return true;
|
|
1858
|
+
const portShaped = /^(\d{1,5})(?:\/[\w.-]{0,64})?[?#"'`][^@]*$/.exec(rawPass);
|
|
1859
|
+
if (portShaped && Number(portShaped[1]) <= 65535) return true;
|
|
1857
1860
|
if (isFormatPlaceholder(pass)) return true;
|
|
1858
1861
|
if (isPlaceholderSecret(pass)) return true;
|
|
1859
1862
|
if (/^(?:u|user|username)$/i.test(user) && /^(?:pass|password|passwd|pwd)$/i.test(pass)) return true;
|
|
1860
1863
|
return false;
|
|
1861
1864
|
}
|
|
1865
|
+
var LOOPBACK_DEV_USER_RE = /^(?:postgres|root|admin|user|test|dev|mysql|mongo|mongodb|redis|sa|guest|app|example)$/i;
|
|
1866
|
+
function isLoopbackDevDefault(url) {
|
|
1867
|
+
const rest = url.replace(/^[a-z0-9+]+:\/\//i, "");
|
|
1868
|
+
const at = rest.lastIndexOf("@");
|
|
1869
|
+
if (at < 0) return false;
|
|
1870
|
+
const userinfo = rest.slice(0, at);
|
|
1871
|
+
const colon = userinfo.indexOf(":");
|
|
1872
|
+
if (colon < 0) return false;
|
|
1873
|
+
const user = userinfo.slice(0, colon);
|
|
1874
|
+
const pass = decodeURIComponentSafe(userinfo.slice(colon + 1));
|
|
1875
|
+
if (user !== pass || !LOOPBACK_DEV_USER_RE.test(user)) return false;
|
|
1876
|
+
let host = rest.slice(at + 1);
|
|
1877
|
+
const cut = host.search(/[/?#]/);
|
|
1878
|
+
if (cut >= 0) host = host.slice(0, cut);
|
|
1879
|
+
if (host.startsWith("[")) {
|
|
1880
|
+
const end = host.indexOf("]");
|
|
1881
|
+
host = end >= 0 ? host.slice(1, end) : host;
|
|
1882
|
+
} else {
|
|
1883
|
+
const port = host.lastIndexOf(":");
|
|
1884
|
+
if (port >= 0) host = host.slice(0, port);
|
|
1885
|
+
}
|
|
1886
|
+
const h = host.toLowerCase();
|
|
1887
|
+
return h === "localhost" || h === "::1" || h === "0.0.0.0" || h === "host.docker.internal" || /^127(?:\.\d{1,3}){0,3}$/.test(h);
|
|
1888
|
+
}
|
|
1862
1889
|
function decodeURIComponentSafe(value) {
|
|
1863
1890
|
try {
|
|
1864
1891
|
return decodeURIComponent(value);
|
|
@@ -1867,10 +1894,12 @@ function decodeURIComponentSafe(value) {
|
|
|
1867
1894
|
}
|
|
1868
1895
|
}
|
|
1869
1896
|
var FORMAT_PLACEHOLDER_MAX = 256;
|
|
1897
|
+
var FORMAT_FIELD_RE = /^\{(?:[a-z_][a-z0-9_]{0,63}|[A-Z_][A-Z0-9_]{0,63})(?:\.(?:[a-z_][a-z0-9_]{0,63}|[A-Z_][A-Z0-9_]{0,63})){0,4}(?:\[[\w'"]{1,64}\])?(?:![rsa])?(?::[<>=^]?\d{0,3}[sd]?)?\}$/;
|
|
1870
1898
|
function isFormatPlaceholder(value) {
|
|
1871
1899
|
const v = value.trim();
|
|
1872
1900
|
if (!v) return true;
|
|
1873
1901
|
if (v.length > FORMAT_PLACEHOLDER_MAX) return false;
|
|
1902
|
+
if (FORMAT_FIELD_RE.test(v)) return true;
|
|
1874
1903
|
if (/^(?:%(?:[%sdifvx]|\([^)]+\))|\{[0-9]*\}|\$\{[^}]*\}|<[^<>]*>|\*+)$/i.test(v)) return true;
|
|
1875
1904
|
if (/%(?:[%sdifvx]|\([^)]+\))|\{[0-9]*\}|\$\{[^}]*\}|<[^<>]*>/.test(v)) return true;
|
|
1876
1905
|
return false;
|
|
@@ -2055,7 +2084,12 @@ var hardcodedSecrets = {
|
|
|
2055
2084
|
if (isKeySuffix && isSlotIdentifier) continue;
|
|
2056
2085
|
}
|
|
2057
2086
|
}
|
|
2058
|
-
if (pi === 10
|
|
2087
|
+
if (pi === 10) {
|
|
2088
|
+
const url = matchedText[ri] ?? "";
|
|
2089
|
+
if (dbUrlLacksRealCredential(url)) continue;
|
|
2090
|
+
matches.push(isLoopbackDevDefault(url) ? { ...rm, severity: "low" } : textHasLiveCredential(url) ? { ...rm, live: true } : rm);
|
|
2091
|
+
continue;
|
|
2092
|
+
}
|
|
2059
2093
|
const matched = matchedText[ri] ?? "";
|
|
2060
2094
|
matches.push(textHasLiveCredential(matched) ? { ...rm, live: true } : rm);
|
|
2061
2095
|
}
|
|
@@ -2476,6 +2510,22 @@ function unauthenticatedTanStackHandlers(masked, filePath) {
|
|
|
2476
2510
|
}
|
|
2477
2511
|
return hits;
|
|
2478
2512
|
}
|
|
2513
|
+
var SERVER_ACTION_WRITE_RE = [
|
|
2514
|
+
/\b(?:kv|redis|cache|upstash)\s*\.\s*(?:set|del|hset|hdel|incr\w{0,4}|decr\w{0,4}|lpush|rpush|sadd|srem|zadd|expire|getdel)\s*\(/,
|
|
2515
|
+
/\b(?:stripe|paypal|braintree|lemonsqueezy|paddle)\s*\.\s*\w{1,40}\s*\.\s*(?:create|update|del|cancel|capture|refund)\w{0,10}\s*\(/,
|
|
2516
|
+
/\bfetch\s*\([^;]{0,400}?\bmethod\s*(?::\s*(?=["'`](?:POST|PUT|PATCH|DELETE)\b|`\$\{|[A-Za-z_$(\[])|(?=[,}]))/i,
|
|
2517
|
+
/\b(?:fs(?:\.promises)?\s*\.\s*)?(?:writeFile|appendFile|unlink|rm|rmdir|rename|copyFile)(?:Sync)?\s*\(/,
|
|
2518
|
+
/\.\s*(?:del|deleteOne|deleteMany|insertOne|insertMany|updateOne|updateMany|replaceOne|bulkWrite|upsert|increment|decrement|destroy|truncate)\s*\(/,
|
|
2519
|
+
/cookies\(\)\)?\s*\.\s*set\(\s*["'`][\w-]*(?:session|token|auth|jwt|sid|role|user|admin)/i,
|
|
2520
|
+
...TANSTACK_MUTATION_RE,
|
|
2521
|
+
/\b(?:prisma|db|tx)\s*\.\s*\w{1,64}\s*\.\s*(?:create|createMany|insert\w{0,10})\s*\(/,
|
|
2522
|
+
/\b(?:db|tx)\s*\.\s*insert\s*\(\s*\w/,
|
|
2523
|
+
/\.from\(\s*["'`][\w.-]{1,64}["'`]\s*\)\s*\.\s*insert\s*\(/,
|
|
2524
|
+
/\bINSERT\s+INTO\b/i,
|
|
2525
|
+
/\.collection\(\s*["'`][\w.-]{1,64}["'`]\s*\)\s*\.\s*(?:insert\w{0,8}|update\w{0,8}|delete\w{0,8}|replaceOne|findOneAndUpdate|findOneAndDelete)\s*\(/,
|
|
2526
|
+
/\b(?!(?:Object|Array|Promise|Reflect|Buffer|Math|JSON|Date|Intl|Symbol|Map|Set|WeakMap|Response|NextResponse|Request|URL|Error)\b)[A-Z]\w{0,40}\.(?:create|insertMany|updateOne|updateMany|deleteOne|deleteMany|findByIdAndUpdate|findByIdAndDelete|findOneAndUpdate|findOneAndDelete|destroy)\s*\(/,
|
|
2527
|
+
/\b(?:delete|remove|update|set|grant|revoke|ban|promote|demote|transfer|refund|cancel|reset|change)\w{0,20}(?:User|Account|Role|Admin|Order|Payment|Subscription|Member|Permission|Password|Email|Org|Organization|Team|Project|Invoice|Profile|Balance|Credits?|Plan|Post|Comment)s?\s*\(/
|
|
2528
|
+
];
|
|
2479
2529
|
var missingAuthMiddleware = {
|
|
2480
2530
|
id: "VC003",
|
|
2481
2531
|
title: "API Route Missing Authentication",
|
|
@@ -2501,8 +2551,9 @@ var missingAuthMiddleware = {
|
|
|
2501
2551
|
/module\.exports\s*=\s*(?:async\s+)?(?:function\b|\()/g
|
|
2502
2552
|
);
|
|
2503
2553
|
}
|
|
2554
|
+
const useServerPatterns = [];
|
|
2504
2555
|
if (USE_SERVER_DIRECTIVE_RE.test(content)) {
|
|
2505
|
-
|
|
2556
|
+
useServerPatterns.push(
|
|
2506
2557
|
/export\s+(?:async\s+)?function\s+\w+\s*\(/g,
|
|
2507
2558
|
/export\s+const\s+\w+\s*(?::[^=\n]{0,120})?=\s*(?:async\s*)?\(/g
|
|
2508
2559
|
);
|
|
@@ -2588,24 +2639,33 @@ var missingAuthMiddleware = {
|
|
|
2588
2639
|
);
|
|
2589
2640
|
const maskedForScope = maskOutboundAuthNoise(maskComments(content));
|
|
2590
2641
|
const codeForAuth = maskOutboundAuthNoise(codeOnly);
|
|
2591
|
-
const
|
|
2642
|
+
const scopeCache = /* @__PURE__ */ new Map();
|
|
2643
|
+
const scopeAt = (index) => {
|
|
2644
|
+
const cached = scopeCache.get(index);
|
|
2645
|
+
if (cached !== void 0) return cached;
|
|
2592
2646
|
const bodyStart = maskedForScope.indexOf("{", index);
|
|
2593
2647
|
const probe = bodyStart === -1 ? index : bodyStart + 1;
|
|
2594
2648
|
const scope = enclosingHandler(maskedForScope, probe);
|
|
2649
|
+
scopeCache.set(index, scope);
|
|
2650
|
+
return scope;
|
|
2651
|
+
};
|
|
2652
|
+
const handlerHasAuth = (index) => {
|
|
2653
|
+
const scope = scopeAt(index);
|
|
2595
2654
|
if (scope === null) return handlerAuthPatterns.some((p) => p.test(codeForAuth));
|
|
2596
2655
|
return handlerAuthPatterns.some((p) => p.test(scope));
|
|
2597
2656
|
};
|
|
2598
2657
|
const matches = [];
|
|
2658
|
+
const routeLines = /* @__PURE__ */ new Set();
|
|
2659
|
+
const authFix = "Add authentication middleware to protect this route. Check the user's session/token before processing the request. If the endpoint is public by design (an OG image, an embeddable badge, a health check), add an inline `// VC003-OK: <reason>` comment above the handler to silence.";
|
|
2599
2660
|
for (const pattern of serverSide ? routePatterns : []) {
|
|
2600
|
-
|
|
2601
|
-
|
|
2602
|
-
|
|
2603
|
-
|
|
2604
|
-
|
|
2605
|
-
|
|
2606
|
-
|
|
2607
|
-
|
|
2608
|
-
);
|
|
2661
|
+
const found = findMatches(content, pattern, missingAuthMiddleware, filePath, () => authFix);
|
|
2662
|
+
for (const foundMatch of found) routeLines.add(foundMatch.line);
|
|
2663
|
+
matches.push(...found);
|
|
2664
|
+
}
|
|
2665
|
+
if (serverSide) {
|
|
2666
|
+
for (const pattern of useServerPatterns) {
|
|
2667
|
+
matches.push(...findMatches(content, pattern, missingAuthMiddleware, filePath, () => authFix));
|
|
2668
|
+
}
|
|
2609
2669
|
}
|
|
2610
2670
|
if (matches.length === 0 && serverSide && SUPABASE_EDGE_FN_RE.test(filePath) && isDenoEdgeEntry(codeOnly) && !isPublicByDesignEdgePath(filePath)) {
|
|
2611
2671
|
const fnName = supabaseFunctionName(filePath);
|
|
@@ -2634,7 +2694,12 @@ var missingAuthMiddleware = {
|
|
|
2634
2694
|
const isPublicRootGet = (index) => /\.\s*get\s*\(\s*["'`]\/["'`]\s*,/i.test(content.slice(index, index + 240));
|
|
2635
2695
|
const unauthenticated = matches.filter((m) => {
|
|
2636
2696
|
const index = indexOfLine(m.line);
|
|
2637
|
-
|
|
2697
|
+
if (isPublicRootGet(index) || handlerHasAuth(index)) return false;
|
|
2698
|
+
if (useServerPatterns.length > 0 && !routeLines.has(m.line)) {
|
|
2699
|
+
const scope = scopeAt(index);
|
|
2700
|
+
if (scope !== null && !SERVER_ACTION_WRITE_RE.some((re) => re.test(scope))) return false;
|
|
2701
|
+
}
|
|
2702
|
+
return true;
|
|
2638
2703
|
});
|
|
2639
2704
|
if (serverSide || tanstackCandidate) {
|
|
2640
2705
|
for (const idx of unauthenticatedTanStackHandlers(maskedForScope, filePath)) {
|
|
@@ -3034,6 +3099,9 @@ var noRateLimiting = {
|
|
|
3034
3099
|
check(content, filePath) {
|
|
3035
3100
|
const isEntryFile = /(?:server|app|index|main)\.[jt]sx?$/.test(filePath) || filePath.includes("middleware");
|
|
3036
3101
|
if (!isEntryFile) return [];
|
|
3102
|
+
if (/(?:^|\/)(?:lib|libs|utils?|helpers?|components|hooks|shared|types)\/(?:[^/]+\/)*index\.[jt]sx?$/.test(filePath) && !/\.listen\s*\(|\bcreateServer\s*\(|\bexpress\s*\(\s*\)|\bFastify\s*\(|\bnew\s+(?:Koa|Hono)\b/.test(content)) {
|
|
3103
|
+
return [];
|
|
3104
|
+
}
|
|
3037
3105
|
const isServer = /(?:from\s+|require\s*\(\s*)["'`](?:express|hono|fastify|koa|koa-router|@koa\/[\w-]+|@hono\/[\w-]+|next(?:\/server)?|next-auth(?:\/[\w-]+)?|@clerk\/nextjs(?:\/server)?)["'`]/.test(content) || // Case-sensitive framework types — `adNext` and `nextLap` can't match.
|
|
3038
3106
|
/\b(?:NextApiRequest|NextApiResponse|NextRequest|NextResponse)\b/.test(content) || /\b(?:express|fastify|createServer)\s*\(/.test(content) || /\bnew\s+(?:Hono|Koa)\s*\(/.test(content) || /\b(?:Deno|Bun)\.serve\s*\(/.test(content) || /\.listen\s*\(/.test(content);
|
|
3039
3107
|
if (!isServer) return [];
|
|
@@ -3373,6 +3441,28 @@ var unvalidatedRedirect = {
|
|
|
3373
3441
|
var CLIENT_PREFERENCE_COOKIE_NAME_RE = /(?:consent|preferences?|prefs?)/i;
|
|
3374
3442
|
var CLIENT_PREFERENCE_COOKIE_VALUE_RE = /(?:choice|consent|preferences?|prefs?|accepted|essential(?:-only)?|declined|rejected|granted|denied|opt(?:ed)?[-_ ]?(?:in|out))/i;
|
|
3375
3443
|
var SENSITIVE_CLIENT_COOKIE_RE = /(?:auth|session|token|jwt|bearer|credential|password|passwd|secret|csrf|xsrf|refresh)/i;
|
|
3444
|
+
var UI_FLAG_COOKIE_NAME_RE = /^(?:theme|color-?scheme|sidebar|welcome-toast|toast|locale|lang|language|dir|collapsed|expanded|layout|banner|dismissed|density|contrast|font|font-?size|motion|reduced-?motion|color-mode|dark-mode|ui)$/i;
|
|
3445
|
+
var UI_FLAG_COOKIE_ASSIGN_RE = /\b(?:document\s*\.\s*)?cookie\s*=\s*(["'`])([^"'`]*)\1/gi;
|
|
3446
|
+
var UI_FLAG_SENSITIVE_NAME_RE = /(?:sess|sid(?!ebar)|login|user|uid|key|account|admin|role|remember|__host-|__secure-)/i;
|
|
3447
|
+
var UI_FLAG_COOKIE_BODY_RE = /^[A-Za-z0-9_.-]+=[A-Za-z0-9_.-]+(?:\s*;\s*(?:max-age=-?\d{1,10}|path=\/[\w./-]{0,100}|expires=[\w ,:+-]{1,40}|samesite=(?:lax|strict|none)|secure|domain=\.?[\w.-]{1,100})){0,6}\s*;?\s*$/i;
|
|
3448
|
+
function isConstantUiFlagCookieWrite(line, nextLine) {
|
|
3449
|
+
const next = nextLine.trimStart();
|
|
3450
|
+
if (next.startsWith("+") || next.startsWith(".") || next.startsWith("`")) return false;
|
|
3451
|
+
if (/\bset-cookie\b|\bsetCookie\b|res\.cookie\s*\(/i.test(line)) return false;
|
|
3452
|
+
const re = new RegExp(UI_FLAG_COOKIE_ASSIGN_RE.source, "gi");
|
|
3453
|
+
let saw = false;
|
|
3454
|
+
let assignment;
|
|
3455
|
+
while ((assignment = re.exec(line)) !== null) {
|
|
3456
|
+
saw = true;
|
|
3457
|
+
const body = assignment[2];
|
|
3458
|
+
if (!UI_FLAG_COOKIE_BODY_RE.test(body)) return false;
|
|
3459
|
+
if (SENSITIVE_CLIENT_COOKIE_RE.test(body)) return false;
|
|
3460
|
+
const name = body.split("=")[0];
|
|
3461
|
+
if (!UI_FLAG_COOKIE_NAME_RE.test(name)) return false;
|
|
3462
|
+
if (UI_FLAG_SENSITIVE_NAME_RE.test(name)) return false;
|
|
3463
|
+
}
|
|
3464
|
+
return saw;
|
|
3465
|
+
}
|
|
3376
3466
|
function isClearlyNonSensitivePreferenceCookieWrite(content, line) {
|
|
3377
3467
|
const assignment = /\bdocument\s*\.\s*cookie\s*=\s*(.+)$/i.exec(line);
|
|
3378
3468
|
if (!assignment) return false;
|
|
@@ -3404,7 +3494,7 @@ var insecureCookies = {
|
|
|
3404
3494
|
check(content, filePath) {
|
|
3405
3495
|
if (isTestFile(filePath)) return [];
|
|
3406
3496
|
if (!/cookie/i.test(content)) return [];
|
|
3407
|
-
const setCookiePattern = /(
|
|
3497
|
+
const setCookiePattern = /(?:\bset-cookie|\bsetCookie|\bcookie\s*=|res\.cookie\s*\()/i;
|
|
3408
3498
|
if (!setCookiePattern.test(content)) return [];
|
|
3409
3499
|
const hasHttpOnly = /httpOnly\s*:\s*true|httponly/i.test(content);
|
|
3410
3500
|
const hasSecure = /secure\s*:\s*(?!false\b)\S/i.test(content) || /;\s*secure/i.test(content);
|
|
@@ -3423,12 +3513,18 @@ var insecureCookies = {
|
|
|
3423
3513
|
() => `Add missing cookie flags: ${missing.join(", ")}. Example: { httpOnly: true, secure: true, sameSite: 'lax' }`
|
|
3424
3514
|
);
|
|
3425
3515
|
const lines = content.split("\n");
|
|
3516
|
+
const uiFlagMemo = /* @__PURE__ */ new Map();
|
|
3426
3517
|
for (const match of rawMatches) {
|
|
3427
3518
|
const line = lines[match.line - 1] ?? "";
|
|
3428
3519
|
if (!hasHttpOnly && isClearlyNonSensitivePreferenceCookieWrite(content, line)) {
|
|
3429
3520
|
continue;
|
|
3430
3521
|
}
|
|
3431
|
-
|
|
3522
|
+
let info = uiFlagMemo.get(match.line);
|
|
3523
|
+
if (info === void 0) {
|
|
3524
|
+
info = isConstantUiFlagCookieWrite(line, lines[match.line] ?? "");
|
|
3525
|
+
uiFlagMemo.set(match.line, info);
|
|
3526
|
+
}
|
|
3527
|
+
matches.push(info ? { ...match, severity: "info" } : match);
|
|
3432
3528
|
}
|
|
3433
3529
|
}
|
|
3434
3530
|
return matches;
|
|
@@ -3574,19 +3670,49 @@ var missingHTTPS = {
|
|
|
3574
3670
|
const isScriptFile = /\.(?:[cm]?[jt]sx?|vue|svelte)$/i.test(filePath);
|
|
3575
3671
|
if (!isScriptFile && /<!DOCTYPE|xmlns|\.dtd|\.xsd/i.test(content) && !/fetch|axios|request|http\.get/i.test(content)) return [];
|
|
3576
3672
|
const httpPattern = /["'`]http:\/\/(?!localhost|127\.0\.0\.1|0\.0\.0\.0|192\.168\.|10\.|172\.(?:1[6-9]|2\d|3[01])\.|www\.w3\.org|www\.apple\.com\/DTDs|schemas?\.|xml\.org|purl\.org|ns\.adobe|xmlpull\.org|java\.sun\.com)[^"'`\s]+["'`]/g;
|
|
3577
|
-
const
|
|
3578
|
-
|
|
3579
|
-
|
|
3580
|
-
|
|
3581
|
-
|
|
3582
|
-
() => "Use https:// instead of http:// for all production URLs. Add HSTS header: Strict-Transport-Security: max-age=31536000; includeSubDomains"
|
|
3583
|
-
);
|
|
3673
|
+
const httpIndexes = [];
|
|
3674
|
+
const rawMatches = findMatches(content, httpPattern, missingHTTPS, filePath, (m) => {
|
|
3675
|
+
httpIndexes.push(m.index);
|
|
3676
|
+
return "Use https:// instead of http:// for all production URLs. Add HSTS header: Strict-Transport-Security: max-age=31536000; includeSubDomains";
|
|
3677
|
+
});
|
|
3584
3678
|
const lines = rawMatches.length > 0 ? content.split("\n") : [];
|
|
3585
|
-
|
|
3679
|
+
const lineStarts = [];
|
|
3680
|
+
if (rawMatches.length > 0) {
|
|
3681
|
+
let acc = 0;
|
|
3682
|
+
for (const line of lines) {
|
|
3683
|
+
lineStarts.push(acc);
|
|
3684
|
+
acc += line.length + 1;
|
|
3685
|
+
}
|
|
3686
|
+
}
|
|
3687
|
+
const schemaKeyOnLine = /* @__PURE__ */ new Map();
|
|
3688
|
+
const tsaOnLine = /* @__PURE__ */ new Map();
|
|
3689
|
+
const firstSchemaKey = (line, lineNo) => {
|
|
3690
|
+
const cached = schemaKeyOnLine.get(lineNo);
|
|
3691
|
+
if (cached !== void 0) return cached;
|
|
3692
|
+
const key = /(?<![\w$])["']?\$(?:schema|id|ref)["']?\s*:/.exec(line);
|
|
3693
|
+
const at = key ? key.index : -1;
|
|
3694
|
+
schemaKeyOnLine.set(lineNo, at);
|
|
3695
|
+
return at;
|
|
3696
|
+
};
|
|
3697
|
+
for (let i = 0; i < rawMatches.length; i++) {
|
|
3698
|
+
const rm = rawMatches[i];
|
|
3586
3699
|
const matchText = lines[rm.line - 1] ?? "";
|
|
3587
3700
|
if (/DTD|DOCTYPE|w3\.org|apple\.com\/DTDs|\bxmlns[\w:-]*\s*=/i.test(matchText)) continue;
|
|
3588
|
-
if (
|
|
3589
|
-
|
|
3701
|
+
if (firstSchemaKey(matchText, rm.line) >= 0) {
|
|
3702
|
+
const col = httpIndexes[i] - (lineStarts[rm.line - 1] ?? 0);
|
|
3703
|
+
const lookback = matchText.slice(Math.max(0, col - 48), col);
|
|
3704
|
+
if (/(?<![\w$])["']?\$(?:schema|id)["']?\s*:\s*["']?\s*$/.test(lookback)) continue;
|
|
3705
|
+
if (/(?<![\w$])["']?\$ref["']?\s*:\s*["']?\s*$/.test(lookback)) {
|
|
3706
|
+
const host = (/https?:\/\/([^/"'\s:?#]+)/i.exec(matchText.slice(col, col + 300))?.[1] ?? "").toLowerCase();
|
|
3707
|
+
if (host === "json-schema.org" || host.endsWith(".json-schema.org")) continue;
|
|
3708
|
+
}
|
|
3709
|
+
}
|
|
3710
|
+
let tsa = tsaOnLine.get(rm.line);
|
|
3711
|
+
if (tsa === void 0) {
|
|
3712
|
+
tsa = /--\s*tsaurl\b|\btsaurl\b|timestamp\.(?:digicert|sectigo|comodoca|globalsign|entrust|geotrust|verisign|apple)\.|timestamp\.acs\.microsoft\.com|freetsa\.org/i.test(matchText);
|
|
3713
|
+
tsaOnLine.set(rm.line, tsa);
|
|
3714
|
+
}
|
|
3715
|
+
if (tsa) continue;
|
|
3590
3716
|
matches.push(rm);
|
|
3591
3717
|
}
|
|
3592
3718
|
return matches;
|
|
@@ -4516,12 +4642,13 @@ function runCustomRules(content, filePath, disabledRules = [], tier = "free", ex
|
|
|
4516
4642
|
}
|
|
4517
4643
|
if (maxLineLen > 5e4) return findings;
|
|
4518
4644
|
if (/demo-data|example-vulnerable|code-sample/i.test(filePath)) return findings;
|
|
4519
|
-
|
|
4645
|
+
const sbomFile = isSbomPath(filePath);
|
|
4520
4646
|
const vendoredFile = isVendoredPath(filePath);
|
|
4521
4647
|
const ruleset = tier === "pro" && extraRules.length > 0 ? [...freeRules, ...extraRules] : freeRules;
|
|
4522
4648
|
const silenceableLines = /-OK\b/i.test(content) ? content.split("\n") : null;
|
|
4523
4649
|
for (const rule of ruleset) {
|
|
4524
4650
|
if (disabledRules.includes(rule.id)) continue;
|
|
4651
|
+
if (sbomFile && rule.category !== "Secrets") continue;
|
|
4525
4652
|
const matches = rule.check(content, filePath, project);
|
|
4526
4653
|
const compliance = complianceMap[rule.id];
|
|
4527
4654
|
const vendored = vendoredFile && isVendoredFinding({ file: filePath, rule: rule.id, category: rule.category });
|
|
@@ -4934,6 +5061,30 @@ async function filterFalsePositives(findings, fileContents, budgetMs = AI_FILTER
|
|
|
4934
5061
|
}
|
|
4935
5062
|
|
|
4936
5063
|
// src/entropy-scanner.ts
|
|
5064
|
+
function orderedAlphabetRatio(value) {
|
|
5065
|
+
if (value.length === 0) return 0;
|
|
5066
|
+
let ordered = 0;
|
|
5067
|
+
let run = 1;
|
|
5068
|
+
const cls = (c) => {
|
|
5069
|
+
if (c >= 48 && c <= 57) return 1;
|
|
5070
|
+
if (c >= 65 && c <= 90) return 2;
|
|
5071
|
+
if (c >= 97 && c <= 122) return 3;
|
|
5072
|
+
return 0;
|
|
5073
|
+
};
|
|
5074
|
+
for (let i = 1; i < value.length; i++) {
|
|
5075
|
+
const a = value.charCodeAt(i - 1);
|
|
5076
|
+
const b = value.charCodeAt(i);
|
|
5077
|
+
const ca = cls(a);
|
|
5078
|
+
if (ca !== 0 && ca === cls(b) && b === a + 1) {
|
|
5079
|
+
run++;
|
|
5080
|
+
if (run === 4) ordered += 4;
|
|
5081
|
+
else if (run > 4) ordered++;
|
|
5082
|
+
} else {
|
|
5083
|
+
run = 1;
|
|
5084
|
+
}
|
|
5085
|
+
}
|
|
5086
|
+
return ordered / value.length;
|
|
5087
|
+
}
|
|
4937
5088
|
function shannonEntropy(str) {
|
|
4938
5089
|
const freq = {};
|
|
4939
5090
|
for (const ch of str) {
|
|
@@ -5173,6 +5324,7 @@ function scanEntropy(files) {
|
|
|
5173
5324
|
const stringPattern = /(?:[:=]\s*)(["'`])([^"'`\n]{20,256})\1/g;
|
|
5174
5325
|
let match;
|
|
5175
5326
|
while ((match = stringPattern.exec(line)) !== null) {
|
|
5327
|
+
if (match[1] === "`" && /(?:^|[\s(]):[a-z][\w-]{0,20}:$/.test(line.slice(Math.max(0, match.index - 23), match.index + 1))) continue;
|
|
5176
5328
|
let beforeAssign = line.substring(0, match.index);
|
|
5177
5329
|
if (structured) beforeAssign = beforeAssign.slice(Math.max(beforeAssign.lastIndexOf(","), beforeAssign.lastIndexOf("{")) + 1);
|
|
5178
5330
|
candidates.push({ value: match[2], beforeAssign });
|
|
@@ -5185,6 +5337,8 @@ function scanEntropy(files) {
|
|
|
5185
5337
|
if (value.includes("${")) continue;
|
|
5186
5338
|
if (value.includes("\\(")) continue;
|
|
5187
5339
|
if (value.includes("#{") || value.includes("{{")) continue;
|
|
5340
|
+
if (/^(?:\$\w{1,64}|\$env\{\w{1,64}\}|%\w{1,64}%|~|\.{1,2})?[\/\\](?:[\w.@ -]{1,64}[\/\\]){1,20}[\w@ -][\w.@ -]{0,63}\.[A-Za-z0-9]{1,8}$/.test(value) && !/[A-Za-z0-9+]{24,}/.test(value)) continue;
|
|
5341
|
+
if (orderedAlphabetRatio(value) >= 0.9) continue;
|
|
5188
5342
|
const isUuidShape = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(value);
|
|
5189
5343
|
if (!isUuidShape && SAFE_PATTERNS.some((p) => p.test(value))) continue;
|
|
5190
5344
|
if (HASH_PREFIX_RE.test(value)) continue;
|
|
@@ -9716,6 +9870,7 @@ export {
|
|
|
9716
9870
|
QUALITY_EXAMPLES,
|
|
9717
9871
|
RULE_IMPACTS,
|
|
9718
9872
|
SCANNER_VERSION,
|
|
9873
|
+
SERVER_ACTION_WRITE_RE,
|
|
9719
9874
|
TEST_FILE_PATTERN,
|
|
9720
9875
|
TOTAL_RULE_COUNT,
|
|
9721
9876
|
allRules,
|