Pin dependencies by hash and refuse to follow a rewritten release tag (S7)

pyproject.toml used broad version ranges with no lock file, so two
deployments of the same release could end up with different dependency
versions, and there was no check that a package actually matches what
was reviewed/tested — a compromised or substituted package on the index
could install silently.

requirements.txt and requirements-dev.txt (generated via `pip-compile
--generate-hashes`, see the new README section on regenerating them)
pin every dependency to an exact version with its hash. install.sh and
upgrade.sh now install from requirements.txt with --require-hashes,
then the app itself with --no-deps — a tampered or substituted package
fails the hash check instead of installing.

Both scripts also no longer `git fetch --tags --force`: a plain fetch
refuses to move a tag ref they already have onto a different commit,
so a rewritten/tampered release tag is reported and stops the
deploy/install instead of being silently followed into production.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
ksmithandClaude Sonnet 5 committed 2026-10-31 15:27:29 -06:00
1 parent 03dd37e69d
commit cb5617edb8
6 files changed
+1257 -4

No files matched your search

+13
View File
@@ -33,6 +33,19 @@ python manage.py runserver
Visit `http://localhost:8000/` — you'll land on the first-run setup wizard to
create the instance's admin account.
### Updating pinned dependencies
`requirements.txt`/`requirements-dev.txt` are hash-pinned lock files generated
from `pyproject.toml` — production installs (`scripts/install.sh`,
`scripts/upgrade.sh`) install from `requirements.txt` with `--require-hashes`
rather than re-resolving version ranges at install time. After changing a
dependency in `pyproject.toml`, regenerate both and commit them alongside:
```bash
pip-compile --generate-hashes --allow-unsafe --output-file=requirements.txt pyproject.toml
pip-compile --generate-hashes --allow-unsafe --extra=dev --output-file=requirements-dev.txt pyproject.toml
```
## Tests
```bash