/** * False Positive Feedback * * Handles user feedback on findings and maintains a feedback database * for improving FP detection over time. * * @module scanners/fp-feedback */ import type { ScannerType, DeterministicFinding } from "./types.js"; import type { Severity } from "../certification/types.js"; /** * Reason for marking a finding as FP */ export type FPReason = "test-code" | "false-pattern-match" | "sanitized-elsewhere" | "intentional" | "vendor-code" | "generated-code" | "example-code" | "configuration" | "other"; /** * FP reason descriptions for UI */ export declare const FP_REASON_DESCRIPTIONS: Record; /** * A single feedback entry */ export interface FeedbackEntry { /** Unique feedback ID */ id: string; /** Finding ID this feedback relates to */ findingId: string; /** Scanner that generated the finding */ scanner: ScannerType; /** Rule ID */ ruleId: string; /** File path */ file: string; /** Line number */ line?: number; /** Original severity */ severity: Severity; /** Verdict: true positive or false positive */ verdict: "tp" | "fp"; /** Reason for FP (if verdict is FP) */ reason?: FPReason; /** Additional details/notes */ details?: string; /** Who submitted the feedback */ submittedBy?: string; /** When the feedback was submitted */ submittedAt: string; /** Hash of the code at feedback time (for invalidation) */ codeHash?: string; } /** * Feedback database */ export interface FeedbackDatabase { version: string; projectPath: string; entries: FeedbackEntry[]; stats: { totalFeedback: number; tpCount: number; fpCount: number; byScanner: Record; byReason: Record; }; } /** * Load feedback database */ export declare function loadFeedbackDatabase(projectPath: string): Promise; /** * Save feedback database */ export declare function saveFeedbackDatabase(projectPath: string, db: FeedbackDatabase): Promise; /** * Submit feedback for a finding */ export declare function submitFeedback(projectPath: string, finding: DeterministicFinding, verdict: "tp" | "fp", options?: { reason?: FPReason; details?: string; submittedBy?: string; codeHash?: string; }): Promise; /** * Get feedback for a specific finding */ export declare function getFeedbackForFinding(projectPath: string, scanner: ScannerType, ruleId: string, file: string, line?: number): Promise; /** * Get all feedback for a rule */ export declare function getFeedbackForRule(projectPath: string, scanner: ScannerType, ruleId: string): Promise; /** * Check if a finding has existing feedback */ export declare function hasFeedback(projectPath: string, scanner: ScannerType, ruleId: string, file: string, line?: number): Promise; /** * Get suppression suggestions based on feedback */ export declare function getSuppressionSuggestions(projectPath: string, options?: { minFPRate?: number; minSampleSize?: number; }): Promise>; /** * Generate feedback summary report */ export declare function generateFeedbackReport(projectPath: string): Promise<{ overview: { totalFeedback: number; tpCount: number; fpCount: number; overallFPRate: number; }; byScanner: Array<{ scanner: ScannerType; total: number; tp: number; fp: number; fpRate: number; }>; topFPReasons: Array<{ reason: FPReason; count: number; percentage: number; }>; recentFeedback: FeedbackEntry[]; suppressionSuggestions: Awaited>; }>; /** * Clear old feedback entries */ export declare function pruneOldFeedback(projectPath: string, maxAgeDays?: number): Promise; //# sourceMappingURL=fp-feedback.d.ts.map