build: lock Python runtime and development dependencies with hashes - #336
build: lock Python runtime and development dependencies with hashes#336m-khan-97 wants to merge 2 commits into
Conversation
Signed-off-by: Muhammad Ibrahim <135441675+m-khan-97@users.noreply.github.com>
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.OpenSSF ScorecardScorecard details
Scanned Files
|
Signed-off-by: Muhammad Ibrahim <135441675+m-khan-97@users.noreply.github.com>
|
CI caught an integration mistake in my lock-check setup: creating .lock-tools inside the checkout caused the existing credential scan to inspect pip/setuptools placeholder strings. I have moved the tool environment into RUNNER_TEMP and added a regression assertion for that boundary. The credential scan and its patterns are unchanged. All 19 focused dependency/container-configuration tests and lint/format checks pass locally. The new commit triggers a fresh CI run. |
parthrohit22
left a comment
There was a problem hiding this comment.
Reviewed 9358488. The three-tier split (runtime / dev constrained to -c requirements.txt / isolated lock tooling in requirements-lock.*) is the right shape, and the enforcement is consistent across the surfaces that matter: --require-hashes --only-binary=:all: in the Dockerfile, all four render.yaml build commands, the CI installs, and deploy.yml, each followed by pip check.
Verified locally:
requirements.txtpins 66 packages, every one carrying--hash=sha256:lines; every direct dependency inrequirements.inis present as an==pin in the lock.- All 12
tests/test_dependency_locks.pypass, including the offline mismatched-wheel-hash rejection. scripts/lock_dependencies.py --checkseeds the temp resolve with the committed.txtfiles, so only a genuine input change (not a new upstream release) makes the gate fail — that's the usual pip-tools-in-CI failure mode handled well.- All 21 PR checks are green, including Container Scan (Trivy), SCA (pip-audit) with the existing exception args, and Rule & Compliance Validation (which runs the lock check).
Non-blocking:
- The
Install rufflint step now installs the fullrequirements-dev.txt(runtime + ~40 Azure SDKs + pytest) under--require-hashesjust to getruff. It works, but aruff-only pinned+hashed input would keep the lint job lean and independent of the runtime resolution. lock_dependencies.py --checkstill needs PyPI reachable to re-resolve changed inputs; a registry outage fails that step even when the locks are correct. The seed-with-committed-locks logic keeps this to genuine input diffs, so acceptable — a one-line note in the CI step would set expectations.- Dockerfile's
pip==26.1.2 setuptools==83.0.0 wheel==0.46.3bootstrap is still unhashed. The PR body scopes this out explicitly; flagging only so it's a recorded boundary. .python-version(3.11) is enforced only bylock_dependencies.py, and only for lock generation. The DockerfileFROMand CIsetup-pythonstill name their versions independently. Consistent today; an assertion that the Dockerfile base tracks.python-versionwould harden against future drift.
None of these block. Approving.
What changed
I am taking the dependency-reproducibility slice of #304. Production currently installs test tools and resolves transitive dependencies afresh; this makes a successful CI run less useful as evidence for the next deployment.
Existing exact direct runtime pins are preserved. Previously open ranges and transitive dependencies now have explicit versions. No scanner features, live cloud settings, review-policy changes or new vulnerability exceptions are included.
Validation
--require-hashes --only-binary=:all:andpip checkpassed.git diff --checkpassed.Limits and review notes
Docker is unavailable locally, so the existing container runtime/scan CI job must validate the image. Live Azure, PostgreSQL integration and deployment were not exercised locally. Before deployment, verify that a Render dashboard
PYTHON_VERSIONdoes not override.python-version.This does not claim a fully reproducible container: base-image/OS packages and the existing pip/setuptools/wheel bootstrap remain separate work. Security-scanner tooling also retains its existing independent environments.
Refs #304 — intentionally not closing it. Deployment topology, release provenance, backup/restore drills and operations acceptance criteria remain open.
Dependencies
Depends-On: none