Architecture
VulnParse-Pin is organized as a staged pipeline with strong separation of concerns:
Input -> Validation -> Detection -> Parsing -> Enrichment -> PassRunner -> Output
High-level module map
src/vulnparse_pin/main.py— CLI orchestration and end-to-end workflowsrc/vulnparse_pin/parsers/— scanner format adapterssrc/vulnparse_pin/core/— identity, schema detection, pass system, dataclassessrc/vulnparse_pin/utils/— enrichment, caching, exporting, logging, validationsrc/vulnparse_pin/io/pfhandler.py— constrained and policy-aware file I/O
Core data structures
Primary models are in src/vulnparse_pin/core/classes/dataclass.py:
Finding— normalized vulnerability observationAsset— host identity and attached findingsScanResult— top-level parsed/enriched object for one runRunContext— immutable runtime services and path/config state
Pass contracts are in src/vulnparse_pin/core/classes/pass_classes.py:
Passprotocol (run(ctx, scan) -> DerivedPassResult)PassRunnersequential orchestratorDerivedContextappend-only pass output registry
Control-plane flow (main.py)
At runtime, the orchestrator does the following:
- Parse CLI args and establish app paths
- Initialize PFH path policy and logger
- Validate input and detect schema/parser
- Parse input into normalized
ScanResult - Enrich findings using configured feed/cache strategy
- Execute derived passes (
ScoringPass,TopNPass,SummaryPass) - Emit output artifacts (JSON and optional CSV)
Architectural invariants
- Deterministic identity: IDs are stable for equivalent canonical inputs
- Immutable derived context: pass outputs are versioned and append-only
- Policy-driven scoring: risk behavior comes from config, not hidden constants
- Secure defaults: path handling and CSV export are hardened
- Scale thresholds: computational strategy switches based on workload size
Why this architecture works
- Keeps parser complexity isolated from risk logic
- Keeps enrichment logic independent of scoring logic
- Enables focused testability per stage
- Enables targeted optimization without changing external UX