Skip to content

sdks/python pins nothing and is scanned by nothing: 16 floor-only dependencies, no manifest any scanner reads #343

Closed

Description

@scttfrdmn

sdks/python/setup.py declares 16 dependencies across install_requires and two extras_require
groups. Every one is a floor — requests>=2.25.0, pyyaml>=6.0, aiohttp>=3.8.0,
psutil>=5.8.0, and so on — with no upper bound and no lockfile of any kind. There is no
requirements.txt, no requirements-dev.txt, no poetry.lock, no Pipfile.lock, no
pyproject.toml.

This is #201's third ask, split out because the answer is "no" and the fix is not the same fix.
#201's first two asks are done: sdks/javascript/package-lock.json is committed, sdk-metrics
installs it with npm ci, and Trivy reads it. The Python SDK is in neither position.

Two distinct consequences, and the ordering matters.

Nothing scans these dependencies. Verified rather than assumed — trivy fs --scanners vuln over
the repository reports exactly four targets:

docs-platform/package-lock.json    npm
go.mod                             gomod
sdks/java/pom.xml                  pom
sdks/javascript/package-lock.json  npm

sdks/python is absent. Trivy detects Python from requirements.txt, poetry.lock,
Pipfile.lock, pyproject.toml or an installed .dist-info; a bare setup.py is not on that
list, and it is the only manifest here. So this SDK's dependency tree is scanned by nothing at all
— the same gap #201 filed against the JS SDK, in the one place that closing #201 does not reach.
.github/dependabot.yml has gomod, github-actions, docker, maven, and two npm
directories; there is no pip ecosystem entry, so Dependabot does not read this manifest
either.

CI installs an unpinned tree. ci.yml:292 runs pip install --quiet pytest ., which resolves
all six install_requires floors fresh on every run. Same defect the docs-site job had before
#337, with the same symptom available to it: a break can appear or vanish with no commit behind
it. It has not bitten yet, which is not evidence that it cannot.

One dependency is worse than unpinned — it should not be there. asyncio>=3.4.3 is a
stdlib module, and the PyPI package of that name is a 2015-era backport for Python 3.3. On
python_requires='>=3.8' it is at best inert and at worst installs a decade-old package that
shadows nothing useful. Removing it is unambiguous and independent of everything else here.

Do:

  • Decide the packaging story and write it down, the way sdks/javascript: no committed lockfile, so nothing scans or reproduces its dependency tree #201 asked for the JS SDK. Modern practice
    is pyproject.toml with the dependency table there rather than in setup.py; that also makes
    the manifest one Trivy detects, which resolves the scanning gap as a side effect rather than
    needing a second mechanism.
  • Commit a pinned dev/CI requirements file, and have ci.yml install from it so the test job runs
    against a tree a reader can reproduce. Keep install_requires as ranges — a library should not
    pin its consumers' transitive tree — which is the standard split and the reason "add a lockfile"
    is not by itself the right instruction for a library.
  • Add a pip ecosystem entry for /sdks/python to .github/dependabot.yml.
  • Drop asyncio from install_requires.

Verification: trivy fs --scanners vuln . lists a sdks/python target. That is the check that
cannot pass by accident, and it is the direct analogue of #201's npm ci gate.

Activity

  1. added
    type: security
    priority: medium
    effort: small
    area: sdk
    area: ci-cd
    on Aug 4, 2026
  2. scttfrdmn commented on Aug 4, 2026

    @scttfrdmn
    OwnerAuthor

    #347 implements this, with one correction to this issue that matters, because I wrote the wrong fix into it.

    This issue says a pyproject.toml "also makes the manifest one Trivy detects, which resolves the scanning gap as a side effect." That is false. A bare pyproject.toml with a [project].dependencies table is not detected — tested in a scratch directory, it reports no targets at all. Trivy needs requirements.txt, poetry.lock, Pipfile.lock, or an installed .dist-info.

    Worse, the filename has to be exactly that. I first wrote the file as requirements-ci.txt, the more descriptive name, and Trivy is blind to it:

    filename detected
    requirements.txt yes
    requirements-ci.txt no
    requirements-dev.txt no
    dev-requirements.txt no
    requirements/ci.txt no
    pyproject.toml (bare) no

    So the descriptive name would have produced a file that reads as the fix, passes review, and leaves the scanning gap exactly where it was. That is the same failure shape this release keeps finding — a check that does not run is indistinguishable from one that passes — arriving as a filename. The header comment in the committed file records it and says not to rename it for tidiness.

    Everything else here holds. asyncio is gone (worth adding: at 4.0.0 the PyPI package is now a deliberate empty stub — dist-info and no modules, summary "Deprecated backport of asyncio; use the stdlib package instead" — so it shadowed nothing, which is a milder finding than this issue implies, though it still declared a dependency the SDK does not have). typing-extensions is gone too, which this issue did not catch: it is imported nowhere in the package.

    install_requires stays as ranges per the reasoning here, with pip check added between install and test to guard the seam — mutation-checked with psutil==5.7.0 against the >=5.8.0 floor, which reports the conflict and exits 1.

    Verification as this issue specified it: trivy fs --scanners vuln . now lists sdks/python/requirements.txt, five targets total, 0 vulnerabilities.

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

    area: ci-cdarea: sdkeffort: smallpriority: mediumtype: security

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions