xploitscan-shared-rules 2.4.6 → 2.4.9
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 +264 -59
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +34 -10
- package/dist/index.d.ts +34 -10
- package/dist/index.js +262 -59
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -153,6 +153,15 @@ interface CustomRule {
|
|
|
153
153
|
check: (content: string, filePath: string, project?: ProjectContext) => RuleMatch[];
|
|
154
154
|
}
|
|
155
155
|
|
|
156
|
+
/**
|
|
157
|
+
* Detection-engine version persisted with scan history.
|
|
158
|
+
*
|
|
159
|
+
* Keep this equal to package.json. The version test makes a missed bump fail
|
|
160
|
+
* before a scan can be saved without enough provenance to explain a changed
|
|
161
|
+
* grade.
|
|
162
|
+
*/
|
|
163
|
+
declare const SCANNER_VERSION = "2.4.9";
|
|
164
|
+
|
|
156
165
|
/**
|
|
157
166
|
* Line-oriented helpers shared by every rule. Pure string manipulation — no fs
|
|
158
167
|
* dependency — so safe in the CLI and in serverless/edge environments.
|
|
@@ -180,6 +189,16 @@ declare function lineNumberAt(content: string, index: number): number;
|
|
|
180
189
|
*/
|
|
181
190
|
declare function getSnippet(content: string, line: number, contextLines?: number): string;
|
|
182
191
|
|
|
192
|
+
/**
|
|
193
|
+
* Remove repeated reports of the same finding while preserving distinct
|
|
194
|
+
* problems that happen to share a line.
|
|
195
|
+
*
|
|
196
|
+
* Multiple engines can surface the same custom-rule match, and some rules use
|
|
197
|
+
* overlapping patterns. The title remains part of the key because one rule
|
|
198
|
+
* may intentionally report two different problems at one location.
|
|
199
|
+
*/
|
|
200
|
+
declare function deduplicateFindings<T extends Finding>(findings: readonly T[]): T[];
|
|
201
|
+
|
|
183
202
|
/**
|
|
184
203
|
* Inline finding suppression — the `// VC###-OK: <reason>` marker.
|
|
185
204
|
*
|
|
@@ -520,7 +539,8 @@ declare function isSbomPath(filePath: string): boolean;
|
|
|
520
539
|
*
|
|
521
540
|
* Formats: `AKIA`/`ABIA`/`ACCA`/`ASIA` plus exactly 16 letters or digits
|
|
522
541
|
* (20 characters, not inside a longer letter-or-digit run; not a key ending in EXAMPLE),
|
|
523
|
-
* `sk_live_
|
|
542
|
+
* `sk_live_` / `rk_live_` with a detector-length body, an OpenAI key
|
|
543
|
+
* (`T3BlbkFJ`), an OpenRouter key
|
|
524
544
|
* (`sk-or-v1-`), `ghp_` and `github_pat_`, a Slack `xox*` token, `AIza`,
|
|
525
545
|
* an Anthropic `sk-ant-api03-` key, SendGrid `SG.`, and a Hugging Face
|
|
526
546
|
* `hf_` token.
|
|
@@ -1248,18 +1268,22 @@ interface FilteredFinding {
|
|
|
1248
1268
|
interface AIFilterResult {
|
|
1249
1269
|
findings: Finding[];
|
|
1250
1270
|
filteredFindings: FilteredFinding[];
|
|
1271
|
+
/** Reviewed findings that the model called FP but the host retained. */
|
|
1272
|
+
policyRetainedFindings: FilteredFinding[];
|
|
1251
1273
|
aiReviewed: boolean;
|
|
1252
1274
|
removedCount: number;
|
|
1275
|
+
policyRetainedCount: number;
|
|
1253
1276
|
totalBefore: number;
|
|
1254
|
-
/**
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
* 0 on a full review. Lets the UI honestly say "partially reviewed"
|
|
1258
|
-
* instead of labeling unreviewed findings as AI-verified. Does NOT count
|
|
1259
|
-
* findings skipped by the MAX_TOTAL_FINDINGS cap — that's by design, not
|
|
1260
|
-
* a failure.
|
|
1261
|
-
*/
|
|
1277
|
+
/** Number of findings with one valid, uniquely indexed model verdict. */
|
|
1278
|
+
reviewedCount: number;
|
|
1279
|
+
/** Every finding without a valid verdict, whatever the reason. */
|
|
1262
1280
|
unreviewedCount: number;
|
|
1281
|
+
/** Findings intentionally left outside the configured AI review cap. */
|
|
1282
|
+
cappedCount: number;
|
|
1283
|
+
/** Findings that could not be reviewed because their source was unavailable. */
|
|
1284
|
+
missingContentCount: number;
|
|
1285
|
+
/** True only when the deadline or an individual model-call timeout elapsed. */
|
|
1286
|
+
timedOut: boolean;
|
|
1263
1287
|
}
|
|
1264
1288
|
/**
|
|
1265
1289
|
* Findings the AI must never delete. Criticals and live/Secrets stay reported
|
|
@@ -1660,4 +1684,4 @@ input: {
|
|
|
1660
1684
|
content: string;
|
|
1661
1685
|
}[] | QualityContext, rules?: QualityRule[]): Finding[];
|
|
1662
1686
|
|
|
1663
|
-
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, buildReviewPrompt, 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, 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 };
|
|
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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -153,6 +153,15 @@ interface CustomRule {
|
|
|
153
153
|
check: (content: string, filePath: string, project?: ProjectContext) => RuleMatch[];
|
|
154
154
|
}
|
|
155
155
|
|
|
156
|
+
/**
|
|
157
|
+
* Detection-engine version persisted with scan history.
|
|
158
|
+
*
|
|
159
|
+
* Keep this equal to package.json. The version test makes a missed bump fail
|
|
160
|
+
* before a scan can be saved without enough provenance to explain a changed
|
|
161
|
+
* grade.
|
|
162
|
+
*/
|
|
163
|
+
declare const SCANNER_VERSION = "2.4.9";
|
|
164
|
+
|
|
156
165
|
/**
|
|
157
166
|
* Line-oriented helpers shared by every rule. Pure string manipulation — no fs
|
|
158
167
|
* dependency — so safe in the CLI and in serverless/edge environments.
|
|
@@ -180,6 +189,16 @@ declare function lineNumberAt(content: string, index: number): number;
|
|
|
180
189
|
*/
|
|
181
190
|
declare function getSnippet(content: string, line: number, contextLines?: number): string;
|
|
182
191
|
|
|
192
|
+
/**
|
|
193
|
+
* Remove repeated reports of the same finding while preserving distinct
|
|
194
|
+
* problems that happen to share a line.
|
|
195
|
+
*
|
|
196
|
+
* Multiple engines can surface the same custom-rule match, and some rules use
|
|
197
|
+
* overlapping patterns. The title remains part of the key because one rule
|
|
198
|
+
* may intentionally report two different problems at one location.
|
|
199
|
+
*/
|
|
200
|
+
declare function deduplicateFindings<T extends Finding>(findings: readonly T[]): T[];
|
|
201
|
+
|
|
183
202
|
/**
|
|
184
203
|
* Inline finding suppression — the `// VC###-OK: <reason>` marker.
|
|
185
204
|
*
|
|
@@ -520,7 +539,8 @@ declare function isSbomPath(filePath: string): boolean;
|
|
|
520
539
|
*
|
|
521
540
|
* Formats: `AKIA`/`ABIA`/`ACCA`/`ASIA` plus exactly 16 letters or digits
|
|
522
541
|
* (20 characters, not inside a longer letter-or-digit run; not a key ending in EXAMPLE),
|
|
523
|
-
* `sk_live_
|
|
542
|
+
* `sk_live_` / `rk_live_` with a detector-length body, an OpenAI key
|
|
543
|
+
* (`T3BlbkFJ`), an OpenRouter key
|
|
524
544
|
* (`sk-or-v1-`), `ghp_` and `github_pat_`, a Slack `xox*` token, `AIza`,
|
|
525
545
|
* an Anthropic `sk-ant-api03-` key, SendGrid `SG.`, and a Hugging Face
|
|
526
546
|
* `hf_` token.
|
|
@@ -1248,18 +1268,22 @@ interface FilteredFinding {
|
|
|
1248
1268
|
interface AIFilterResult {
|
|
1249
1269
|
findings: Finding[];
|
|
1250
1270
|
filteredFindings: FilteredFinding[];
|
|
1271
|
+
/** Reviewed findings that the model called FP but the host retained. */
|
|
1272
|
+
policyRetainedFindings: FilteredFinding[];
|
|
1251
1273
|
aiReviewed: boolean;
|
|
1252
1274
|
removedCount: number;
|
|
1275
|
+
policyRetainedCount: number;
|
|
1253
1276
|
totalBefore: number;
|
|
1254
|
-
/**
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
* 0 on a full review. Lets the UI honestly say "partially reviewed"
|
|
1258
|
-
* instead of labeling unreviewed findings as AI-verified. Does NOT count
|
|
1259
|
-
* findings skipped by the MAX_TOTAL_FINDINGS cap — that's by design, not
|
|
1260
|
-
* a failure.
|
|
1261
|
-
*/
|
|
1277
|
+
/** Number of findings with one valid, uniquely indexed model verdict. */
|
|
1278
|
+
reviewedCount: number;
|
|
1279
|
+
/** Every finding without a valid verdict, whatever the reason. */
|
|
1262
1280
|
unreviewedCount: number;
|
|
1281
|
+
/** Findings intentionally left outside the configured AI review cap. */
|
|
1282
|
+
cappedCount: number;
|
|
1283
|
+
/** Findings that could not be reviewed because their source was unavailable. */
|
|
1284
|
+
missingContentCount: number;
|
|
1285
|
+
/** True only when the deadline or an individual model-call timeout elapsed. */
|
|
1286
|
+
timedOut: boolean;
|
|
1263
1287
|
}
|
|
1264
1288
|
/**
|
|
1265
1289
|
* Findings the AI must never delete. Criticals and live/Secrets stay reported
|
|
@@ -1660,4 +1684,4 @@ input: {
|
|
|
1660
1684
|
content: string;
|
|
1661
1685
|
}[] | QualityContext, rules?: QualityRule[]): Finding[];
|
|
1662
1686
|
|
|
1663
|
-
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, buildReviewPrompt, 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, 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 };
|
|
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 };
|