mirror of
https://github.com/yogeshojha/rengine.git
synced 2026-10-18 14:27:17 +02:00
Every result and management table gains multi-row selection and the floating action bar targets and scans already had: copy, export selection, delete, and the dimension's own actions. Rescan and triage move off the inline strip, which now only offers the rescan that acts on the whole query. Delete is dimension-local. A row takes only what cannot stand without it: a web asset its stored responses, a secret its sightings. Endpoints, services and findings on a deleted host are kept, so every count stays equal to its table. POST /surface/delete is the one route and the scope is a WHERE, so an id from another scan deletes nothing. Vulnerabilities are addressable by template_id so the Issues view deletes a whole check. Exposures dismiss rather than delete: an exposure row is a web asset. Selection export runs through the export pipeline. Every surface filter gains ids, capped by MAX_SELECTED_ROWS. Secrets and software become exportable, which fixes two breaks: a bundle export raised KeyError on the secrets dimension, and mcp read a SURFACE_COLUMNS entry for secrets that did not exist. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XyDpdVXL7YVsr5D7BVj2zt
62 lines
1.6 KiB
Python
62 lines
1.6 KiB
Python
import uuid
|
|
from datetime import datetime
|
|
|
|
from pydantic import BaseModel, ConfigDict, Field
|
|
|
|
from shared.definitions.surface import MAX_SELECTED_ROWS
|
|
|
|
|
|
class SurfaceTargetRead(BaseModel):
|
|
target_id: uuid.UUID
|
|
target_value: str
|
|
target_type: str
|
|
scan_id: uuid.UUID | None = None
|
|
scan_status: str | None = None
|
|
observed_at: datetime | None = None
|
|
stale: bool = False
|
|
|
|
|
|
class SurfaceCoverage(BaseModel):
|
|
dimension: str
|
|
label: str
|
|
noun: str
|
|
noun_plural: str
|
|
total: int = 0
|
|
total_capped: bool = False
|
|
targets_total: int = 0
|
|
targets_covered: int = 0
|
|
observed_from: datetime | None = None
|
|
observed_to: datetime | None = None
|
|
covered: list[SurfaceTargetRead] = Field(default_factory=list)
|
|
uncovered: list[SurfaceTargetRead] = Field(default_factory=list)
|
|
|
|
@property
|
|
def stale_targets(self) -> int:
|
|
return sum(1 for row in self.covered if row.stale)
|
|
|
|
|
|
class SurfaceOverview(BaseModel):
|
|
project_id: uuid.UUID
|
|
targets_total: int = 0
|
|
live_scans: int = 0
|
|
exposures: int = 0
|
|
cves: int = 0
|
|
dimensions: list[SurfaceCoverage] = Field(default_factory=list)
|
|
generated_at: datetime
|
|
|
|
|
|
class SurfaceDelete(BaseModel):
|
|
"""The rows a table asked to remove, addressed the way that table addresses them."""
|
|
|
|
model_config = ConfigDict(extra="forbid")
|
|
|
|
dimension: str = Field(max_length=32)
|
|
ids: list[str] = Field(min_length=1, max_length=MAX_SELECTED_ROWS)
|
|
key: str | None = Field(default=None, max_length=32)
|
|
|
|
|
|
class SurfaceDeleteResult(BaseModel):
|
|
dimension: str
|
|
deleted: int = 0
|
|
related: dict[str, int] = Field(default_factory=dict)
|