EPSS
JSON serialization for EPSS::Score and the FIRST API envelope.
A Score round-trips through the same row shape the FIRST EPSS API
returns:
{
"cve": "CVE-2022-27225",
"epss": "0.001870000",
"percentile": "0.401290000",
"date": "2026-05-18"
}
Numeric fields are emitted as strings (matching the upstream API), so a
Score#to_json payload can be replayed against any consumer that
already parses the FIRST format. EPSS.from_json accepts both bare-row
JSON and full-envelope JSON so a serialized stream from either source
is consumable.
Constants
Class methods
CVEs whose EPSS probability is strictly above threshold. Streams
all matching pages through the API and materializes them into an
array. Be aware that loose thresholds produce large result sets;
use EPSS.client.each_score(Query.above(...)) directly to stream.
Convenience: just the EPSS::Band for one CVE. Returns nil when
the API has no published score.
Lazily-constructed default Client used by the module-level convenience
helpers. Override via EPSS.client= to inject a configured client or a
stub during tests. The mutex protects against duplicate construction
when multiple fibers race the first call.
Download the daily CSV feed for date. Equivalent to
EPSS::CSV.fetch(date); provided at module scope so callers don't
need to remember the submodule path.
Parse either a bare row ({"cve": ..., "epss": ..., "percentile": ...})
or a full API envelope ({"status": "OK", "data": [...]}). Returns an
Array(Score) in both cases.
Parse a non-raising form. Returns nil for any malformed input.
Reset the cached default client. Mainly useful after replacing transport/base URI in tests.
Convenience: look up the latest EPSS score for one CVE.
if s = EPSS.score("CVE-2022-27225")
puts "epss=#{s.epss} percentile=#{s.percentile}"
end
Convenience: batch lookup for many CVEs in one (or several batched)
request(s). Returns the parsed Score objects in the order the API
returned them.
Free-text search ordered by EPSS descending.
Download today's UTC feed. The feed is published once per day; if
called before the day's file has been minted the request will
surface as EPSS::APIError with a 404 status.