Files
rengine/shared/definitions/notes.py
T
Yogesh OjhaandClaude Opus 5 2b17f345af feat(software): infer CVEs from the versions assets report
A sixth result dimension. Versions parsed from httpx tech strings and
Server headers match against a local NVD corpus, so an asset's known
CVEs are named without sending a request.

The stored CPE is not the input: 81 of 7,771 entries carry a version,
so matching on it returns every CVE ever filed against the product.
Versions come from tech and the Server banner, and the NVD pair comes
from a curated map rather than a name match — popper:popper is a 2005
webmail app, aos is a switch OS, and Apache's CVEs live under
apache:http_server, not apache:apache_http_server. An unmapped product
is reported as unmapped.

Ranges compare as zero-padded keys so the match is one SQL pass: a
letter suffix takes its own segment, trailing zeros drop, and numeric
and alphabetic schemes never order against each other. A criteria with
no version statement is discarded at load, because it means every
release. Measured against a reference implementation over 3,000,000
comparisons, residual disagreement is 0.07% and each case is the new
rule being the correct one.

Every match names what is unverified — conditional, backport,
fingerprint, coarse — and confidence is the count of those. Nothing
inferred enters the vulnerability count, triage or coverage a scanner
earned; software_cves keeps its own.

The corpus is a fourth feed, keyless, from the fkie-cad mirror of the
retired NVD JSON feeds: 2,197,146 ranges and 372,244 CVEs in 5m40s,
streamed rather than parsed whole (1,254 MB resident becomes 86 MB).
It rebuilds nightly and re-matches every covering scan, since the
corpus moves without a scan.

Exploitation coverage and the intel change feed leave Arsenal for the
dashboard; Arsenal keeps the feeds and the provider it configures.
Feed row counts, nouns and tables now come from FeedSpec — three
places had hardcoded two kinds, so a third feed rendered 0.

Port versions split out of the Server header in the migration: 223
rows become 3,037.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01H4NuBh4EsywioeryFZRNQR
2026-09-12 11:00:07 +05:30

41 lines
981 B
Python

"""Note anchors, and the asset identity each dimension uses."""
from __future__ import annotations
from enum import StrEnum
from shared.definitions.surface import SurfaceDimension
class NoteStatus(StrEnum):
OPEN = "open"
RESOLVED = "resolved"
NOTE_STATUSES: tuple[str, ...] = tuple(s.value for s in NoteStatus)
MAX_NOTE_BODY = 20000
MAX_NOTE_TITLE = 200
MAX_NOTE_TAGS = 20
MAX_ASSET_KEY = 500
MAX_ASSET_LABEL = 500
# each dimension's identity column
ASSET_IDENTITY: dict[str, str] = {
SurfaceDimension.WEB_ASSETS.value: "name",
SurfaceDimension.ENDPOINTS.value: "signature",
SurfaceDimension.SERVICES.value: "ip",
SurfaceDimension.IPS.value: "ip",
SurfaceDimension.VULNERABILITIES.value: "fingerprint",
SurfaceDimension.SOFTWARE.value: "fingerprint",
}
STATUS_LABELS: dict[str, str] = {
NoteStatus.OPEN.value: "Open",
NoteStatus.RESOLVED.value: "Resolved",
}
def service_key(ip: str, port: int) -> str:
return f"{ip}:{port}"