xploitscan-shared-rules 2.4.19 → 2.4.21
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/ai-status-constants.cjs +99 -0
- package/dist/ai-status-constants.cjs.map +1 -0
- package/dist/ai-status-constants.d.cts +12 -0
- package/dist/ai-status-constants.d.ts +12 -0
- package/dist/ai-status-constants.js +69 -0
- package/dist/ai-status-constants.js.map +1 -0
- package/dist/index.cjs +821 -82
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +97 -3
- package/dist/index.d.ts +97 -3
- package/dist/index.js +801 -82
- package/dist/index.js.map +1 -1
- package/package.json +6 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { ParseResult } from '@babel/parser';
|
|
2
2
|
import { File, Node, CallExpression, ObjectExpression, BinaryExpression } from '@babel/types';
|
|
3
|
+
import { AiStatus, AiReason, AiSurface, PlanCause } from './ai-status-constants.cjs';
|
|
4
|
+
export { AI_REASONS, AI_STATUSES, AI_SURFACES, PLAN_CAUSES, WEBHOOK_EVENT_TYPES, WEBHOOK_REASONS } from './ai-status-constants.cjs';
|
|
3
5
|
|
|
4
6
|
/**
|
|
5
7
|
* Cross-file facts a rule cannot learn from the file it is scanning.
|
|
@@ -165,7 +167,7 @@ interface CustomRule {
|
|
|
165
167
|
* before a scan can be saved without enough provenance to explain a changed
|
|
166
168
|
* grade.
|
|
167
169
|
*/
|
|
168
|
-
declare const SCANNER_VERSION = "2.4.
|
|
170
|
+
declare const SCANNER_VERSION = "2.4.21";
|
|
169
171
|
|
|
170
172
|
/**
|
|
171
173
|
* Line-oriented helpers shared by every rule. Pure string manipulation — no fs
|
|
@@ -579,6 +581,16 @@ declare function isUngradedFinding(finding: {
|
|
|
579
581
|
}, options?: {
|
|
580
582
|
gradeVendored?: boolean;
|
|
581
583
|
}): boolean;
|
|
584
|
+
/**
|
|
585
|
+
* Reported severity for one finding.
|
|
586
|
+
*
|
|
587
|
+
* A non-live VC001 match in a test path (`testFile === true`, stamped only
|
|
588
|
+
* when `isTestPath` holds and `isLive` does not) is emitted at low. Every
|
|
589
|
+
* other rule, a live key, and a finding whose `testFile` flag is unset or
|
|
590
|
+
* false keeps the severity it was given. Callers pass `testFile` after that
|
|
591
|
+
* stamp, so "low" and the not-graded label stay on the same findings.
|
|
592
|
+
*/
|
|
593
|
+
declare function vc001TestFixtureSeverity<S extends string>(rule: string | undefined, testFile: boolean | undefined, severity: S): S | "low";
|
|
582
594
|
|
|
583
595
|
/**
|
|
584
596
|
* Route-table extraction — what URL, if any, reaches a given source file.
|
|
@@ -1277,6 +1289,84 @@ declare const PRO_RULE_COUNT = 193;
|
|
|
1277
1289
|
/** The full catalog. FREE_RULE_COUNT + PRO_RULE_COUNT, asserted in the test. */
|
|
1278
1290
|
declare const TOTAL_RULE_COUNT = 223;
|
|
1279
1291
|
|
|
1292
|
+
/**
|
|
1293
|
+
* One AiDegraded value for every scan surface.
|
|
1294
|
+
* Surfaces import toAiDegraded / aiStatusLine / bucketFiles. They do not
|
|
1295
|
+
* write their own status sentence.
|
|
1296
|
+
*
|
|
1297
|
+
* CLI default budget (stated for the PR): 30_000 ms. The API keeps the
|
|
1298
|
+
* serverless default of 8_000 ms. Per-call timeout is
|
|
1299
|
+
* min(PER_CALL_TIMEOUT_MS, floor(budget * 0.6)) and is always strictly
|
|
1300
|
+
* below the budget (see ai-fp-filter.ts).
|
|
1301
|
+
*
|
|
1302
|
+
* Migration 0064 is forward-only: migrate.ts has no down step. Re-adding
|
|
1303
|
+
* the column is a no-op via the existing duplicate-column tolerance.
|
|
1304
|
+
* NULL ai_status_json reads as { status: "unknown", reason: null }.
|
|
1305
|
+
*/
|
|
1306
|
+
|
|
1307
|
+
interface AiDegraded {
|
|
1308
|
+
status: AiStatus;
|
|
1309
|
+
reason: AiReason | null;
|
|
1310
|
+
surface: AiSurface;
|
|
1311
|
+
total: number;
|
|
1312
|
+
reviewed: number;
|
|
1313
|
+
unreviewed: number;
|
|
1314
|
+
capped: number;
|
|
1315
|
+
/** Set only for reason model_error, so 429 / 529 / 500 stay distinct. */
|
|
1316
|
+
modelStatus: number | null;
|
|
1317
|
+
}
|
|
1318
|
+
/** Visible copy when a paid plan was expected and could not be verified. */
|
|
1319
|
+
declare const PLAN_UNVERIFIED_NOTICE = "Couldn't verify your plan, scanned with free rules only.";
|
|
1320
|
+
declare const FILE_BUCKETS: readonly ["0", "1-4", "5-19", "20+"];
|
|
1321
|
+
type FileBucket = (typeof FILE_BUCKETS)[number];
|
|
1322
|
+
declare function bucketFiles(n: unknown): FileBucket;
|
|
1323
|
+
/**
|
|
1324
|
+
* Collapse a specific verifier/download failure onto the stored cause enum.
|
|
1325
|
+
* The specific name stays on rulesStatus.specific for the per-cause tests.
|
|
1326
|
+
*/
|
|
1327
|
+
declare function planCause(specific: string): PlanCause;
|
|
1328
|
+
interface ToAiDegradedInput {
|
|
1329
|
+
status?: unknown;
|
|
1330
|
+
reason?: unknown;
|
|
1331
|
+
surface?: unknown;
|
|
1332
|
+
total?: unknown;
|
|
1333
|
+
reviewed?: unknown;
|
|
1334
|
+
unreviewed?: unknown;
|
|
1335
|
+
capped?: unknown;
|
|
1336
|
+
modelStatus?: unknown;
|
|
1337
|
+
}
|
|
1338
|
+
/** Build a status object. reviewed + unreviewed + capped === total always. */
|
|
1339
|
+
declare function toAiDegraded(input?: ToAiDegradedInput): AiDegraded;
|
|
1340
|
+
/** NULL stored JSON and a missing field both read as unknown. */
|
|
1341
|
+
declare function unknownAiStatus(surface?: AiSurface): AiDegraded;
|
|
1342
|
+
/** The one plain sentence every surface prints. */
|
|
1343
|
+
declare function aiStatusLine(d: AiDegraded): string;
|
|
1344
|
+
/** Event props for scan_ai_degraded. Exact key set, nothing else. */
|
|
1345
|
+
declare const SCAN_AI_DEGRADED_KEYS: readonly ["status", "reason", "surface", "total", "reviewed", "capped", "files_received_bucket"];
|
|
1346
|
+
declare function scanAiDegradedProps(d: AiDegraded, filesReceived: unknown): Record<(typeof SCAN_AI_DEGRADED_KEYS)[number], string | number | null>;
|
|
1347
|
+
declare const SCAN_TOKEN_NULL_KEYS: readonly ["cause", "surface", "tier_expected"];
|
|
1348
|
+
declare function scanTokenNullProps(cause: PlanCause, surface: string): {
|
|
1349
|
+
cause: PlanCause;
|
|
1350
|
+
surface: string;
|
|
1351
|
+
tier_expected: "paid";
|
|
1352
|
+
};
|
|
1353
|
+
declare const BILLING_WEBHOOK_UNMATCHED_KEYS: readonly ["type", "reason", "final"];
|
|
1354
|
+
declare function billingWebhookUnmatchedProps(input: {
|
|
1355
|
+
type?: unknown;
|
|
1356
|
+
reason?: unknown;
|
|
1357
|
+
final?: unknown;
|
|
1358
|
+
}): {
|
|
1359
|
+
type: string;
|
|
1360
|
+
reason: string;
|
|
1361
|
+
final: boolean;
|
|
1362
|
+
};
|
|
1363
|
+
|
|
1364
|
+
/**
|
|
1365
|
+
* Per-call timeout is strictly below the overall budget for the default
|
|
1366
|
+
* (8000) and every legal clamp (1..60000). floor(budget * 0.6) is at most
|
|
1367
|
+
* budget - 1 when budget >= 1, and the 8000 cap is below any budget above it.
|
|
1368
|
+
*/
|
|
1369
|
+
declare function perCallTimeoutMs(budgetMs: number): number;
|
|
1280
1370
|
interface FilteredFinding {
|
|
1281
1371
|
finding: Finding;
|
|
1282
1372
|
reason: string;
|
|
@@ -1318,6 +1408,8 @@ interface AIFilterResult {
|
|
|
1318
1408
|
timedOut: boolean;
|
|
1319
1409
|
/** #945 proof. Logged by the API as the fixed-shape ai_fp_mask line only. */
|
|
1320
1410
|
maskStats: MaskStats;
|
|
1411
|
+
/** Present on every return, including the early exits. */
|
|
1412
|
+
aiDegraded: AiDegraded;
|
|
1321
1413
|
}
|
|
1322
1414
|
/**
|
|
1323
1415
|
* Findings the AI must never delete. Criticals and live/Secrets stay reported
|
|
@@ -1345,7 +1437,9 @@ declare function packReviewBatches(fileFindings: Finding[], content: string): Fi
|
|
|
1345
1437
|
* @param budgetMs - Overall deadline (milliseconds). When expired, return
|
|
1346
1438
|
* unreviewed findings with aiReviewed: false. Defaults to AI_FILTER_BUDGET_MS.
|
|
1347
1439
|
*/
|
|
1348
|
-
declare function filterFalsePositives(findings: Finding[], fileContents: Map<string, string>, budgetMs?: number
|
|
1440
|
+
declare function filterFalsePositives(findings: Finding[], fileContents: Map<string, string>, budgetMs?: number, options?: {
|
|
1441
|
+
surface?: AiSurface;
|
|
1442
|
+
}): Promise<AIFilterResult>;
|
|
1349
1443
|
|
|
1350
1444
|
/**
|
|
1351
1445
|
* Shannon-entropy based secret detection.
|
|
@@ -1728,4 +1822,4 @@ input: {
|
|
|
1728
1822
|
content: string;
|
|
1729
1823
|
}[] | QualityContext, rules?: QualityRule[]): Finding[];
|
|
1730
1824
|
|
|
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 };
|
|
1825
|
+
export { type AIFilterResult, type AiDegraded, AiReason, AiStatus, AiSurface, type AppRoute, BILLING_WEBHOOK_UNMATCHED_KEYS, 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, PLAN_UNVERIFIED_NOTICE, PRO_RULE_COUNT, PUBLIC_ENV_PREFIX_RE, type ParsedFile, PlanCause, type ProjectContext, QUALITY_EXAMPLES, type QualityContext, type QualityExample, type QualityFile, type QualityHit, type QualityRule, RULE_IMPACTS, type RouteFramework, type RouteTable, type RuleMatch, SCANNER_VERSION, SCAN_AI_DEGRADED_KEYS, SCAN_TOKEN_NULL_KEYS, SERVER_ACTION_WRITE_RE, type SecurityGrade, type Severity, TEST_FILE_PATTERN, TOTAL_RULE_COUNT, type TaintMap, type TargetCheck, type VibePlatform, aiStatusLine, allRules, assessHeaders, astMatch, billingWebhookUnmatchedProps, bucketFiles, 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, perCallTimeoutMs, planCause, qualityRules, replaceBlockComments, routeForFile, runCustomRules, scanAiDegradedProps, scanConfigs, scanDependencies, scanEntropy, scanMultiFile, scanQuality, scanTokenNullProps, sqlInjection, stripeWebhookUnprotected, supabaseFunctionName, supabaseNoRLS, toAiDegraded, todoLeftInCode, tryParse, unknownAiStatus, unmeasuredQualityRules, unvalidatedRedirect, vc001TestFixtureSeverity, vendoredReason, visitBinary, visitCalls, weakHashing, xssVulnerability };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { ParseResult } from '@babel/parser';
|
|
2
2
|
import { File, Node, CallExpression, ObjectExpression, BinaryExpression } from '@babel/types';
|
|
3
|
+
import { AiStatus, AiReason, AiSurface, PlanCause } from './ai-status-constants.js';
|
|
4
|
+
export { AI_REASONS, AI_STATUSES, AI_SURFACES, PLAN_CAUSES, WEBHOOK_EVENT_TYPES, WEBHOOK_REASONS } from './ai-status-constants.js';
|
|
3
5
|
|
|
4
6
|
/**
|
|
5
7
|
* Cross-file facts a rule cannot learn from the file it is scanning.
|
|
@@ -165,7 +167,7 @@ interface CustomRule {
|
|
|
165
167
|
* before a scan can be saved without enough provenance to explain a changed
|
|
166
168
|
* grade.
|
|
167
169
|
*/
|
|
168
|
-
declare const SCANNER_VERSION = "2.4.
|
|
170
|
+
declare const SCANNER_VERSION = "2.4.21";
|
|
169
171
|
|
|
170
172
|
/**
|
|
171
173
|
* Line-oriented helpers shared by every rule. Pure string manipulation — no fs
|
|
@@ -579,6 +581,16 @@ declare function isUngradedFinding(finding: {
|
|
|
579
581
|
}, options?: {
|
|
580
582
|
gradeVendored?: boolean;
|
|
581
583
|
}): boolean;
|
|
584
|
+
/**
|
|
585
|
+
* Reported severity for one finding.
|
|
586
|
+
*
|
|
587
|
+
* A non-live VC001 match in a test path (`testFile === true`, stamped only
|
|
588
|
+
* when `isTestPath` holds and `isLive` does not) is emitted at low. Every
|
|
589
|
+
* other rule, a live key, and a finding whose `testFile` flag is unset or
|
|
590
|
+
* false keeps the severity it was given. Callers pass `testFile` after that
|
|
591
|
+
* stamp, so "low" and the not-graded label stay on the same findings.
|
|
592
|
+
*/
|
|
593
|
+
declare function vc001TestFixtureSeverity<S extends string>(rule: string | undefined, testFile: boolean | undefined, severity: S): S | "low";
|
|
582
594
|
|
|
583
595
|
/**
|
|
584
596
|
* Route-table extraction — what URL, if any, reaches a given source file.
|
|
@@ -1277,6 +1289,84 @@ declare const PRO_RULE_COUNT = 193;
|
|
|
1277
1289
|
/** The full catalog. FREE_RULE_COUNT + PRO_RULE_COUNT, asserted in the test. */
|
|
1278
1290
|
declare const TOTAL_RULE_COUNT = 223;
|
|
1279
1291
|
|
|
1292
|
+
/**
|
|
1293
|
+
* One AiDegraded value for every scan surface.
|
|
1294
|
+
* Surfaces import toAiDegraded / aiStatusLine / bucketFiles. They do not
|
|
1295
|
+
* write their own status sentence.
|
|
1296
|
+
*
|
|
1297
|
+
* CLI default budget (stated for the PR): 30_000 ms. The API keeps the
|
|
1298
|
+
* serverless default of 8_000 ms. Per-call timeout is
|
|
1299
|
+
* min(PER_CALL_TIMEOUT_MS, floor(budget * 0.6)) and is always strictly
|
|
1300
|
+
* below the budget (see ai-fp-filter.ts).
|
|
1301
|
+
*
|
|
1302
|
+
* Migration 0064 is forward-only: migrate.ts has no down step. Re-adding
|
|
1303
|
+
* the column is a no-op via the existing duplicate-column tolerance.
|
|
1304
|
+
* NULL ai_status_json reads as { status: "unknown", reason: null }.
|
|
1305
|
+
*/
|
|
1306
|
+
|
|
1307
|
+
interface AiDegraded {
|
|
1308
|
+
status: AiStatus;
|
|
1309
|
+
reason: AiReason | null;
|
|
1310
|
+
surface: AiSurface;
|
|
1311
|
+
total: number;
|
|
1312
|
+
reviewed: number;
|
|
1313
|
+
unreviewed: number;
|
|
1314
|
+
capped: number;
|
|
1315
|
+
/** Set only for reason model_error, so 429 / 529 / 500 stay distinct. */
|
|
1316
|
+
modelStatus: number | null;
|
|
1317
|
+
}
|
|
1318
|
+
/** Visible copy when a paid plan was expected and could not be verified. */
|
|
1319
|
+
declare const PLAN_UNVERIFIED_NOTICE = "Couldn't verify your plan, scanned with free rules only.";
|
|
1320
|
+
declare const FILE_BUCKETS: readonly ["0", "1-4", "5-19", "20+"];
|
|
1321
|
+
type FileBucket = (typeof FILE_BUCKETS)[number];
|
|
1322
|
+
declare function bucketFiles(n: unknown): FileBucket;
|
|
1323
|
+
/**
|
|
1324
|
+
* Collapse a specific verifier/download failure onto the stored cause enum.
|
|
1325
|
+
* The specific name stays on rulesStatus.specific for the per-cause tests.
|
|
1326
|
+
*/
|
|
1327
|
+
declare function planCause(specific: string): PlanCause;
|
|
1328
|
+
interface ToAiDegradedInput {
|
|
1329
|
+
status?: unknown;
|
|
1330
|
+
reason?: unknown;
|
|
1331
|
+
surface?: unknown;
|
|
1332
|
+
total?: unknown;
|
|
1333
|
+
reviewed?: unknown;
|
|
1334
|
+
unreviewed?: unknown;
|
|
1335
|
+
capped?: unknown;
|
|
1336
|
+
modelStatus?: unknown;
|
|
1337
|
+
}
|
|
1338
|
+
/** Build a status object. reviewed + unreviewed + capped === total always. */
|
|
1339
|
+
declare function toAiDegraded(input?: ToAiDegradedInput): AiDegraded;
|
|
1340
|
+
/** NULL stored JSON and a missing field both read as unknown. */
|
|
1341
|
+
declare function unknownAiStatus(surface?: AiSurface): AiDegraded;
|
|
1342
|
+
/** The one plain sentence every surface prints. */
|
|
1343
|
+
declare function aiStatusLine(d: AiDegraded): string;
|
|
1344
|
+
/** Event props for scan_ai_degraded. Exact key set, nothing else. */
|
|
1345
|
+
declare const SCAN_AI_DEGRADED_KEYS: readonly ["status", "reason", "surface", "total", "reviewed", "capped", "files_received_bucket"];
|
|
1346
|
+
declare function scanAiDegradedProps(d: AiDegraded, filesReceived: unknown): Record<(typeof SCAN_AI_DEGRADED_KEYS)[number], string | number | null>;
|
|
1347
|
+
declare const SCAN_TOKEN_NULL_KEYS: readonly ["cause", "surface", "tier_expected"];
|
|
1348
|
+
declare function scanTokenNullProps(cause: PlanCause, surface: string): {
|
|
1349
|
+
cause: PlanCause;
|
|
1350
|
+
surface: string;
|
|
1351
|
+
tier_expected: "paid";
|
|
1352
|
+
};
|
|
1353
|
+
declare const BILLING_WEBHOOK_UNMATCHED_KEYS: readonly ["type", "reason", "final"];
|
|
1354
|
+
declare function billingWebhookUnmatchedProps(input: {
|
|
1355
|
+
type?: unknown;
|
|
1356
|
+
reason?: unknown;
|
|
1357
|
+
final?: unknown;
|
|
1358
|
+
}): {
|
|
1359
|
+
type: string;
|
|
1360
|
+
reason: string;
|
|
1361
|
+
final: boolean;
|
|
1362
|
+
};
|
|
1363
|
+
|
|
1364
|
+
/**
|
|
1365
|
+
* Per-call timeout is strictly below the overall budget for the default
|
|
1366
|
+
* (8000) and every legal clamp (1..60000). floor(budget * 0.6) is at most
|
|
1367
|
+
* budget - 1 when budget >= 1, and the 8000 cap is below any budget above it.
|
|
1368
|
+
*/
|
|
1369
|
+
declare function perCallTimeoutMs(budgetMs: number): number;
|
|
1280
1370
|
interface FilteredFinding {
|
|
1281
1371
|
finding: Finding;
|
|
1282
1372
|
reason: string;
|
|
@@ -1318,6 +1408,8 @@ interface AIFilterResult {
|
|
|
1318
1408
|
timedOut: boolean;
|
|
1319
1409
|
/** #945 proof. Logged by the API as the fixed-shape ai_fp_mask line only. */
|
|
1320
1410
|
maskStats: MaskStats;
|
|
1411
|
+
/** Present on every return, including the early exits. */
|
|
1412
|
+
aiDegraded: AiDegraded;
|
|
1321
1413
|
}
|
|
1322
1414
|
/**
|
|
1323
1415
|
* Findings the AI must never delete. Criticals and live/Secrets stay reported
|
|
@@ -1345,7 +1437,9 @@ declare function packReviewBatches(fileFindings: Finding[], content: string): Fi
|
|
|
1345
1437
|
* @param budgetMs - Overall deadline (milliseconds). When expired, return
|
|
1346
1438
|
* unreviewed findings with aiReviewed: false. Defaults to AI_FILTER_BUDGET_MS.
|
|
1347
1439
|
*/
|
|
1348
|
-
declare function filterFalsePositives(findings: Finding[], fileContents: Map<string, string>, budgetMs?: number
|
|
1440
|
+
declare function filterFalsePositives(findings: Finding[], fileContents: Map<string, string>, budgetMs?: number, options?: {
|
|
1441
|
+
surface?: AiSurface;
|
|
1442
|
+
}): Promise<AIFilterResult>;
|
|
1349
1443
|
|
|
1350
1444
|
/**
|
|
1351
1445
|
* Shannon-entropy based secret detection.
|
|
@@ -1728,4 +1822,4 @@ input: {
|
|
|
1728
1822
|
content: string;
|
|
1729
1823
|
}[] | QualityContext, rules?: QualityRule[]): Finding[];
|
|
1730
1824
|
|
|
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 };
|
|
1825
|
+
export { type AIFilterResult, type AiDegraded, AiReason, AiStatus, AiSurface, type AppRoute, BILLING_WEBHOOK_UNMATCHED_KEYS, 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, PLAN_UNVERIFIED_NOTICE, PRO_RULE_COUNT, PUBLIC_ENV_PREFIX_RE, type ParsedFile, PlanCause, type ProjectContext, QUALITY_EXAMPLES, type QualityContext, type QualityExample, type QualityFile, type QualityHit, type QualityRule, RULE_IMPACTS, type RouteFramework, type RouteTable, type RuleMatch, SCANNER_VERSION, SCAN_AI_DEGRADED_KEYS, SCAN_TOKEN_NULL_KEYS, SERVER_ACTION_WRITE_RE, type SecurityGrade, type Severity, TEST_FILE_PATTERN, TOTAL_RULE_COUNT, type TaintMap, type TargetCheck, type VibePlatform, aiStatusLine, allRules, assessHeaders, astMatch, billingWebhookUnmatchedProps, bucketFiles, 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, perCallTimeoutMs, planCause, qualityRules, replaceBlockComments, routeForFile, runCustomRules, scanAiDegradedProps, scanConfigs, scanDependencies, scanEntropy, scanMultiFile, scanQuality, scanTokenNullProps, sqlInjection, stripeWebhookUnprotected, supabaseFunctionName, supabaseNoRLS, toAiDegraded, todoLeftInCode, tryParse, unknownAiStatus, unmeasuredQualityRules, unvalidatedRedirect, vc001TestFixtureSeverity, vendoredReason, visitBinary, visitCalls, weakHashing, xssVulnerability };
|