xploitscan-shared-rules 2.1.1 → 2.3.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 +1094 -74
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +61 -2
- package/dist/index.d.ts +61 -2
- package/dist/index.js +1089 -74
- package/dist/index.js.map +1 -1
- package/package.json +3 -5
package/dist/index.d.cts
CHANGED
|
@@ -1078,6 +1078,28 @@ interface GradeOptions {
|
|
|
1078
1078
|
*/
|
|
1079
1079
|
gradeVendored?: boolean;
|
|
1080
1080
|
}
|
|
1081
|
+
/**
|
|
1082
|
+
* How many findings of one rule count toward point deductions and toward the
|
|
1083
|
+
* severity caps. The 4th and later stay in the report and deduct nothing more,
|
|
1084
|
+
* so one noisy rule cannot floor the score at 0.
|
|
1085
|
+
*
|
|
1086
|
+
* Three is the existing "≥3 high → max D" threshold: a rule that really does
|
|
1087
|
+
* have three highs still caps the letter at D, and further copies of that
|
|
1088
|
+
* same rule do not also zero the numeric score.
|
|
1089
|
+
*/
|
|
1090
|
+
declare const GRADE_FINDINGS_PER_RULE = 3;
|
|
1091
|
+
/**
|
|
1092
|
+
* Rule family for the per-rule grade cap.
|
|
1093
|
+
*
|
|
1094
|
+
* Findings group by `rule` (`VC001`), not by the per-line id
|
|
1095
|
+
* (`VC001-src/app.ts:12`). ENTROPY's id is `ENTROPY-<file>:<line>` and its
|
|
1096
|
+
* rule is `ENTROPY`; both collapse to one family so a noisy entropy pass
|
|
1097
|
+
* cannot deduct once per line.
|
|
1098
|
+
*/
|
|
1099
|
+
declare function gradeRuleFamily(finding: {
|
|
1100
|
+
rule?: string;
|
|
1101
|
+
id?: string;
|
|
1102
|
+
}): string;
|
|
1081
1103
|
declare function calculateGrade(findings: Finding[], _totalFiles: number, options?: GradeOptions): GradeResult;
|
|
1082
1104
|
declare const complianceMap: Record<string, {
|
|
1083
1105
|
owasp: string;
|
|
@@ -1157,8 +1179,11 @@ interface AIFilterResult {
|
|
|
1157
1179
|
*
|
|
1158
1180
|
* Returns filtered findings, the removed findings with AI reasons,
|
|
1159
1181
|
* and metadata about what the AI did.
|
|
1182
|
+
*
|
|
1183
|
+
* @param budgetMs - Overall deadline (milliseconds). When expired, return
|
|
1184
|
+
* unreviewed findings with aiReviewed: false. Defaults to AI_FILTER_BUDGET_MS.
|
|
1160
1185
|
*/
|
|
1161
|
-
declare function filterFalsePositives(findings: Finding[], fileContents: Map<string, string
|
|
1186
|
+
declare function filterFalsePositives(findings: Finding[], fileContents: Map<string, string>, budgetMs?: number): Promise<AIFilterResult>;
|
|
1162
1187
|
|
|
1163
1188
|
/**
|
|
1164
1189
|
* Shannon-entropy based secret detection.
|
|
@@ -1203,6 +1228,40 @@ declare function scanEntropy(files: {
|
|
|
1203
1228
|
content: string;
|
|
1204
1229
|
}[]): Finding[];
|
|
1205
1230
|
|
|
1231
|
+
/**
|
|
1232
|
+
* Dependency Vulnerability Scanner
|
|
1233
|
+
* Parses package.json, requirements.txt, Gemfile, etc. and checks
|
|
1234
|
+
* for known vulnerable packages and risky dependency patterns.
|
|
1235
|
+
*/
|
|
1236
|
+
|
|
1237
|
+
declare function scanDependencies(files: {
|
|
1238
|
+
path: string;
|
|
1239
|
+
content: string;
|
|
1240
|
+
}[]): Finding[];
|
|
1241
|
+
|
|
1242
|
+
/**
|
|
1243
|
+
* Configuration File Deep Analyzer
|
|
1244
|
+
* Analyzes tsconfig, next.config, Dockerfile, GitHub Actions,
|
|
1245
|
+
* and other config files for security misconfigurations.
|
|
1246
|
+
*/
|
|
1247
|
+
|
|
1248
|
+
declare function scanConfigs(files: {
|
|
1249
|
+
path: string;
|
|
1250
|
+
content: string;
|
|
1251
|
+
}[]): Finding[];
|
|
1252
|
+
|
|
1253
|
+
/**
|
|
1254
|
+
* Multi-File Analysis Scanner
|
|
1255
|
+
* Analyzes relationships between files to detect cross-file vulnerabilities
|
|
1256
|
+
* that single-file scanners miss.
|
|
1257
|
+
*/
|
|
1258
|
+
|
|
1259
|
+
interface FileInfo {
|
|
1260
|
+
path: string;
|
|
1261
|
+
content: string;
|
|
1262
|
+
}
|
|
1263
|
+
declare function scanMultiFile(files: FileInfo[]): Finding[];
|
|
1264
|
+
|
|
1206
1265
|
/**
|
|
1207
1266
|
* URL recon — what can be learned about a deployed app from what it already
|
|
1208
1267
|
* serves the public.
|
|
@@ -1497,4 +1556,4 @@ input: {
|
|
|
1497
1556
|
content: string;
|
|
1498
1557
|
}[] | QualityContext, rules?: QualityRule[]): Finding[];
|
|
1499
1558
|
|
|
1500
|
-
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, 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, type SecurityGrade, type Severity, TEST_FILE_PATTERN, TOTAL_RULE_COUNT, type TaintMap, type TargetCheck, type VibePlatform, allRules, assessHeaders, astMatch, buildProjectContext, buildQualityContext, buildTaintMap, calculateGrade, callSpreads, checkIntent, classifyExposure, classifyPublicEnvVar, classifyStatement, clientSideAuth, complianceMap, consoleLogProduction, corsWildcard, dangerousInnerHTML, detectBuilder, detectExposedConfig, detectFramework, detectPlatform, disabledTLSVerification, dotenvValue, emptyCatchBlock, enclosingHandler, envNotGitignored, evalUsage, exposedAuthSecret, exposedDebugMode, exposedEnvFile, exposedStackTraces, extractRoutes, extractScriptUrls, filterFalsePositives, filterSilenced, findMatches, findMatchesAt, findSourceMapRefs, freeRules, getObjectProperty, getSnippet, hardcodedJWTSecret, hardcodedSecrets, harvestIntent, insecureCookies, insecureRandomness, isCalleeNamed, isClientTarget, isCommentLine, isDotenvPath, isInlineSilenced, isInsideFixMessage, isLineSilenced, isMethodCall, isPrivateAddress, isServerSideFile, isServerTarget, isTestFile, isVendoredFinding, isVendoredPath, lineNumberAt, lineTextAt, maskComments, maskOutboundAuthNoise, missingAuthMiddleware, missingCSP, missingErrorBoundary, missingHTTPS, missingLockFile, nextPublicSecret, noRateLimiting, normalizeScanPath, parseFile, parseScanTarget, parseSupabaseConfig, qualityRules, replaceBlockComments, routeForFile, runCustomRules, scanEntropy, scanQuality, sqlInjection, stripeWebhookUnprotected, supabaseFunctionName, supabaseNoRLS, todoLeftInCode, tryParse, unmeasuredQualityRules, unvalidatedRedirect, vendoredReason, visitBinary, visitCalls, weakHashing, xssVulnerability };
|
|
1559
|
+
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, type SecurityGrade, type Severity, TEST_FILE_PATTERN, TOTAL_RULE_COUNT, type TaintMap, type TargetCheck, type VibePlatform, allRules, assessHeaders, astMatch, buildProjectContext, buildQualityContext, buildTaintMap, calculateGrade, callSpreads, checkIntent, classifyExposure, classifyPublicEnvVar, classifyStatement, clientSideAuth, complianceMap, consoleLogProduction, corsWildcard, dangerousInnerHTML, 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, isMethodCall, isPrivateAddress, isServerSideFile, isServerTarget, isTestFile, isVendoredFinding, isVendoredPath, lineNumberAt, lineTextAt, maskComments, maskOutboundAuthNoise, missingAuthMiddleware, missingCSP, missingErrorBoundary, missingHTTPS, missingLockFile, nextPublicSecret, noRateLimiting, normalizeScanPath, 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
|
@@ -1078,6 +1078,28 @@ interface GradeOptions {
|
|
|
1078
1078
|
*/
|
|
1079
1079
|
gradeVendored?: boolean;
|
|
1080
1080
|
}
|
|
1081
|
+
/**
|
|
1082
|
+
* How many findings of one rule count toward point deductions and toward the
|
|
1083
|
+
* severity caps. The 4th and later stay in the report and deduct nothing more,
|
|
1084
|
+
* so one noisy rule cannot floor the score at 0.
|
|
1085
|
+
*
|
|
1086
|
+
* Three is the existing "≥3 high → max D" threshold: a rule that really does
|
|
1087
|
+
* have three highs still caps the letter at D, and further copies of that
|
|
1088
|
+
* same rule do not also zero the numeric score.
|
|
1089
|
+
*/
|
|
1090
|
+
declare const GRADE_FINDINGS_PER_RULE = 3;
|
|
1091
|
+
/**
|
|
1092
|
+
* Rule family for the per-rule grade cap.
|
|
1093
|
+
*
|
|
1094
|
+
* Findings group by `rule` (`VC001`), not by the per-line id
|
|
1095
|
+
* (`VC001-src/app.ts:12`). ENTROPY's id is `ENTROPY-<file>:<line>` and its
|
|
1096
|
+
* rule is `ENTROPY`; both collapse to one family so a noisy entropy pass
|
|
1097
|
+
* cannot deduct once per line.
|
|
1098
|
+
*/
|
|
1099
|
+
declare function gradeRuleFamily(finding: {
|
|
1100
|
+
rule?: string;
|
|
1101
|
+
id?: string;
|
|
1102
|
+
}): string;
|
|
1081
1103
|
declare function calculateGrade(findings: Finding[], _totalFiles: number, options?: GradeOptions): GradeResult;
|
|
1082
1104
|
declare const complianceMap: Record<string, {
|
|
1083
1105
|
owasp: string;
|
|
@@ -1157,8 +1179,11 @@ interface AIFilterResult {
|
|
|
1157
1179
|
*
|
|
1158
1180
|
* Returns filtered findings, the removed findings with AI reasons,
|
|
1159
1181
|
* and metadata about what the AI did.
|
|
1182
|
+
*
|
|
1183
|
+
* @param budgetMs - Overall deadline (milliseconds). When expired, return
|
|
1184
|
+
* unreviewed findings with aiReviewed: false. Defaults to AI_FILTER_BUDGET_MS.
|
|
1160
1185
|
*/
|
|
1161
|
-
declare function filterFalsePositives(findings: Finding[], fileContents: Map<string, string
|
|
1186
|
+
declare function filterFalsePositives(findings: Finding[], fileContents: Map<string, string>, budgetMs?: number): Promise<AIFilterResult>;
|
|
1162
1187
|
|
|
1163
1188
|
/**
|
|
1164
1189
|
* Shannon-entropy based secret detection.
|
|
@@ -1203,6 +1228,40 @@ declare function scanEntropy(files: {
|
|
|
1203
1228
|
content: string;
|
|
1204
1229
|
}[]): Finding[];
|
|
1205
1230
|
|
|
1231
|
+
/**
|
|
1232
|
+
* Dependency Vulnerability Scanner
|
|
1233
|
+
* Parses package.json, requirements.txt, Gemfile, etc. and checks
|
|
1234
|
+
* for known vulnerable packages and risky dependency patterns.
|
|
1235
|
+
*/
|
|
1236
|
+
|
|
1237
|
+
declare function scanDependencies(files: {
|
|
1238
|
+
path: string;
|
|
1239
|
+
content: string;
|
|
1240
|
+
}[]): Finding[];
|
|
1241
|
+
|
|
1242
|
+
/**
|
|
1243
|
+
* Configuration File Deep Analyzer
|
|
1244
|
+
* Analyzes tsconfig, next.config, Dockerfile, GitHub Actions,
|
|
1245
|
+
* and other config files for security misconfigurations.
|
|
1246
|
+
*/
|
|
1247
|
+
|
|
1248
|
+
declare function scanConfigs(files: {
|
|
1249
|
+
path: string;
|
|
1250
|
+
content: string;
|
|
1251
|
+
}[]): Finding[];
|
|
1252
|
+
|
|
1253
|
+
/**
|
|
1254
|
+
* Multi-File Analysis Scanner
|
|
1255
|
+
* Analyzes relationships between files to detect cross-file vulnerabilities
|
|
1256
|
+
* that single-file scanners miss.
|
|
1257
|
+
*/
|
|
1258
|
+
|
|
1259
|
+
interface FileInfo {
|
|
1260
|
+
path: string;
|
|
1261
|
+
content: string;
|
|
1262
|
+
}
|
|
1263
|
+
declare function scanMultiFile(files: FileInfo[]): Finding[];
|
|
1264
|
+
|
|
1206
1265
|
/**
|
|
1207
1266
|
* URL recon — what can be learned about a deployed app from what it already
|
|
1208
1267
|
* serves the public.
|
|
@@ -1497,4 +1556,4 @@ input: {
|
|
|
1497
1556
|
content: string;
|
|
1498
1557
|
}[] | QualityContext, rules?: QualityRule[]): Finding[];
|
|
1499
1558
|
|
|
1500
|
-
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, 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, type SecurityGrade, type Severity, TEST_FILE_PATTERN, TOTAL_RULE_COUNT, type TaintMap, type TargetCheck, type VibePlatform, allRules, assessHeaders, astMatch, buildProjectContext, buildQualityContext, buildTaintMap, calculateGrade, callSpreads, checkIntent, classifyExposure, classifyPublicEnvVar, classifyStatement, clientSideAuth, complianceMap, consoleLogProduction, corsWildcard, dangerousInnerHTML, detectBuilder, detectExposedConfig, detectFramework, detectPlatform, disabledTLSVerification, dotenvValue, emptyCatchBlock, enclosingHandler, envNotGitignored, evalUsage, exposedAuthSecret, exposedDebugMode, exposedEnvFile, exposedStackTraces, extractRoutes, extractScriptUrls, filterFalsePositives, filterSilenced, findMatches, findMatchesAt, findSourceMapRefs, freeRules, getObjectProperty, getSnippet, hardcodedJWTSecret, hardcodedSecrets, harvestIntent, insecureCookies, insecureRandomness, isCalleeNamed, isClientTarget, isCommentLine, isDotenvPath, isInlineSilenced, isInsideFixMessage, isLineSilenced, isMethodCall, isPrivateAddress, isServerSideFile, isServerTarget, isTestFile, isVendoredFinding, isVendoredPath, lineNumberAt, lineTextAt, maskComments, maskOutboundAuthNoise, missingAuthMiddleware, missingCSP, missingErrorBoundary, missingHTTPS, missingLockFile, nextPublicSecret, noRateLimiting, normalizeScanPath, parseFile, parseScanTarget, parseSupabaseConfig, qualityRules, replaceBlockComments, routeForFile, runCustomRules, scanEntropy, scanQuality, sqlInjection, stripeWebhookUnprotected, supabaseFunctionName, supabaseNoRLS, todoLeftInCode, tryParse, unmeasuredQualityRules, unvalidatedRedirect, vendoredReason, visitBinary, visitCalls, weakHashing, xssVulnerability };
|
|
1559
|
+
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, type SecurityGrade, type Severity, TEST_FILE_PATTERN, TOTAL_RULE_COUNT, type TaintMap, type TargetCheck, type VibePlatform, allRules, assessHeaders, astMatch, buildProjectContext, buildQualityContext, buildTaintMap, calculateGrade, callSpreads, checkIntent, classifyExposure, classifyPublicEnvVar, classifyStatement, clientSideAuth, complianceMap, consoleLogProduction, corsWildcard, dangerousInnerHTML, 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, isMethodCall, isPrivateAddress, isServerSideFile, isServerTarget, isTestFile, isVendoredFinding, isVendoredPath, lineNumberAt, lineTextAt, maskComments, maskOutboundAuthNoise, missingAuthMiddleware, missingCSP, missingErrorBoundary, missingHTTPS, missingLockFile, nextPublicSecret, noRateLimiting, normalizeScanPath, 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 };
|