CI: the Security job installs the whole project and every npm package only to audit two lock files #1166
Labels
No labels
accessibility
authentication
breaking change
bug
documentation
enhancement
interface
internationalisation
observability
performance
security
tier
1
tier
2
tier
3
tier/4
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
Postulo/postulo#1166
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
This issue holds 2 findings of the audit that share one fix or the same files.
C3: CI: the Security job installs the whole project to run pip-audit over an exported lock
What exists today
.forgejo/workflows/ci.yml:688-691:uv exportreadsuv.lockand needs no environment.uv runinside the project does: it first syncs the project environment with the default groups (dev,e2e), which onnode:22-bookwormmeans downloading a managed Python 3.14 (the image's Python 3.11 is belowrequires-python) and every locked package, building Postulo as an editable package, and only then layering pip-audit on top. pip-audit never looks at that environment: it audits the file given with-r.#1033's table gives the audit step 33 s. With
-rand no hashes, pip-audit also resolves the requirements through pip in a temporary virtual environment of its own, which downloads the packages a second time.What would change
uvx pip-audit==2.10.1 ...(uv tool run), which runs the pinned tool in its own environment and does not touch the project. It can run on the image's own Python.--disable-pip --no-deps: the export already lists every transitive pin, so pip-audit has nothing to resolve. Keep--strict; the set audited must stay exactly the exported lock, andtests/test_security_audit.pyshould still pass. If markers in the export (; python_version < '3.14') trouble--disable-pip, keep the pip resolve.What it saves or protects
small: a managed Python download (34 MB), about 100 packages and an editable build skipped per run; the pip resolve inside pip-audit may be most of the step's 33 s (unmeasured)
Accessibility
none
Decisions
--disable-pip --no-deps? Recommended: only if one run shows the same findings list and a shorter step.C4: CI: the Security job runs
npm cionly so thatnpm auditcan read the lockWhat exists today
.forgejo/workflows/ci.yml:693-696:package-lock.json(39 KB, 73 entries underpackages) is everythingnpm auditreports on.npm auditbuilds its tree from the lock when told to with--package-lock-only, which npm documents for exactly this ("only use the package-lock.json, ignore node_modules").npm ciinstalls every devDependency, Tailwind's native binaries included;node_modulesis 130 MB on the developer's machine. The job has no npm cache, so the install downloads every run. #1033 timednpm ciat 4 s in the browser job, so the saving is seconds, not minutes.What would change
npm audit --package-lock-only --audit-level=high, withoutnpm ci. Same advisories, same lock, same threshold. Belongs in the same pull request as C3.What it saves or protects
small: one
npm ciof 73 locked packages (about 130 MB unpacked locally) skipped per run, a few secondsAccessibility
none
Decisions
Found by the efficiency and reliability audit of 2026-10-30 (finding C3, C4; index postulo/postulo#1108). Checked against
mainatdaee30b15(2026-10-30).