xploitscan-shared-rules 2.4.19 → 2.4.20
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 +359 -30
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +12 -2
- package/dist/index.d.ts +12 -2
- package/dist/index.js +358 -30
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -165,7 +165,7 @@ interface CustomRule {
|
|
|
165
165
|
* before a scan can be saved without enough provenance to explain a changed
|
|
166
166
|
* grade.
|
|
167
167
|
*/
|
|
168
|
-
declare const SCANNER_VERSION = "2.4.
|
|
168
|
+
declare const SCANNER_VERSION = "2.4.20";
|
|
169
169
|
|
|
170
170
|
/**
|
|
171
171
|
* Line-oriented helpers shared by every rule. Pure string manipulation — no fs
|
|
@@ -579,6 +579,16 @@ declare function isUngradedFinding(finding: {
|
|
|
579
579
|
}, options?: {
|
|
580
580
|
gradeVendored?: boolean;
|
|
581
581
|
}): boolean;
|
|
582
|
+
/**
|
|
583
|
+
* Reported severity for one finding.
|
|
584
|
+
*
|
|
585
|
+
* A non-live VC001 match in a test path (`testFile === true`, stamped only
|
|
586
|
+
* when `isTestPath` holds and `isLive` does not) is emitted at low. Every
|
|
587
|
+
* other rule, a live key, and a finding whose `testFile` flag is unset or
|
|
588
|
+
* false keeps the severity it was given. Callers pass `testFile` after that
|
|
589
|
+
* stamp, so "low" and the not-graded label stay on the same findings.
|
|
590
|
+
*/
|
|
591
|
+
declare function vc001TestFixtureSeverity<S extends string>(rule: string | undefined, testFile: boolean | undefined, severity: S): S | "low";
|
|
582
592
|
|
|
583
593
|
/**
|
|
584
594
|
* Route-table extraction — what URL, if any, reaches a given source file.
|
|
@@ -1728,4 +1738,4 @@ input: {
|
|
|
1728
1738
|
content: string;
|
|
1729
1739
|
}[] | QualityContext, rules?: QualityRule[]): Finding[];
|
|
1730
1740
|
|
|
1731
|
-
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, hardcodedSecretValues, 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, maskSecretValue, 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 };
|
|
1741
|
+
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, hardcodedSecretValues, 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, maskSecretValue, 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, vc001TestFixtureSeverity, vendoredReason, visitBinary, visitCalls, weakHashing, xssVulnerability };
|
package/dist/index.d.ts
CHANGED
|
@@ -165,7 +165,7 @@ interface CustomRule {
|
|
|
165
165
|
* before a scan can be saved without enough provenance to explain a changed
|
|
166
166
|
* grade.
|
|
167
167
|
*/
|
|
168
|
-
declare const SCANNER_VERSION = "2.4.
|
|
168
|
+
declare const SCANNER_VERSION = "2.4.20";
|
|
169
169
|
|
|
170
170
|
/**
|
|
171
171
|
* Line-oriented helpers shared by every rule. Pure string manipulation — no fs
|
|
@@ -579,6 +579,16 @@ declare function isUngradedFinding(finding: {
|
|
|
579
579
|
}, options?: {
|
|
580
580
|
gradeVendored?: boolean;
|
|
581
581
|
}): boolean;
|
|
582
|
+
/**
|
|
583
|
+
* Reported severity for one finding.
|
|
584
|
+
*
|
|
585
|
+
* A non-live VC001 match in a test path (`testFile === true`, stamped only
|
|
586
|
+
* when `isTestPath` holds and `isLive` does not) is emitted at low. Every
|
|
587
|
+
* other rule, a live key, and a finding whose `testFile` flag is unset or
|
|
588
|
+
* false keeps the severity it was given. Callers pass `testFile` after that
|
|
589
|
+
* stamp, so "low" and the not-graded label stay on the same findings.
|
|
590
|
+
*/
|
|
591
|
+
declare function vc001TestFixtureSeverity<S extends string>(rule: string | undefined, testFile: boolean | undefined, severity: S): S | "low";
|
|
582
592
|
|
|
583
593
|
/**
|
|
584
594
|
* Route-table extraction — what URL, if any, reaches a given source file.
|
|
@@ -1728,4 +1738,4 @@ input: {
|
|
|
1728
1738
|
content: string;
|
|
1729
1739
|
}[] | QualityContext, rules?: QualityRule[]): Finding[];
|
|
1730
1740
|
|
|
1731
|
-
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, hardcodedSecretValues, 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, maskSecretValue, 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 };
|
|
1741
|
+
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, hardcodedSecretValues, 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, maskSecretValue, 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, vc001TestFixtureSeverity, 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.20";
|
|
3
3
|
|
|
4
4
|
// src/snippet.ts
|
|
5
5
|
var cacheContent = null;
|
|
@@ -707,6 +707,10 @@ function isUngradedFinding(finding, options = {}) {
|
|
|
707
707
|
if (options.gradeVendored) return false;
|
|
708
708
|
return isVendoredFinding(finding);
|
|
709
709
|
}
|
|
710
|
+
function vc001TestFixtureSeverity(rule, testFile, severity) {
|
|
711
|
+
if (rule === "VC001" && testFile === true) return "low";
|
|
712
|
+
return severity;
|
|
713
|
+
}
|
|
710
714
|
|
|
711
715
|
// src/routes.ts
|
|
712
716
|
var API_RE = /^\/api(\/|$)|^\/_|\.(json|js|xml|txt|ico)$/;
|
|
@@ -2066,6 +2070,308 @@ function noteHardcodedSecret(secret) {
|
|
|
2066
2070
|
const sink = hardcodedSecretValueSink[hardcodedSecretValueSink.length - 1];
|
|
2067
2071
|
if (sink && secret) sink.push(secret);
|
|
2068
2072
|
}
|
|
2073
|
+
var LOCKED_PLACEHOLDER_TOKENS = /* @__PURE__ */ new Set([
|
|
2074
|
+
"your_api_key_here",
|
|
2075
|
+
"your-key-here",
|
|
2076
|
+
"your_key",
|
|
2077
|
+
"<your_key>",
|
|
2078
|
+
"changeme"
|
|
2079
|
+
]);
|
|
2080
|
+
function isEntireXBody(value) {
|
|
2081
|
+
if (!value) return false;
|
|
2082
|
+
for (let i = 0; i < value.length; i++) {
|
|
2083
|
+
const code = value.charCodeAt(i);
|
|
2084
|
+
if (code !== 120 && code !== 88) return false;
|
|
2085
|
+
}
|
|
2086
|
+
return true;
|
|
2087
|
+
}
|
|
2088
|
+
function bodyAfterKnownPrefix(token) {
|
|
2089
|
+
const lower = token.toLowerCase();
|
|
2090
|
+
const prefixes = ["sk_live_", "pk_live_", "sk_test_", "pk_test_", "rk_live_", "rk_test_"];
|
|
2091
|
+
for (const prefix of prefixes) {
|
|
2092
|
+
if (lower.startsWith(prefix)) return token.slice(prefix.length);
|
|
2093
|
+
}
|
|
2094
|
+
return null;
|
|
2095
|
+
}
|
|
2096
|
+
function isLockedVc001Placeholder(token) {
|
|
2097
|
+
if (!token) return false;
|
|
2098
|
+
const trimmed = token.trim();
|
|
2099
|
+
if (!trimmed) return false;
|
|
2100
|
+
const lower = trimmed.toLowerCase();
|
|
2101
|
+
if (LOCKED_PLACEHOLDER_TOKENS.has(lower) || isEntireXBody(trimmed)) return true;
|
|
2102
|
+
const body = bodyAfterKnownPrefix(trimmed);
|
|
2103
|
+
if (body === null || body.length === 0) return false;
|
|
2104
|
+
return LOCKED_PLACEHOLDER_TOKENS.has(body.toLowerCase()) || isEntireXBody(body);
|
|
2105
|
+
}
|
|
2106
|
+
function collapseIdenticalRuns(token) {
|
|
2107
|
+
let out = "";
|
|
2108
|
+
let i = 0;
|
|
2109
|
+
while (i < token.length) {
|
|
2110
|
+
let j = i + 1;
|
|
2111
|
+
while (j < token.length && token[j] === token[i]) j += 1;
|
|
2112
|
+
const keep = j - i >= 8 ? 7 : j - i;
|
|
2113
|
+
out += token[i].repeat(keep);
|
|
2114
|
+
i = j;
|
|
2115
|
+
}
|
|
2116
|
+
return out;
|
|
2117
|
+
}
|
|
2118
|
+
function liveDespiteIdenticalRun(text) {
|
|
2119
|
+
if (!text || textHasLiveCredential(text)) return false;
|
|
2120
|
+
const re = /(?:sk_live_|rk_live_)[A-Za-z0-9]{20,}/g;
|
|
2121
|
+
let found;
|
|
2122
|
+
while ((found = re.exec(text)) !== null) {
|
|
2123
|
+
const token = found[0];
|
|
2124
|
+
if (isLockedVc001Placeholder(token)) continue;
|
|
2125
|
+
const collapsed = collapseIdenticalRuns(token);
|
|
2126
|
+
if (collapsed === token) continue;
|
|
2127
|
+
if (!isPlaceholderToken(collapsed)) return true;
|
|
2128
|
+
}
|
|
2129
|
+
return false;
|
|
2130
|
+
}
|
|
2131
|
+
function stripeReportedSeverity(text) {
|
|
2132
|
+
if (/pk_live_[A-Za-z0-9]{20,}/.test(text)) return "low";
|
|
2133
|
+
if (/sk_test_[A-Za-z0-9]{20,}/.test(text)) return "medium";
|
|
2134
|
+
return void 0;
|
|
2135
|
+
}
|
|
2136
|
+
function decodeBase64UrlJson(segment) {
|
|
2137
|
+
try {
|
|
2138
|
+
if (!segment || segment.length > 8192) return null;
|
|
2139
|
+
const pad = segment.length % 4 === 0 ? "" : "=".repeat(4 - segment.length % 4);
|
|
2140
|
+
const b64 = segment.replace(/-/g, "+").replace(/_/g, "/") + pad;
|
|
2141
|
+
const binary = atob(b64);
|
|
2142
|
+
const bytes = new Uint8Array(binary.length);
|
|
2143
|
+
for (let i = 0; i < binary.length; i++) bytes[i] = binary.charCodeAt(i) & 255;
|
|
2144
|
+
return JSON.parse(new TextDecoder().decode(bytes));
|
|
2145
|
+
} catch {
|
|
2146
|
+
return null;
|
|
2147
|
+
}
|
|
2148
|
+
}
|
|
2149
|
+
function decodeSupabaseJwt(token) {
|
|
2150
|
+
const parts = token.split(".");
|
|
2151
|
+
if (parts.length !== 3) return null;
|
|
2152
|
+
if (parts.some((part) => !/^[A-Za-z0-9_-]{8,}$/.test(part))) return null;
|
|
2153
|
+
const payload = decodeBase64UrlJson(parts[1]);
|
|
2154
|
+
if (!payload || typeof payload !== "object") return null;
|
|
2155
|
+
const rec = payload;
|
|
2156
|
+
return {
|
|
2157
|
+
role: typeof rec.role === "string" ? rec.role : void 0,
|
|
2158
|
+
iss: typeof rec.iss === "string" ? rec.iss : void 0,
|
|
2159
|
+
payloadText: JSON.stringify(payload)
|
|
2160
|
+
};
|
|
2161
|
+
}
|
|
2162
|
+
var STRING_CONST_VALUE_MAX = 4096;
|
|
2163
|
+
var CREATE_CLIENT_CALL_CAP = 200;
|
|
2164
|
+
function collectStringConsts(content) {
|
|
2165
|
+
const map = /* @__PURE__ */ new Map();
|
|
2166
|
+
const head = /(?:const|let|var)\s+([A-Za-z_$][\w$]{0,64})\s*=\s*(['"`])/g;
|
|
2167
|
+
let match;
|
|
2168
|
+
while ((match = head.exec(content)) !== null) {
|
|
2169
|
+
const name = match[1];
|
|
2170
|
+
const quote = match[2];
|
|
2171
|
+
const valueStart = match.index + match[0].length;
|
|
2172
|
+
const limit = Math.min(content.length, valueStart + STRING_CONST_VALUE_MAX);
|
|
2173
|
+
let end = valueStart;
|
|
2174
|
+
while (end < limit && content[end] !== quote) end += 1;
|
|
2175
|
+
if (end >= limit || content[end] !== quote) continue;
|
|
2176
|
+
if (!map.has(name)) map.set(name, { value: content.slice(valueStart, end), index: valueStart });
|
|
2177
|
+
head.lastIndex = end + 1;
|
|
2178
|
+
}
|
|
2179
|
+
return map;
|
|
2180
|
+
}
|
|
2181
|
+
function stringConstValue(consts, name) {
|
|
2182
|
+
if (!/^[A-Za-z_$][\w$]{0,64}$/.test(name)) return null;
|
|
2183
|
+
const found = consts.get(name);
|
|
2184
|
+
return found ? found.value : null;
|
|
2185
|
+
}
|
|
2186
|
+
function isLoopbackClientUrl(raw) {
|
|
2187
|
+
const match = /^[a-z][a-z0-9+.-]*:\/\/([^/?#\s]+)/i.exec(raw.trim());
|
|
2188
|
+
if (!match) return false;
|
|
2189
|
+
let host = match[1];
|
|
2190
|
+
if (host.startsWith("[")) {
|
|
2191
|
+
const end = host.indexOf("]");
|
|
2192
|
+
if (end < 0) return false;
|
|
2193
|
+
host = host.slice(1, end);
|
|
2194
|
+
} else {
|
|
2195
|
+
host = host.replace(/:\d+$/, "");
|
|
2196
|
+
}
|
|
2197
|
+
host = host.toLowerCase();
|
|
2198
|
+
return host === "localhost" || host === "127.0.0.1" || host === "::1";
|
|
2199
|
+
}
|
|
2200
|
+
function quotedValue(text) {
|
|
2201
|
+
const trimmed = text.trim();
|
|
2202
|
+
if (!trimmed) return null;
|
|
2203
|
+
const lead = text.indexOf(trimmed);
|
|
2204
|
+
if (/^(?:process\.env|import\.meta\.env)\.[A-Za-z0-9_]+!?$/.test(trimmed)) return null;
|
|
2205
|
+
const fallback = /(?:process\.env|import\.meta\.env)\.[A-Za-z0-9_]+!?\s*(?:\?\?|\|\|)\s*(['"`])([\s\S]*?)\1/.exec(trimmed);
|
|
2206
|
+
if (fallback?.[2]) {
|
|
2207
|
+
const rel = text.indexOf(fallback[2]);
|
|
2208
|
+
return { token: fallback[2], rel: rel < 0 ? lead : rel };
|
|
2209
|
+
}
|
|
2210
|
+
const literal = /^(['"`])([\s\S]*)\1$/.exec(trimmed);
|
|
2211
|
+
if (literal) {
|
|
2212
|
+
const rel = text.indexOf(literal[2]);
|
|
2213
|
+
return { token: literal[2], rel: rel < 0 ? lead + 1 : rel };
|
|
2214
|
+
}
|
|
2215
|
+
return null;
|
|
2216
|
+
}
|
|
2217
|
+
function splitCallArgs(content, openParen, cap) {
|
|
2218
|
+
const endLimit = Math.min(content.length, openParen + cap);
|
|
2219
|
+
const args = [];
|
|
2220
|
+
let start = openParen + 1;
|
|
2221
|
+
let depth = 1;
|
|
2222
|
+
let quote = null;
|
|
2223
|
+
let i = openParen + 1;
|
|
2224
|
+
while (i < endLimit && depth > 0) {
|
|
2225
|
+
const ch = content[i];
|
|
2226
|
+
if (quote) {
|
|
2227
|
+
if (ch === "\\") {
|
|
2228
|
+
i += 2;
|
|
2229
|
+
continue;
|
|
2230
|
+
}
|
|
2231
|
+
if (ch === quote) quote = null;
|
|
2232
|
+
i++;
|
|
2233
|
+
continue;
|
|
2234
|
+
}
|
|
2235
|
+
if (ch === "'" || ch === '"' || ch === "`") {
|
|
2236
|
+
quote = ch;
|
|
2237
|
+
i++;
|
|
2238
|
+
continue;
|
|
2239
|
+
}
|
|
2240
|
+
if (ch === "(" || ch === "[" || ch === "{") {
|
|
2241
|
+
depth++;
|
|
2242
|
+
i++;
|
|
2243
|
+
continue;
|
|
2244
|
+
}
|
|
2245
|
+
if (ch === ")" || ch === "]" || ch === "}") {
|
|
2246
|
+
depth--;
|
|
2247
|
+
if (depth === 0) {
|
|
2248
|
+
args.push({ text: content.slice(start, i), start });
|
|
2249
|
+
return { args, end: i + 1 };
|
|
2250
|
+
}
|
|
2251
|
+
i++;
|
|
2252
|
+
continue;
|
|
2253
|
+
}
|
|
2254
|
+
if (ch === "," && depth === 1) {
|
|
2255
|
+
args.push({ text: content.slice(start, i), start });
|
|
2256
|
+
start = i + 1;
|
|
2257
|
+
if (args.length >= 4) {
|
|
2258
|
+
return { args, end: i + 1 };
|
|
2259
|
+
}
|
|
2260
|
+
}
|
|
2261
|
+
i++;
|
|
2262
|
+
}
|
|
2263
|
+
return { args, end: i };
|
|
2264
|
+
}
|
|
2265
|
+
function objectKeyToken(arg, consts) {
|
|
2266
|
+
const named = /\b(?:supabaseKey|serviceRoleKey|service_role_key|apiKey|key)\s*:\s*(?:(['"`])([\s\S]*?)\1|([A-Za-z_$][\w$]{0,64}))/.exec(arg.text);
|
|
2267
|
+
if (!named) return null;
|
|
2268
|
+
if (named[2]) {
|
|
2269
|
+
const rel2 = arg.text.indexOf(named[2]);
|
|
2270
|
+
return { token: named[2], index: arg.start + (rel2 < 0 ? 0 : rel2) };
|
|
2271
|
+
}
|
|
2272
|
+
const ident = named[3];
|
|
2273
|
+
if (!ident) return null;
|
|
2274
|
+
const resolved = stringConstValue(consts, ident);
|
|
2275
|
+
if (resolved === null) return null;
|
|
2276
|
+
const rel = arg.text.indexOf(ident);
|
|
2277
|
+
return { token: resolved, index: arg.start + (rel < 0 ? 0 : rel) };
|
|
2278
|
+
}
|
|
2279
|
+
function valueToken(arg, consts) {
|
|
2280
|
+
const quoted = quotedValue(arg.text);
|
|
2281
|
+
if (quoted) return { token: quoted.token, index: arg.start + quoted.rel };
|
|
2282
|
+
const trimmed = arg.text.trim();
|
|
2283
|
+
if (/^[A-Za-z_$][\w$]{0,64}$/.test(trimmed)) {
|
|
2284
|
+
const resolved = stringConstValue(consts, trimmed);
|
|
2285
|
+
if (resolved === null) return null;
|
|
2286
|
+
const rel = arg.text.indexOf(trimmed);
|
|
2287
|
+
return { token: resolved, index: arg.start + (rel < 0 ? 0 : rel) };
|
|
2288
|
+
}
|
|
2289
|
+
if (trimmed.startsWith("{")) return objectKeyToken(arg, consts);
|
|
2290
|
+
return null;
|
|
2291
|
+
}
|
|
2292
|
+
function clientUrl(args) {
|
|
2293
|
+
if (args.length === 0) return "";
|
|
2294
|
+
const first = args[0].text.trim();
|
|
2295
|
+
const literal = /^(['"`])([\s\S]*)\1$/.exec(first);
|
|
2296
|
+
if (literal) return literal[2];
|
|
2297
|
+
if (first.startsWith("{")) {
|
|
2298
|
+
const url = /\b(?:supabaseUrl|url)\s*:\s*(['"`])([\s\S]*?)\1/.exec(first);
|
|
2299
|
+
return url?.[2] ?? "";
|
|
2300
|
+
}
|
|
2301
|
+
return "";
|
|
2302
|
+
}
|
|
2303
|
+
function nextCreateClient(content, from, cursor) {
|
|
2304
|
+
if (cursor.camel >= 0 && cursor.camel < from) {
|
|
2305
|
+
cursor.camel = content.indexOf("createClient", from);
|
|
2306
|
+
}
|
|
2307
|
+
if (cursor.snake >= 0 && cursor.snake < from) {
|
|
2308
|
+
cursor.snake = content.indexOf("create_client", from);
|
|
2309
|
+
}
|
|
2310
|
+
if (cursor.camel < 0) return cursor.snake;
|
|
2311
|
+
if (cursor.snake < 0) return cursor.camel;
|
|
2312
|
+
return cursor.camel < cursor.snake ? cursor.camel : cursor.snake;
|
|
2313
|
+
}
|
|
2314
|
+
function collectSupabaseCreateClientKeys(content, filePath, matches, rule, fix) {
|
|
2315
|
+
if (!content.includes("createClient") && !content.includes("create_client")) return;
|
|
2316
|
+
const consts = content.includes("createClient") ? collectStringConsts(content) : /* @__PURE__ */ new Map();
|
|
2317
|
+
const cap = 2e4;
|
|
2318
|
+
let from = 0;
|
|
2319
|
+
let calls = 0;
|
|
2320
|
+
const cursor = {
|
|
2321
|
+
camel: content.indexOf("createClient"),
|
|
2322
|
+
snake: content.indexOf("create_client")
|
|
2323
|
+
};
|
|
2324
|
+
while (from < content.length) {
|
|
2325
|
+
const at = nextCreateClient(content, from, cursor);
|
|
2326
|
+
if (at < 0) break;
|
|
2327
|
+
const nameLen = content.startsWith("create_client", at) ? "create_client".length : "createClient".length;
|
|
2328
|
+
const before = at === 0 ? "" : content[at - 1];
|
|
2329
|
+
const afterName = at + nameLen;
|
|
2330
|
+
if (before && /[A-Za-z0-9_$]/.test(before) || /[A-Za-z0-9_$]/.test(content[afterName] ?? "")) {
|
|
2331
|
+
from = afterName;
|
|
2332
|
+
continue;
|
|
2333
|
+
}
|
|
2334
|
+
let i = afterName;
|
|
2335
|
+
while (i < content.length && (content[i] === " " || content[i] === " " || content[i] === "\n" || content[i] === "\r")) i++;
|
|
2336
|
+
if (content[i] !== "(") {
|
|
2337
|
+
from = afterName;
|
|
2338
|
+
continue;
|
|
2339
|
+
}
|
|
2340
|
+
calls += 1;
|
|
2341
|
+
if (calls > CREATE_CLIENT_CALL_CAP) break;
|
|
2342
|
+
const parsed = splitCallArgs(content, i, cap);
|
|
2343
|
+
from = parsed?.end ?? Math.min(content.length, i + cap);
|
|
2344
|
+
if (!parsed || parsed.args.length === 0) continue;
|
|
2345
|
+
if (isCommentLine(content, at) || isInsideFixMessage(content, at)) continue;
|
|
2346
|
+
const first = parsed.args[0].text.trim();
|
|
2347
|
+
const keyArg = first.startsWith("{") ? parsed.args[0] : parsed.args[1];
|
|
2348
|
+
if (!keyArg) continue;
|
|
2349
|
+
const extracted = first.startsWith("{") ? objectKeyToken(keyArg, consts) : valueToken(keyArg, consts);
|
|
2350
|
+
if (!extracted || !extracted.token) continue;
|
|
2351
|
+
const token = extracted.token.trim();
|
|
2352
|
+
if (isPlaceholderToken(token) || isLockedVc001Placeholder(token)) continue;
|
|
2353
|
+
const decoded = decodeSupabaseJwt(token);
|
|
2354
|
+
if (!decoded || decoded.role !== "service_role") continue;
|
|
2355
|
+
const url = clientUrl(parsed.args);
|
|
2356
|
+
const downgrade = isTestPath(filePath) && (decoded.iss === "supabase-demo" || isLoopbackClientUrl(url));
|
|
2357
|
+
const line = lineNumberAt(content, extracted.index);
|
|
2358
|
+
const lineStart = content.lastIndexOf("\n", Math.max(0, extracted.index - 1)) + 1;
|
|
2359
|
+
const column = extracted.index - lineStart + 1;
|
|
2360
|
+
matches.push({
|
|
2361
|
+
rule: rule.id,
|
|
2362
|
+
title: rule.title,
|
|
2363
|
+
severity: downgrade ? "low" : "critical",
|
|
2364
|
+
category: rule.category,
|
|
2365
|
+
file: filePath,
|
|
2366
|
+
line,
|
|
2367
|
+
column,
|
|
2368
|
+
snippet: getSnippet(content, line),
|
|
2369
|
+
fix,
|
|
2370
|
+
...downgrade ? {} : { live: true }
|
|
2371
|
+
});
|
|
2372
|
+
noteHardcodedSecret(token);
|
|
2373
|
+
}
|
|
2374
|
+
}
|
|
2069
2375
|
var hardcodedSecrets = {
|
|
2070
2376
|
id: "VC001",
|
|
2071
2377
|
title: "Hardcoded API Key or Secret",
|
|
@@ -2167,10 +2473,9 @@ var hardcodedSecrets = {
|
|
|
2167
2473
|
50,
|
|
2168
2474
|
// [3] Supabase JWT
|
|
2169
2475
|
// [4] OpenAI and [11]–[14] fixed-prefix tokens: the regex already
|
|
2170
|
-
// fixes the length
|
|
2171
|
-
//
|
|
2172
|
-
//
|
|
2173
|
-
// made redundant everywhere except that misread.)
|
|
2476
|
+
// fixes the length, so the floor is 0. Every other floor measures this
|
|
2477
|
+
// match's own value. A live credential skips the floor. A placeholder
|
|
2478
|
+
// is dropped first, so a template key is never reported.
|
|
2174
2479
|
0,
|
|
2175
2480
|
20,
|
|
2176
2481
|
// [5] generic tokens with {20,} in the regex
|
|
@@ -2197,6 +2502,27 @@ var hardcodedSecrets = {
|
|
|
2197
2502
|
const lines = content.split("\n");
|
|
2198
2503
|
const fileIsGemini = GEMINI_FILE_CONTEXT_RE.test(content);
|
|
2199
2504
|
const matches = [];
|
|
2505
|
+
const columnFrom = /* @__PURE__ */ new Map();
|
|
2506
|
+
const locate = (lineNo, line, secret) => {
|
|
2507
|
+
if (!secret) return void 0;
|
|
2508
|
+
const key = `${lineNo}\0${secret}`;
|
|
2509
|
+
const start = columnFrom.get(key) ?? 0;
|
|
2510
|
+
const at = line.indexOf(secret, start);
|
|
2511
|
+
if (at < 0) return void 0;
|
|
2512
|
+
columnFrom.set(key, at + secret.length);
|
|
2513
|
+
return at + 1;
|
|
2514
|
+
};
|
|
2515
|
+
const emit = (rm, secret, extra = {}) => {
|
|
2516
|
+
const column = locate(rm.line, lines[rm.line - 1] || "", secret);
|
|
2517
|
+
const stripeSev = extra.live || extra.severity ? void 0 : stripeReportedSeverity(secret);
|
|
2518
|
+
matches.push({
|
|
2519
|
+
...rm,
|
|
2520
|
+
...extra,
|
|
2521
|
+
...stripeSev ? { severity: stripeSev } : {},
|
|
2522
|
+
...column ? { column } : {}
|
|
2523
|
+
});
|
|
2524
|
+
noteHardcodedSecret(secret);
|
|
2525
|
+
};
|
|
2200
2526
|
for (let pi = 0; pi < patterns.length; pi++) {
|
|
2201
2527
|
const pattern = patterns[pi];
|
|
2202
2528
|
if (pi === GOOGLE_PI && !fileIsGemini && !GEMINI_NAME_RE.test(content)) continue;
|
|
@@ -2221,30 +2547,27 @@ var hardcodedSecrets = {
|
|
|
2221
2547
|
if (isPlaceholderToken(token)) continue;
|
|
2222
2548
|
if (pi === GOOGLE_PI) {
|
|
2223
2549
|
if (!isGeminiKeyContext(lines, rm.line, fileIsGemini)) continue;
|
|
2224
|
-
|
|
2225
|
-
noteHardcodedSecret(secretText[ri] ?? "");
|
|
2550
|
+
emit(rm, secretText[ri] ?? token, textHasLiveCredential(token) ? { severity: "high", live: true } : { severity: "high" });
|
|
2226
2551
|
continue;
|
|
2227
2552
|
}
|
|
2228
2553
|
if (pi === STRIPE_RESTRICTED_PI && !token.startsWith("rk_live_")) {
|
|
2229
|
-
|
|
2230
|
-
noteHardcodedSecret(secretText[ri] ?? "");
|
|
2554
|
+
emit(rm, secretText[ri] ?? token, { severity: "high" });
|
|
2231
2555
|
continue;
|
|
2232
2556
|
}
|
|
2233
2557
|
if (textHasLiveCredential(token)) {
|
|
2234
|
-
|
|
2235
|
-
noteHardcodedSecret(secretText[ri] ?? "");
|
|
2558
|
+
emit(rm, secretText[ri] ?? token, { live: true });
|
|
2236
2559
|
continue;
|
|
2237
2560
|
}
|
|
2238
2561
|
}
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
|
|
2562
|
+
const judged = secretText[ri] && secretText[ri].length > 0 ? secretText[ri] : matchedText[ri] ?? "";
|
|
2563
|
+
const judgedLive = textHasLiveCredential(judged) || liveDespiteIdenticalRun(judged);
|
|
2564
|
+
if (pi !== 9 && pi !== 10 && !judgedLive && isLockedVc001Placeholder(judged)) continue;
|
|
2565
|
+
const matchedLive = textHasLiveCredential(matchedText[ri] ?? "") || judgedLive;
|
|
2566
|
+
if (!matchedLive && floor > 0 && judged.length < floor) continue;
|
|
2243
2567
|
if (pi === 6) {
|
|
2244
|
-
const
|
|
2568
|
+
const value = judged;
|
|
2245
2569
|
const nameMatch = (matchedText[ri] ?? "").match(/^[A-Z][A-Z0-9_]{0,64}_(?:SECRET|TOKEN|KEY|PASSWORD|PASSWD)\b/);
|
|
2246
|
-
if (
|
|
2247
|
-
const value = valMatch[1];
|
|
2570
|
+
if (value && nameMatch) {
|
|
2248
2571
|
const isKeySuffix = nameMatch[0].endsWith("_KEY");
|
|
2249
2572
|
const isSlotIdentifier = value.length < 40 && (/^[a-z0-9]+([_-][a-z0-9]+)+$/.test(value) || isNamespacedSlotKey(nameMatch[0], value));
|
|
2250
2573
|
if (isKeySuffix && isSlotIdentifier) continue;
|
|
@@ -2253,15 +2576,18 @@ var hardcodedSecrets = {
|
|
|
2253
2576
|
if (pi === 10) {
|
|
2254
2577
|
const url = matchedText[ri] ?? "";
|
|
2255
2578
|
if (dbUrlLacksRealCredential(url)) continue;
|
|
2256
|
-
|
|
2257
|
-
|
|
2579
|
+
emit(
|
|
2580
|
+
rm,
|
|
2581
|
+
secretText[ri] ?? url,
|
|
2582
|
+
isLoopbackDevDefault(url) ? { severity: "low" } : textHasLiveCredential(url) ? { live: true } : {}
|
|
2583
|
+
);
|
|
2258
2584
|
continue;
|
|
2259
2585
|
}
|
|
2260
2586
|
const matched = matchedText[ri] ?? "";
|
|
2261
|
-
|
|
2262
|
-
noteHardcodedSecret(secretText[ri] ?? "");
|
|
2587
|
+
emit(rm, judged, textHasLiveCredential(matched) || matchedLive ? { live: true } : {});
|
|
2263
2588
|
}
|
|
2264
2589
|
}
|
|
2590
|
+
collectSupabaseCreateClientKeys(content, filePath, matches, hardcodedSecrets, fixMessages[3]);
|
|
2265
2591
|
return matches;
|
|
2266
2592
|
}
|
|
2267
2593
|
};
|
|
@@ -3838,7 +4164,7 @@ var hardcodedJWTSecret = {
|
|
|
3838
4164
|
category: "Secrets",
|
|
3839
4165
|
description: "JWT tokens signed with a hardcoded string secret can be forged by anyone who reads the source code.",
|
|
3840
4166
|
check(content, filePath) {
|
|
3841
|
-
if (filePath.endsWith(".example") || filePath.endsWith(".template") || filePath
|
|
4167
|
+
if (filePath.endsWith(".example") || filePath.endsWith(".template") || isTestFile(filePath)) return [];
|
|
3842
4168
|
const patterns = [
|
|
3843
4169
|
/jwt\.sign\s*\([^,]{1,300},\s*["'`][^"'`]{3,}["'`]/g,
|
|
3844
4170
|
/jwt\.verify\s*\([^,]{1,300},\s*["'`][^"'`]{3,}["'`]/g,
|
|
@@ -3930,7 +4256,7 @@ var exposedDebugMode = {
|
|
|
3930
4256
|
category: "Configuration",
|
|
3931
4257
|
description: "Debug mode, verbose logging, or development configuration left in production code exposes internal details and may enable debug endpoints.",
|
|
3932
4258
|
check(content, filePath) {
|
|
3933
|
-
if (filePath
|
|
4259
|
+
if (isTestFile(filePath) || filePath.endsWith(".example") || filePath.includes("node_modules")) return [];
|
|
3934
4260
|
if (filePath.match(/\.env\.development$/)) return [];
|
|
3935
4261
|
const matches = [];
|
|
3936
4262
|
const patterns = [
|
|
@@ -4094,7 +4420,7 @@ var weakHashing = {
|
|
|
4094
4420
|
category: "Cryptography",
|
|
4095
4421
|
description: "MD5 and SHA1/SHA256 are too fast for password hashing \u2014 they can be brute-forced at billions of attempts per second. Use bcrypt, scrypt, or argon2 instead.",
|
|
4096
4422
|
check(content, filePath) {
|
|
4097
|
-
if (
|
|
4423
|
+
if (isTestFile(filePath)) return [];
|
|
4098
4424
|
if (/bcrypt|scrypt|argon2/i.test(content)) return [];
|
|
4099
4425
|
const matches = [];
|
|
4100
4426
|
const inlinePatterns = [
|
|
@@ -4868,13 +5194,14 @@ function runCustomRules(content, filePath, disabledRules = [], tier = "free", ex
|
|
|
4868
5194
|
live: match.live,
|
|
4869
5195
|
snippet: match.snippet
|
|
4870
5196
|
});
|
|
5197
|
+
const testFixture = onTestPath && !live;
|
|
4871
5198
|
findings.push({
|
|
4872
5199
|
...vendored ? { vendored: true } : {},
|
|
4873
|
-
...
|
|
5200
|
+
...testFixture ? { testFile: true } : {},
|
|
4874
5201
|
...live ? { live: true } : {},
|
|
4875
5202
|
id: `${match.rule}-${match.file}:${match.line}`,
|
|
4876
5203
|
rule: match.rule,
|
|
4877
|
-
severity: match.severity,
|
|
5204
|
+
severity: vc001TestFixtureSeverity(match.rule, testFixture ? true : void 0, match.severity),
|
|
4878
5205
|
title: match.title,
|
|
4879
5206
|
description: rule.description,
|
|
4880
5207
|
file: match.file,
|
|
@@ -8081,10 +8408,10 @@ var READ_VERB = /\b(?:select|from|find\w*|query|scan|rows|fetchAll|getAll|list)\
|
|
|
8081
8408
|
function repoReselects(files, originPath, originIndex, table, value) {
|
|
8082
8409
|
const tableToken = table.replace(/["'`]/g, "");
|
|
8083
8410
|
if (tableToken.length < 3) return false;
|
|
8084
|
-
const
|
|
8085
|
-
if (!
|
|
8411
|
+
const valueToken2 = normValue(value);
|
|
8412
|
+
if (!valueToken2 || valueToken2.length < 2) return false;
|
|
8086
8413
|
const tableRe = new RegExp(`\\b${escapeRe(tableToken)}s?\\b`, "gi");
|
|
8087
|
-
const valueRe = new RegExp(`\\b${escapeRe(
|
|
8414
|
+
const valueRe = new RegExp(`\\b${escapeRe(valueToken2)}\\b`, "i");
|
|
8088
8415
|
for (const f of files) {
|
|
8089
8416
|
if (f.excluded) continue;
|
|
8090
8417
|
for (const m of f.code.matchAll(tableRe)) {
|
|
@@ -10733,6 +11060,7 @@ export {
|
|
|
10733
11060
|
tryParse,
|
|
10734
11061
|
unmeasuredQualityRules,
|
|
10735
11062
|
unvalidatedRedirect,
|
|
11063
|
+
vc001TestFixtureSeverity,
|
|
10736
11064
|
vendoredReason,
|
|
10737
11065
|
visitBinary,
|
|
10738
11066
|
visitCalls,
|