Repository navigation
Description
Part of #51. Before asking "was the vulnerable function called?", ask "is the vulnerable package even loaded in production, and at which version?" That answer is cheap to get, needs no symbol data, and catches what a repo scan can't.
Probe side (#55, #56): once at startup, then whenever a new package is first imported, emit a load line (format in #53):
- Python: map
sys.modulesto distributions withimportlib.metadata.packages_distributions(), and record name plus version. - Node: for each newly resolved file under
node_modules, read the nearestpackage.jsononce and record name, version and install path (nested copies are separate entries).
Server side: compare each app's loaded inventory with the project's latest SCA results:
| Case | Result |
|---|---|
| Vulnerable package loaded at the scanned version | runtime state Loaded on the finding |
| Package loaded at a different version than scanned | Version drift. Check that version against OSV too (cached in osv_lookups). |
| Package loaded but absent from the scanned manifests | Unscanned dependency. Look it up in OSV and raise a finding with source runtime. |
| Vulnerable package never loaded during the observation window | "Not loaded", shown with the duration (rule 4 in #51) |
First seen in production: record first_seen per (app, env, package, version). A package that appears in production for the first time after the baseline (the first 24 h of a sensor's life, configurable) is flagged as new, even if it has no known advisory.
Real-time advisories: secfoo runtime recheck (and a background job in secfoo serve, default every 6 h) queries OSV querybatch for every package version currently loaded in any app. A new advisory against a running version raises a finding immediately, with no new scan.
Export: secfoo runtime inventory --app <name> --env <env> --format cyclonedx writes a runtime SBOM of what is actually loaded.
Where to look: src/secfoo/osv.py, src/secfoo/report/sca.py, and the runtime_evidence storage from #53.
Done when: tests cover all four cases in the table using fixture inventories and fixture OSV responses (no network), plus a recheck that finds a newly published advisory.
Activity
karthickmk2001 commentedon Nov 12, 2026
Taking this; PR #103 is up.
Merge pull request #103 from secfoo-com/feat/68-runtime-inventory