Urgent.News

What's breaking now, across hundreds of outlets.

Tech

Do you build your Python SBOM from requirements.txt or from what is actually installed?

Quick question for anyone who has had to hand over an SBOM for a Python service (customer questionnaire, security review, or just your own "what is actually running in prod?"). There are two places you can build it from, and they don't always agree: What you declared : requirements.txt, a lock file, pyproject.toml. What is actually installed in the environment that runs the code: the venv or the…

Building an SBOM (Software Bill of Materials) for a Python service can be a bit of a conundrum. You have two primary sources to draw from: the requirements.txt file, a lock file, or pyproject.toml, versus the actual packages installed in the production environment. These two sources often yield different results.

The second source - what's installed in the running environment - can uncover issues the first one might miss. This includes transitive dependencies you didn't explicitly list, packages installed manually for debugging, or versions that drifted due to looser pinning than anticipated. I developed a small Python tool to address this approach.

It reads the installed packages using the importlib.metadata standard library module and outputs CycloneDX 1.5 JSON format with Package URLs. The tool operates offline, without requiring any PyPI calls.

While writing this tool, I encountered a few unexpected nuances. Package names must be normalized to the PyPI standard format, so Ruamel.Yaml becomes ruamel-yaml. If different tools normalize the names differently, comparing SBOMs can quickly become noisy. License data can be incomplete or inconsistent based on the available metadata. Packages might even appear twice within a single environment, requiring decisions on how to report them.

It's important to remember that an SBOM is not a vulnerability scan. It simply tells you what's installed. Matching it against known vulnerabilities is a separate step. So, how do others handle this? Do you generate the SBOM from the lock file, the running image, or both? Do you run vulnerability scans like Syft or Trivy within the CI pipeline, or do you generate the SBOM within the running environment?

Have you ever been asked for an SBOM by a customer, and in what format? CycloneDX or SPDX? How do you deal with missing or messy license fields? I'd love to hear about your pipeline, particularly for small teams without a dedicated security person.

Rewritten by urgent.news; may contain errors — check the original.

Source: dev.to

Read the original at dev.to →

Report a problem with this story

More in Tech

BitBox02 USB HID request handling: firmware size checks belong on the trust boundary

BitBox02 USB HID request handling: firmware size checks belong on the trust boundary BitBox02 firmware before 9.26.2 and bootloader before 1.2.0 contain an out-of-bounds write in the USB HID request…

  • Firmware size checks in BitBox02 USB HID request handling are on trust boundary.
  • CVE-2026-140033 allows out-of-bounds write in USB HID request handler.
  • Update to firmware 9.26.2 or later and bootloader 1.2.0 to mitigate risk.

AI and GDPR: what data to entrust to an AI tool?

You can have personal data processed by an AI under four conditions: knowing what the processing is for, sending only what the model needs to the model, having a contract with the provider that states…

More from Tuesday, 1 December 2026 →