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.
|
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 2 potential issues.
Bugbot Autofix is ON. A cloud agent has been kicked off to fix the reported issues.
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 51ca456. Configure here.
| COPY pyproject.toml uv.lock /tmp/socket-cli-lock/ | ||
| RUN uv export --directory /tmp/socket-cli-lock --frozen --no-dev --no-emit-project \ | ||
| --format requirements-txt -o /tmp/socket-cli-lock/requirements.txt && \ | ||
| pip install --require-hashes --no-deps -r /tmp/socket-cli-lock/requirements.txt |
There was a problem hiding this comment.
Pip index ARG leaks into lock install
Medium Severity
The new hash-pinned lockfile pip install has no --index-url, so it inherits PIP_INDEX_URL from the Docker ARG (BuildKit exposes ARGs as env vars). Test image builds set that ARG to TestPyPI (build_container.sh, deploy-test-docker.sh), so lockfile packages resolve against TestPyPI instead of production PyPI. This violates the Docker ARG / pip-recognized env var names rule; CLI/SDK installs already pass index flags explicitly.
Additional Locations (1)
Triggered by learned rule: Docker ARG with pip-recognized env var names leaks into pip
Reviewed by Cursor Bugbot for commit 51ca456. Configure here.
There was a problem hiding this comment.
Fixed in 33d6897 — the locked dependency install now passes explicit production PyPI index flags, so the TestPyPI ARGs no longer leak in via pip's env vars.
| if [ ! -z "$SDK_VERSION" ]; then \ | ||
| pip install --index-url ${PIP_INDEX_URL} --extra-index-url ${PIP_EXTRA_INDEX_URL} socketdev==${SDK_VERSION}; \ | ||
| fi; \ | ||
| pip check; \ |
There was a problem hiding this comment.
SDK override fails pip check
Medium Severity
SDK_VERSION still overlays socketdev, but the new pip check runs afterward while socketsecurity now requires socketdev==3.4.2 exactly. Any override other than 3.4.2 makes pip check fail and aborts the image build. deploy-test-docker.sh always supplies a TestPyPI SDK version, so that path breaks.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 51ca456. Configure here.
There was a problem hiding this comment.
Fixed in 33d6897 — pip check now runs before the SDK_VERSION override, so preview SDK builds that deviate from the exact pin still work.
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>


Summary
Pins the Python dependency chain at all three points where versions could previously resolve loose (CE-359):
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.4.2(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.
Bumps version to 2.5.10 with a changelog entry.
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.4.2 (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.4.2resolvable from PyPI.socketcli --versionentrypoint works in the synced environment.Refs CE-359.
🤖 Generated with Claude Code
Note
Medium Risk
Changes how dependencies are resolved in production Docker builds and bumps the socketdev SDK; misaligned lock/metadata could fail builds or pip check, but scan logic is untouched.
Overview
Release 2.5.10 locks down the Python supply chain: every runtime dependency in
pyproject.tomlis pinned to an exact version (includingsocketdev==3.4.2),bs4is replaced by a directbeautifulsoup4pin, andhatchlingis pinned for builds.Docker image builds no longer resolve transitive deps from PyPI at build time. They export the committed
uv.lockto a hashed requirements file, install withpip install --require-hashes --no-deps, installsocketsecuritywith--no-deps, runpip check, and pin the copieduvimage to0.10.4.uv.lockand changelog are updated accordingly; no application code behavior changes beyond the version string.Reviewed by Cursor Bugbot for commit 51ca456. Configure here.