feat(attack-paths): The complete Attack Paths feature (#9805)

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: César Arroba <19954079+cesararroba@users.noreply.github.com>
Co-authored-by: Alan Buscaglia <gentlemanprogramming@gmail.com>
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Andoni Alonso <14891798+andoniaf@users.noreply.github.com>
Co-authored-by: Rubén De la Torre Vico <ruben@prowler.com>
Co-authored-by: HugoPBrito <hugopbrit@gmail.com>
Co-authored-by: Hugo Pereira Brito <101209179+HugoPBrito@users.noreply.github.com>
Co-authored-by: Pepe Fagoaga <pepe@prowler.com>
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Co-authored-by: Chandrapal Badshah <Chan9390@users.noreply.github.com>
Co-authored-by: Chandrapal Badshah <12944530+Chan9390@users.noreply.github.com>
Co-authored-by: Adrián Peña <adrianjpr@gmail.com>
Co-authored-by: Pedro Martín <pedromarting3@gmail.com>
Co-authored-by: KonstGolfi <73020281+KonstGolfi@users.noreply.github.com>
Co-authored-by: lydiavilchez <114735608+lydiavilchez@users.noreply.github.com>
Co-authored-by: Prowler Bot <bot@prowler.com>
Co-authored-by: prowler-bot <179230569+prowler-bot@users.noreply.github.com>
Co-authored-by: StylusFrost <43682773+StylusFrost@users.noreply.github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: alejandrobailo <alejandrobailo94@gmail.com>
Co-authored-by: Alejandro Bailo <59607668+alejandrobailo@users.noreply.github.com>
Co-authored-by: Víctor Fernández Poyatos <victor@prowler.com>
Co-authored-by: bota4go <108249054+bota4go@users.noreply.github.com>
Co-authored-by: Daniel Barranquero <74871504+danibarranqueroo@users.noreply.github.com>
Co-authored-by: Daniel Barranquero <danielbo2001@gmail.com>
Co-authored-by: mchennai <50082780+mchennai@users.noreply.github.com>
Co-authored-by: Ryan Nolette <sonofagl1tch@users.noreply.github.com>
Co-authored-by: Ulissis Correa <123517149+ulissisc@users.noreply.github.com>
Co-authored-by: Sergio Garcia <hello@mistercloudsec.com>
Co-authored-by: Lee Trout <ltrout@watchpointlabs.com>
Co-authored-by: Sergio Garcia <sergargar1@gmail.com>
Co-authored-by: Alan-TheGentleman <alan@thegentleman.dev>
This commit is contained in:
Josema Camacho
2026-01-16 13:37:09 +01:00
committed by GitHub
parent d7af97b30a
commit 032499c29a
104 changed files with 11792 additions and 322 deletions

245
ui/types/attack-paths.ts Normal file
View File

@@ -0,0 +1,245 @@
/**
* Attack Paths Feature Types
* Defines all TypeScript interfaces for the Attack Paths visualization feature
*/
// Scan state constants
export const SCAN_STATES = {
AVAILABLE: "available",
SCHEDULED: "scheduled",
EXECUTING: "executing",
COMPLETED: "completed",
FAILED: "failed",
} as const;
export type ScanState = (typeof SCAN_STATES)[keyof typeof SCAN_STATES];
// Attack Path Scan - Relationship Data
export interface RelationshipData {
type: string;
id: string;
}
export interface RelationshipWrapper {
data: RelationshipData;
}
export interface ScanRelationships {
provider: RelationshipWrapper;
scan: RelationshipWrapper;
task: RelationshipWrapper;
}
// Provider type constants
export const PROVIDER_TYPES = {
AWS: "aws",
AZURE: "azure",
GCP: "gcp",
} as const;
export type ProviderType = (typeof PROVIDER_TYPES)[keyof typeof PROVIDER_TYPES];
// Attack Path Scan Response
export interface AttackPathScanAttributes {
state: ScanState;
progress: number;
provider_alias: string;
provider_type: ProviderType;
provider_uid: string;
inserted_at: string;
started_at: string;
completed_at: string | null;
duration: number | null;
}
export interface AttackPathScan {
type: "attack-paths-scans";
id: string;
attributes: AttackPathScanAttributes;
relationships: ScanRelationships;
}
export interface PaginationLinks {
first: string;
last: string;
next: string | null;
prev: string | null;
}
export interface AttackPathScansResponse {
data: AttackPathScan[];
links: PaginationLinks;
}
// Data type constants
const DATA_TYPES = {
STRING: "string",
NUMBER: "number",
BOOLEAN: "boolean",
} as const;
type DataType = (typeof DATA_TYPES)[keyof typeof DATA_TYPES];
// Query Types
export interface AttackPathQueryParameter {
name: string;
label: string;
data_type: DataType;
description: string;
placeholder?: string;
required?: boolean;
}
export interface AttackPathQueryAttributes {
name: string;
description: string;
provider: string;
parameters: AttackPathQueryParameter[];
}
export interface AttackPathQuery {
type: "attack-paths-scans";
id: string;
attributes: AttackPathQueryAttributes;
}
export interface AttackPathQueriesResponse {
data: AttackPathQuery[];
}
// Graph Data Types
// Property values from graph nodes can be any primitive type or arrays
export type GraphNodePropertyValue =
| string
| number
| boolean
| null
| undefined
| string[]
| number[];
export interface GraphNodeProperties {
[key: string]: GraphNodePropertyValue;
}
export interface GraphNode {
id: string;
labels: string[]; // e.g., ["S3Bucket"], ["EC2Instance"], ["ProwlerFinding"]
properties: GraphNodeProperties;
findings?: string[]; // IDs of finding nodes connected via HAS_FINDING edges
resources?: string[]; // IDs of resource nodes connected via HAS_FINDING edges
}
export interface GraphEdge {
id: string;
source: string | object;
target: string | object;
type: string;
properties?: GraphNodeProperties;
}
export interface GraphRelationship {
id: string;
label: string;
source: string;
target: string;
properties?: GraphNodeProperties;
}
export interface AttackPathGraphData {
nodes: GraphNode[];
edges?: GraphEdge[];
relationships?: GraphRelationship[];
}
export interface QueryResultAttributes {
nodes: GraphNode[];
relationships?: GraphRelationship[];
}
export interface QueryResultData {
type: "attack-paths-query-run-requests";
id: string | null;
attributes: QueryResultAttributes;
}
export interface AttackPathQueryResult {
data: QueryResultData;
}
// Finding severity and status constants
const FINDING_SEVERITIES = {
CRITICAL: "critical",
HIGH: "high",
MEDIUM: "medium",
LOW: "low",
INFO: "info",
} as const;
type FindingSeverity =
(typeof FINDING_SEVERITIES)[keyof typeof FINDING_SEVERITIES];
const FINDING_STATUSES = {
PASS: "PASS",
FAIL: "FAIL",
MANUAL: "MANUAL",
} as const;
type FindingStatus = (typeof FINDING_STATUSES)[keyof typeof FINDING_STATUSES];
export interface RelatedFinding {
id: string;
title: string;
severity: FindingSeverity;
status: FindingStatus;
}
// Node Detail Types
export interface NodeDetailData extends GraphNode {
relatedFindings?: RelatedFinding[];
incomingEdges?: GraphEdge[];
outgoingEdges?: GraphEdge[];
}
// Wizard State Types
export interface WizardState {
currentStep: 1 | 2;
selectedScanId: string | null;
selectedQuery: string | null;
queryParameters: Record<string, string | number | boolean>;
}
// Graph State Types
export interface GraphState {
data: AttackPathGraphData | null;
selectedNodeId: string | null;
loading: boolean;
error: string | null;
zoomLevel: number;
panX: number;
panY: number;
}
// Provider Integration
export interface ProviderWithScanStatus {
id: string;
alias: string;
provider: string;
scan: AttackPathScan;
connected: boolean;
}
// API Request/Response Helpers
export interface QueryRequestAttributes {
id: string;
parameters?: Record<string, string | number | boolean>;
}
export interface ExecuteQueryRequestData {
type: "attack-paths-query-run-requests";
attributes: QueryRequestAttributes;
}
export interface ExecuteQueryRequest {
data: ExecuteQueryRequestData;
}

View File

@@ -33,6 +33,7 @@ export type MenuProps = {
defaultOpen?: boolean;
target?: string;
tooltip?: string;
highlight?: boolean;
};
export type GroupProps = {