hardening: pin dependencies, Docker images, and CI actions#294
Merged
Conversation
- Pin Docker base image (python:3.12-slim) to SHA256 digest - Pin all GitHub Actions to commit SHAs instead of mutable tags - Replace loose version constraints (>=) with exact versions + hashes via pip-compile (requirements.in -> requirements.txt) - Enable --require-hashes in Dockerfile and CI pip install - Add pip-audit CI job to detect known vulnerabilities in deps - Add Dependabot config for pip, GitHub Actions, and Docker updates - Set default workflow permissions to read-only (contents: read)
- Add requirements-test.txt with hash-pinned pytest + app deps - CI test job now installs all deps via --require-hashes (no unhashed pip install) - Replace manual pip-audit install with pypa/gh-action-pip-audit pinned to SHA
…ble) pygments 2.19.2 has a local-access-only ReDoS in the ADL lexer. No fix released yet, and it only affects test dependencies (via pytest).
Audit only requirements.txt (packages that ship in the Docker image). Test deps in requirements-test.txt are hash-pinned but do not ship to users and are not in scope for production vulnerability auditing.
Regenerate lockfiles with standard pip-compile header so Dependabot detects the pip-compile workflow and re-runs pip-compile instead of editing the lockfiles directly (which would strip hashes).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Supply chain hardening to prevent dependency confusion and compromised package attacks (ref: recent litellm/Trivy incident).
Changes
python:3.12-slimto SHA256 digest instead of mutable tag>=constraints with exact versions + cryptographic hashes viapip-compilerequirements.incontains the human-editable constraintsrequirements.txtis now the machine-generated lockfile with hashes--require-hashesto enforce hash verificationpip-auditjob detects known vulnerabilities on every push/PRcontents: read(principle of least privilege)Updating dependencies
To update dependencies after this change:
Risk
Low. No application logic changed. Docker builds will fail if a dependency hash doesn't match, which is the intended behavior.
Test plan
--require-hashes