Skip to content

Runtime package inventory: loaded versions, drift and live advisories #68

Closed

Description

@vsn411

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.modules to distributions with importlib.metadata.packages_distributions(), and record name plus version.
  • Node: for each newly resolved file under node_modules, read the nearest package.json once 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

  1. added
    enhancementNew feature or request
    help wantedExtra attention is needed
    hackathonOpen for the Secfoo hackathon
    difficulty: mediumLeaderboard: 6 points when the PR closing this is merged
    on Nov 10, 2026
  2. karthickmk2001 commented on Nov 12, 2026

    @karthickmk2001
    Collaborator

    Taking this; PR #103 is up.

  3. added a commit that references this issue on Nov 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    difficulty: mediumLeaderboard: 6 points when the PR closing this is mergedenhancementNew feature or requesthackathonOpen for the Secfoo hackathonhelp wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions