Skip to content

fix(security): pin pip dependencies by hash for reproducible builds#40

Merged
hubertlim merged 1 commit into
mainfrom
fix/pin-pip-dependencies-by-hash
May 27, 2026
Merged

fix(security): pin pip dependencies by hash for reproducible builds#40
hubertlim merged 1 commit into
mainfrom
fix/pin-pip-dependencies-by-hash

Conversation

@hubertlim

Copy link
Copy Markdown
Owner

Summary

Resolves the 6 remaining Scorecard PinnedDependenciesID alerts that flagged unpinned pip install commands.

Changes

  • Generate hash-locked .lock files using pip-compile --generate-hashes:
    • requirements.lock (runtime deps)
    • requirements-dev.lock (test deps)n - requirements-ci.lock` (CI tools: ruff, pip-audit, pip-tools)
  • Update Dockerfile and CI workflow to install with --require-hashes, which causes pip to refuse any package that doesn't match the recorded SHA256 hash
  • Add make lock-deps target to regenerate locks when source .txt files change

Workflow

  • .txt files: human-edited source of truth (top-level deps with version pins)
  • .lock files: generated, contain SHA256 hashes for every transitive dependency
  • Dependabot continues to update .txt; running make lock-deps regenerates .lock

Address Scorecard PinnedDependenciesID alerts for pipCommand findings:

- Generate hash-locked .lock files via pip-compile (pip-tools)
  - requirements.lock (runtime deps)
  - requirements-dev.lock (test deps)
  - requirements-ci.lock (CI tools: ruff, pip-audit, pip-tools)
- Update Dockerfile and CI workflow to install with --require-hashes
- Add 'make lock-deps' target to regenerate lock files when source
  requirements files change

.txt files remain as the human-edited source of truth; .lock files are
generated from them and contain SHA256 hashes for every transitive
dependency. This satisfies Scorecard's pip pinning checks and ensures
bit-for-bit reproducible builds.
@hubertlim hubertlim merged commit f87900f into main May 27, 2026
8 checks passed
@hubertlim hubertlim deleted the fix/pin-pip-dependencies-by-hash branch May 27, 2026 07:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant