# AGENTS
## Role
Create a dedicated CVE connector when we need raw CVE stream ingestion outside of NVD/OSV/National feeds (e.g., CVE JSON 5 API or CNA disclosures).

## Scope
- Determine whether this connector should consume the official CVE JSON 5 API, CNA disclosures, or another stream.
- Implement fetch/windowing aligned with CVE publication cadence; manage cursors for incremental backfills.
- Parse CVE payloads into DTOs capturing descriptions, affected vendors/products, references, and metrics.
- Map CVEs into canonical `Advisory` records (aliases, references, affected packages, range primitives).
- Deliver deterministic fixtures/tests for fetch/parse/map lifecycle.

## Participants
- `Source.Common` (HTTP/fetch utilities, DTO storage).
- `Storage.Mongo` (raw/document/DTO/advisory stores & source state).
- `Feedser.Models` (canonical data model).
- `Feedser.Testing` (integration fixtures, snapshot helpers).

## Interfaces & Contracts
- Job kinds: `cve:fetch`, `cve:parse`, `cve:map`.
- Persist upstream metadata (e.g., `If-Modified-Since`, `cveMetadataDate`) for incremental fetching.
- Aliases must include primary CVE ID along with CNA-specific identifiers when available.

## In/Out of scope
In scope:
- Core pipeline for CVE ingestion with provenance/range primitives.

Out of scope:
- Downstream impact scoring or enrichment (handled by other teams).

## Observability & Security Expectations
- Log fetch batch sizes, update timestamps, and mapping counts.
- Handle rate limits politely with exponential backoff.
- Sanitize and validate payloads before persistence.

## Tests
- Add `StellaOps.Feedser.Source.Cve.Tests` with canned CVE JSON fixtures covering fetch/parse/map.
- Snapshot canonical advisories; include env flag for fixture regeneration.
- Ensure deterministic ordering and timestamp handling.
