157 lines · 5.0 KB
import { all, chunks, first, placeholders, run } from "../db";
import { randomId } from "../crypto";
import { detectorName } from "./detectors";
import type { RedactedFinding } from "./detectors";
import { nextSecurityNumber } from "./settings";

const MAX_ALERTS_PER_SCAN = 100;
const ALERT_PAGE = 50;

export type SecretResolution = "revoked" | "false_positive" | "used_in_tests" | "wont_fix";
export type LocatedFinding = RedactedFinding & { path: string | null; commitSha: string | null };

export type SecretAlert = {
  number: number;
  detector: string;
  detectorName: string;
  preview: string;
  path: string | null;
  line: number | null;
  commitSha: string | null;
  state: "open" | "resolved";
  resolution: string | null;
  resolvedBy: string | null;
  resolvedAt: number | null;
  createdAt: number;
};

type AlertRow = {
  number: number;
  detector: string;
  preview: string;
  path: string | null;
  line: number | null;
  commit_sha: string | null;
  state: "open" | "resolved";
  resolution: string | null;
  resolver: string | null;
  resolved_at: number | null;
  created_at: number;
};