Repository navigation
fork-kit/update-policy: daily exposure check: KEV, distro security data, EPSS (#1045 part 3) - #1053
Conversation
…ta, EPSS (#1045 part 3) update-policy exposure compares the installed packages (dpkg) with the distribution's OVAL file (Ubuntu's CVE OVAL, Debian's OVAL), CISA's KEV list and EPSS (FIRST.org API, only for the CVEs found) and prints only what needs action: - KEV CVE with a fixed version out: update; - KEV CVE with no fix: mitigate or watch; - a security fix waiting, shown when KEV, EPSS >= epssMin or waiting longer than fixWaitingDays; ranked KEV first, then EPSS; - cannot check (a feed down or not understood, no data source, dpkg failing, EPSS down), never all clear; drift (a cache older than staleDays, an ignore entry past its date). Feeds are fetched at most once a day with a size cap, timeout, ETag and a sha256 of the stored copy; a download the reader does not understand never replaces the good copy. The unit runs it as a DynamicUser with its own cache folder; only the alert step (ExecStopPost=+) runs as root. machine.json: update-policy.exposure (off by default), ignore list with reason and date. Ecosystems table for rpm/apk later. Tests on recorded cuts of the real feeds, no network. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
lens: state · reviewer: Claude Code (review sub-agent) · read at: ea4e1ce major: a partial feed format change still reads as all clear. oval.read only refuses a file with no definitions or no dpkginfo tests; if objects, variables or states change shape, every test resolves to nothing and the check prints nothing and exits 0. Reproduced on the noble fixture (see block 1). KEV is the same: one valid entry is enough to replace a good copy. Fix: FormatError when too few dpkginfo tests resolve to names plus a readable state (say under 90 %), or none do. Also refuse a download whose advisory/KEV count falls far below the kept copy's (count in the meta). What held
State question
Lens state: not safe (3 majors). 🤖 Generated with Claude Code |
|
lens: code · reviewer: Claude Code (code lens sub-agent) · read at: ea4e1ce blocker: none What held
State question
🤖 Generated with Claude Code |
…the kernel, bounded memory, no CVE list sent
- OVAL is read strictly: an unknown test kind, state operation, missing object,
state or variable, an unknown section, or fewer than 90% of package tests
resolving is a FormatError ("cannot check"), never fewer advisories.
- Feeds have absolute floors and must hold at least half the kept copy's
entries; otherwise the good copy stays and the run says cannot check.
- Memory: the decompressed size is capped while streaming (maxXmlMb), every
finished entry and section is dropped, one entry is capped at 500k
elements, and the unit has MemoryHigh/MemoryMax and low CPU/IO weights.
- Kernel: Ubuntu's running-kernel tests (flavour pattern + fixed version)
against uname -r, the flavour from linux-modules-<release>; Debian's running
linux-image as source linux; other installed kernel packages never count;
what cannot be judged is a "kernel: not checked (why)" note in every report.
- Debian "less than 0:0" is no fix yet (KEV no-fix lines fire).
- EPSS from FIRST.org's daily bulk file: no CVE list leaves the machine.
- Temporary files of a killed run are swept under a cache lock; the waiting
clock is per (CVE, package) and survives runs without data and newer fixes;
one line per KEV CVE or source package, capped at 40; every line escaped;
https only (redirects to http refused); held and half-installed dpkg states
count, unknown ones are cannot check; refuses to run as root on the unit's
cache.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
lens: state · reviewer: Claude Code (review sub-agent) · read at: 921cf32 blocker: none Round 1 (this lens and the code lens), on this head
State question
Lens state: safe (no blocker or major open; 5 minors). 🤖 Generated with Claude Code |
|
lens: code · reviewer: Claude Code (code lens sub-agent, round 2) · read at: 921cf32 blocker: none Round 1 (this lens and the state lens), on this head:
Tests on this head: exposure.test.py 45 ok (1 skipped: no dpkg here), install 11, baseline 20, tick 35, idle 29, all ok. The red check passes. The new tests use the new API, so running them against ea4e1ce says nothing useful. Instead, each round-1 repro above fails at ea4e1ce and passes here. State question
🤖 Generated with Claude Code |
- a kernel entry it cannot read (fixed version, a capture pattern with no group or that does not compile) is a format error when the file is read; a fault in the check is a cannot-check report, never a traceback; - only the running kernel's entries are kept (jammy ~375 MB, noble ~265 MB), counts still cover the whole file; unit comment fixed; - package advisories and kernel entries are floored apart; a feed that shrank for good is accepted after the same smaller counts 3 days in a row, with a visible "feed shrank, accepted" drift line; - the report is written while the cache lock is held; - the kernel's waiting clock is per flavour (kept across a reboot into a newer kernel still behind); tests for the oldest-first-sight and the dropping of finished entries; - Debian kernel lines say "and restart"; Debian 0:0 reads "no fixed version listed by Debian" with the ignore-entry way out; README: Livepatch not read; - the first cache format's epss.json is removed and its waiting days kept. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Part of #1045, part 3 (with part 6's "a security update pending more than 3 days" alert). Follows #1051 (PR A), in the same kit.
What it does
update-policy exposureis a daily check (update-policy-exposure.timer, off unlessexposure.enabled). It checks the installed packages and the running kernel against three sources: the distribution's OVAL file, CISA's KEV list, and FIRST.org's daily EPSS file. It prints only what needs action, sends it through the kit'salertCommand(eventexposure), and exits 1 on any line.The lines it can print:
KEV CVE-… is exploited in the wild: SOURCE VERSION (PKGS): update to FIXED: one line per CVE. A kernel line saysand restart. A fix that needs Ubuntu Pro (esm) says so.KEV CVE-… … has no fix yet: mitigate or watch.security fix waiting N day(s): SOURCE …: one line per source package. It is shown when a CVE's EPSS is ≥epssMin, or the fix has waited longer thanfixWaitingDays. The days count per (CVE, package) from first sight; a newer fix does not reset them, and neither does a run without data.cannot check: …anddrift: …: never an all-clear.kernel: not checked (why): a note, not a finding. It appears in every report where the running kernel could not be judged.Ranking is KEV first, then EPSS. At most 40 lines are printed; the rest are counted on the last line and kept in the report.
Kernel
uname -r. The flavour comes from the source package of the running kernel'slinux-modules-<release>.linux-image-<release>is matched as sourcelinux.Debian: a "less than 0:0" state is read as no fix yet, so its KEV no-fix lines fire.
Privacy: EPSS comes from the daily bulk file, so no list of this machine's CVEs is sent anywhere. Only the OVAL URL names the release codename.
Strict reading. These are all "cannot check", and the good copy stays:
Memory: the decompressed size is capped while streaming (
maxXmlMb), and finished entries are dropped. One entry is capped at 500k elements. The unit hasMemoryHigh=768M,MemoryMax=1G, and low CPU and IO weights. Live on noble: about 10 s and about 350 MB.Feeds:
Privileges: the check runs as a systemd
DynamicUser. Only the alert step (ExecStopPost=+) runs as root. Running it by hand as root on the unit's cache is refused; the README points tosystemctl start update-policy-exposure.service.dpkg states: installed, held, and half-installed/unpacked/half-configured/triggers states count. An unknown status is "cannot check".
Other package systems: rpm and apk fit in as one more
ECOSYSTEMSentry.State question
staleDaysis still read and is reported as drift.General vs project
machine.example.jsonuse placeholders./etc/fork-kit/machine.json→update-policy.exposure): on/off,epssMin,fixWaitingDays,staleDays,maxFeedMb,timeoutSeconds, optional feed URLs, and the ignore list (CVE, reason, until date). Which machines run it is the owner's rollout.Registered
fork-kit/README.mdrow,machine.example.json,.github/fork-ci-tests.txt(exposure.test.py). The installer now covers the two new units and the new modules, and uninstall removes the cache. No upstream file changed.Tests
fork-kit/update-policy/tests/exposure.test.pyruns on recorded cuts of the real feeds intests/fixtures/:linuxCVE-2024-36971;Network is replaced by a fake web, and the clock is fixed.
Each round-1 finding has a test that fails on the previous head (39 of the new tests fail there), plus a red-check mutation per rule. They cover:
hi/iU/iF/iH/iW/it, removed, and unknown states;Local: all kit tests and the installer contract pass, plus
fork-ci-release.test.py,vp run check:changed, and gitleaks.Not installed on any machine.
🤖 Generated with Claude Code