Pin all Python dependencies - #289
Conversation
Pin every runtime dependency in pyproject.toml to an exact version, replace the bs4 shim with a direct beautifulsoup4 dependency, pin the socketdev SDK to 3.4.2, and install Docker image dependencies from the committed uv.lock with pip hash verification so image builds no longer resolve loose versions from PyPI at build time. Also pins the hatchling build backend and the uv binary used in the Dockerfile. Refs CE-359. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Signed-off-by: lelia <2418071+lelia@users.noreply.github.com>
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
Pass explicit production index flags on the hash-locked dependency install so the PIP_INDEX_URL/PIP_EXTRA_INDEX_URL build args (pointed at TestPyPI by the preview build scripts) don't leak in via pip's env vars, and move pip check ahead of the SDK_VERSION override so a preview SDK that deviates from the exact socketdev pin doesn't abort the build. Addresses PR#289 review findings. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Signed-off-by: lelia <2418071+lelia@users.noreply.github.com>
|
bugbot run |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
Autofix Details
Bugbot Autofix prepared a fix for the issue found in the latest run.
- ✅ Fixed: pip check failure ignored
- Changed
pip check;topip check &&so a failed dependency check fails the Docker RUN instead of being masked by the following SDK_VERSION if-block.
- Changed
Or push these changes by commenting:
@cursor push 1031f03076
Preview (1031f03076)
diff --git a/Dockerfile b/Dockerfile
--- a/Dockerfile
+++ b/Dockerfile
@@ -143,7 +143,7 @@
echo "Failed to install socketsecurity==$CLI_VERSION after 10 attempts"; \
exit 1; \
fi; \
- pip check; \
+ pip check && \
if [ ! -z "$SDK_VERSION" ]; then \
pip install --index-url ${PIP_INDEX_URL} --extra-index-url ${PIP_EXTRA_INDEX_URL} socketdev==${SDK_VERSION}; \
fi; \You can send follow-ups to the cloud agent here.
|
Cursor (@cursor) push 1031f03 |
|
Could not push Autofix changes. The PR branch may have changed since the Autofix ran, or the Autofix commit may no longer exist. |
Docker's shell-form RUN only propagates the last command's exit status, so once pip check moved ahead of the SDK_VERSION block its failure was silently discarded whenever SDK_VERSION was empty or the override install succeeded. Gate it explicitly with || exit 1. Addresses PR#289 review finding. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Signed-off-by: lelia <2418071+lelia@users.noreply.github.com>
|
bugbot run |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit fed545a. Configure here.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Signed-off-by: lelia <2418071+lelia@users.noreply.github.com>
Switching to fully pinned dependencies warrants a minor bump rather than a patch. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Signed-off-by: lelia <2418071+lelia@users.noreply.github.com>
David Larsen (dc-larsen)
left a comment
There was a problem hiding this comment.
Approving — validated locally end to end.
uv buildproduces 2.6.0 with every pin present in the wheel metadata (requests==2.34.2,socketdev==3.4.2,beautifulsoup4==4.14.3, etc.)uv sync --lockedclean; test suite 351 passed / 2 skipped, matching your numbers- Replayed the Dockerfile sequence in a clean venv: the exact
uv exportline yields 22 requirements, all hash-pinned, markers preserved, project correctly excluded;pip install --require-hashes --no-depsthen the wheel--no-deps, andpip checkreports no broken requirements - bs4 swap is correct — with the shim uninstalled,
from bs4 import BeautifulSoup, Tagandfrom bs4.element import NavigableStringboth resolve from beautifulsoup4 4.14.3, andsocketcli --versionreports 2.6.0 hatchling==1.31.0needs Python >=3.10 and this package requires >=3.11, so no conflict here (worth noting it does conflict in the SDK, which still declares >=3.9)
Ingest the SDK release that bounds its own runtime dependency ranges, so the pinned closure is hygienic end to end. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Signed-off-by: lelia <2418071+lelia@users.noreply.github.com>
…ailure The e2e-reachability job intermittently fails with 'no components with alerts in .socket.facts.json': the tier-1 reachability backend can return empty results while the CLI reports success (ENG-5093), and the same flake has hit unrelated PRs. - Add a retry-probe hook to the e2e matrix: entries that define it get up to 3 scan attempts, retrying only when the probe says the output looks incomplete. Persistent failures still fail via the validate step. Each retry emits a warning annotation and a step-summary line so flake frequency stays visible. - Add tests/e2e/reach-facts-probe.sh: exits 0 when the facts file has alerted components, non-zero (retry) when empty or missing. - Upload /tmp/e2e-output.log, SARIF/GitLab outputs, and facts files as artifacts when any e2e job fails, so flakes are diagnosable without a re-run. Also bump version to 2.6.2 (2.6.0 and 2.6.1 are being released ahead of this PR). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Signed-off-by: lelia <2418071+lelia@users.noreply.github.com>

Summary
Pins the Python dependency chain at all three points where versions could previously resolve loose:
pyproject.toml: every runtime dependency is now pinned to an exact version. Several entries (requests,mdutils,prettytable,GitPython,packaging,python-dotenv) were previously unpinned; the rest were open ranges. Pins use the versions already resolved and tested inuv.lock.bs4→beautifulsoup4: thebs4package is a shim that installsbeautifulsoup4unpinned underneath, so pinning the shim alone pins nothing. The dependency is now onbeautifulsoup4directly. (Thebs4import name is unaffected — it is provided bybeautifulsoup4itself.)socketdev: pinned to3.5.0(which itself bounds its own runtime ranges — Bound runtime dependency ranges and pin build backend socket-sdk-python#103) (previously>=3.3.0,<4.0.0).pip install socketsecurity==$CLI_VERSION, resolving all transitive dependencies fresh from PyPI at build time. Builds now export the committeduv.lockto a hash-pinned requirements file (uv export) and install withpip install --require-hashes --no-deps; the CLI package itself installs with--no-deps, andpip checkvalidates the final environment. Thehatchlingbuild backend and theuvbinary copied into the image are pinned as well.Dependabot (uv + docker ecosystems, 7-day cooldown) is already configured to keep the pins current.
Notes
Dockerfile.previewneeds no changes: it resolves from the wheel'sRequires-Distmetadata, which now carries the exact pins.CLI_VERSIONwith this Dockerfile will fail atpip check(older metadata expectsbs4, which the lock no longer provides). Image builds for a given version should use the Dockerfile from that version's tag, as the release workflows already do.python:3-alpinebase image to a more specific tag or digest.Testing
uv lockregenerated cleanly; only changes werebs4removal andsocketdev3.3.0 → 3.5.0 (all other locked versions already matched the new pins).uv exportcommand from the Dockerfile produces a fully hashed 22-package requirements file, with environment markers intact andsocketdev==3.5.0resolvable from PyPI.socketcli --versionentrypoint works in the synced environment..socket.facts.json. This becomes the permanentmainworkflow behavior when this PR merges.Fixes CE-359
Note
Medium Risk
Changes Docker image assembly and bumps the bundled
socketdevSDK; older CLI versions rebuilt with this Dockerfile may failpip checkdue to metadata expectingbs4.Overview
Release 2.6.0 locks down the Python supply chain so CI and Docker builds no longer float on unpinned or range-based dependencies.
Runtime dependencies in
pyproject.tomlare now exact pins (including previously unpinned packages likerequestsandGitPython). Thebs4meta-package is replaced withbeautifulsoup4==4.14.3so the real library is version-controlled; existingfrom bs4 import …usage is unchanged.socketdevis pinned to3.5.0, andhatchlingis pinned for the build backend.The Dockerfile installs deps from the committed
uv.lockviauv exportandpip install --require-hashes --no-deps, with explicit PyPI index URLs so previewPIP_*args do not affect the lock install. The published CLI wheel installs with--no-deps, followed bypip check; local editable installs use the same pattern. Theuvimage tag is pinned to0.10.4.Reviewed by Cursor Bugbot for commit fed545a. Configure here.