CI hardening: dependency bot token, apt signing key, CSP test #996
No reviewers
Labels
No labels
accessibility
authentication
breaking change
bug
documentation
enhancement
interface
internationalisation
observability
performance
security
tier
1
tier
2
tier
3
tier/4
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
Postulo/postulo!996
Loading…
Reference in a new issue
No description provided.
Delete branch "sec2-e2-ci-hardening"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
CI hardening for three SEC2 findings.
#975 (Medium), the dependency workflow.
dependencies.ymlis now two jobs.upgradeholds no secret: it resolves, installs and tests the new lock, then uploadsuv.lockand the pre-commit config as an artifact (upload-artifact@v3, likeci.yml).propose(needs: upgrade) starts from a fresh container and a clean checkout, runs nouv,pytestor anything from the new packages, requires the artifact to be exactly two regular files, lets the pre-commit file move at most one line, fails ifgit status --porcelainnames anything but the two files, runs every git command with-c core.hooksPath=/dev/null, and is the only job that referencesDEPENDENCIES_TOKEN.tests/test_tooling.pyreads the workflow and asserts all of that (it fails on the old file). zizmor 1.30.1 with.forgejo/zizmor.ymlreports nothing.#981, the PGDG apt key. Took the issue's first option:
docker/apt.postgresql.org.ascis committed,COPYed into the runtime stage and installed by the CI job; nothing downloads a key. No new apt package:tests/test_image_build.pycomputes the OpenPGP v4 fingerprint of the file in Python and compares it with PostgreSQL's published B97B0AFCAA1A47F044F244A07FCC7D46ACCC4CF8 (also checked withgpg --show-keys), and fails if the Dockerfile orci.ymlfetch a key.#984, the CSP test. The hand copy is gone.
strict_cspnow only asserts that the policy in force isbase.SECURE_CSP, the one policy every settings module inherits, so the file holds no directive literals. I did not add the map page or a preview frame (optional in the issue): the map page loads tiles and I could not run the browser here.Closes #975, Closes #981, Closes #984
Tested. Whole unit suite locally after
messages.py compile(the only failures of a first run were 25 tests needing the compiled catalogues, which CI compiles; they pass once compiled), ruff,makemigrations --check,messages.py extract --check, zizmor. Only CI can prove: the e2e CSP tests (browser job, read it carefully:tests/e2e/test_csp.pychanged), the PostgreSQL job and image build using the committed key, and the artifact hand-over between the two jobs on this Forgejo. The dependency workflow can only be exercised by a manual dispatch (Actions > Dependencies > Run workflow) by the owner; I did not run it.🤖 Generated with Claude Code
ed7278054cab40b27a89