示例工程 44-threat-model

44-threat-model/app/shared/ipc.ts

typescript · 1.0 KB

export const CH = {
  snapshot: "threat:snapshot",
  probe: "threat:probe",
  refresh: "threat:refresh",
} as const;

export type EventRow = {
  at: number;
  kind: string;
  detail: string;
};

export type Check = {
  id: string;
  label: string;
  pass: boolean;
  detail: string;
};

export type Scenario = {
  id: string;
  title: string;
  severity: "high" | "medium" | "residual";
  status: "blocked" | "residual";
  controls: string[];
};

export type Verdict = {
  label: string;
  allowed: boolean;
  reason: string;
};

export type AttackReport = {
  navigation: Verdict[];
  path: Verdict[];
  update: Verdict[];
  plugin: Verdict[];
};

export type RuntimeProbe = {
  csp: string;
  requireType: string;
  processType: string;
  probedAt: number;
};

export type Snapshot = {
  platform: string;
  electronVersion: string;
  nodeVersion: string;
  checks: Check[];
  score: number;
  scenarios: Scenario[];
  attacks: AttackReport;
  runtime: RuntimeProbe;
  events: EventRow[];
};