Skip to content

API Reference parrot_tools.security.parsers._types

github-actions[bot] edited this page Dec 2, 2026 · 4 revisions

parrot_tools.security.parsers._types

View source

Shared types for the catalog-level scanner parser registry.

These types are SEPARATE from parrot_tools.security.models (which serves scanner-internal normalization). This layer normalizes into the catalog's EmbeddedFinding / SeverityBreakdown shapes.

Class ParsedReport

Result returned by every catalog-level parser's parse() method.

Parameter Type Default Description
severity_summary SeverityBreakdown
top_findings list[EmbeddedFinding] list()

Fields:

Field Type Default Description
severity_summary SeverityBreakdown Aggregated severity counts for the report.
top_findings list[EmbeddedFinding] field(default_factory=list) Up to 10 findings sorted by severity desc, then finding_id asc.

Class ReportParser

Protocol every catalog-level parser must satisfy.

Attributes:

Attribute Type Description
parser_version str Semantic version string used to populate ReportRef.parser_version (e.g., "1.0.0").

Method ReportParser.parse

Parse scanner output into a canonical ParsedReport.

parse(content: bytes | Path) -> ParsedReport

Parameter Type Default Description
content bytes | Path Raw scanner JSON as bytes, or a Path to the file.

Returns: ParsedReport — Deterministic ParsedReport — same input always produces the same output.

Method ReportParser.extract_section

Extract a named section from the scanner output.

extract_section(content: bytes | Path, section: str) -> dict

Parameter Type Default Description
content bytes | Path Raw scanner JSON as bytes or Path.
section str One of "summary", "critical", "high", "medium", "low", "executive", "full".

Returns: dict — Dictionary with section-specific content.

Raises:

  • ValueError — If section is not one of the supported values.

Attribute SEVERITY_RANK

Type: dict[str, int]

Function load_bytes

Normalise content to bytes regardless of input type.

load_bytes(content: bytes | Path) -> bytes

Parameter Type Default Description
content bytes | Path Raw bytes or path to a file.

Returns: bytes — File content as bytes.

Function sort_findings

Sort findings by severity desc, then finding_id asc (deterministic).

sort_findings(findings: list[EmbeddedFinding]) -> list[EmbeddedFinding]

Parameter Type Default Description
findings list[EmbeddedFinding] Unsorted list of EmbeddedFinding objects.

Returns: list[EmbeddedFinding] — Sorted list (mutates a copy, not in-place).

Function validate_section

Raise ValueError if section is not in the supported set.

validate_section(section: str) -> None

Parameter Type Default Description
section str

Architecture

Clients

Bots & Agents

Memory

Knowledge

Tools & Toolkits

Flows

Experts

Skills

Stores & Loaders

MCP & A2A

Server & APIs

Integrations

Outputs & A2UI

Prompts

Security

Operations

Migration

SDD Tooling

LLM Wiki

Deployment

Decisions

API Reference

Clone this wiki locally