Repository navigation
core: harden npm install against supply-chain attacks - #22245
Conversation
✅ Deploy Preview for authentik-storybook ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
✅ Deploy Preview for authentik-integrations ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
a162cfd to
67c58a6
Compare
✅ Deploy Preview for authentik-docs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
67c58a6 to
bab806f
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #22245 +/- ##
=======================================
Coverage 93.29% 93.30%
=======================================
Files 1028 1028
Lines 59889 59888 -1
Branches 400 400
=======================================
+ Hits 55872 55876 +4
+ Misses 4017 4012 -5
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
| audit=true | ||
|
|
||
| # Suppress funding banners. | ||
| fund=false |
There was a problem hiding this comment.
| fund=false | |
| fund=true |
Honestly... Might as well.
There was a problem hiding this comment.
While most packages have good intentions, the attack surface is viable for external links and prompt injection.
There was a problem hiding this comment.
Oh oops i completely misread it. figured it was disable funding and not enable. Yea better keep this off
There was a problem hiding this comment.
Thanks for the explanation. I was just as confused as Dominic.
|
authentik PR Installation instructions Instructions for docker-composeAdd the following block to your AUTHENTIK_IMAGE=ghcr.io/goauthentik/dev-server
AUTHENTIK_TAG=gh-1f8f0b73e740dbf9dfeb3287d00003efd1f19d19
AUTHENTIK_OUTPOSTS__CONTAINER_IMAGE_BASE=ghcr.io/goauthentik/dev-%(type)s:gh-%(build_hash)sAfterwards, run the upgrade commands from the latest release notes. Instructions for KubernetesAdd the following block to your authentik:
outposts:
container_image_base: ghcr.io/goauthentik/dev-%(type)s:gh-%(build_hash)s
global:
image:
repository: ghcr.io/goauthentik/dev-server
tag: gh-1f8f0b73e740dbf9dfeb3287d00003efd1f19d19Afterwards, run the upgrade commands from the latest release notes. |
bab806f to
2986f58
Compare
✅ Deploy Preview for authentik-docs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
a68b6af to
f6bb175
Compare
| @@ -0,0 +1,22 @@ | |||
| # Block lifecycle scripts (preinstall/install/postinstall/prepare) from | |||
There was a problem hiding this comment.
Let's add this to CODEOWNERS as well
| # `ignore-scripts=true` to block dependency lifecycle scripts by default; | ||
| # this list is rebuilt explicitly with scripts re-enabled. Audit any | ||
| # additions: each entry runs arbitrary code at install time. | ||
| TRUSTED_INSTALL_SCRIPTS := esbuild chromedriver tree-sitter tree-sitter-json |
There was a problem hiding this comment.
just out of curiosity is there any risk these packages could be compromised? I assume it doesn't matter at all cause of the cooldown period?
There was a problem hiding this comment.
The supply chain reliability for these is pretty damned strong, given how much is dependent on them. Someone would have to compromise them internally, but that's true of any dependency.
f6bb175 to
810c02a
Compare
kensternberg-authentik
left a comment
There was a problem hiding this comment.
These changes look good; I like Marc's suggestion, and maybe have a follow-up with docs about the development environment.
| audit=true | ||
|
|
||
| # Suppress funding banners. | ||
| fund=false |
There was a problem hiding this comment.
Thanks for the explanation. I was just as confused as Dominic.
| # `ignore-scripts=true` to block dependency lifecycle scripts by default; | ||
| # this list is rebuilt explicitly with scripts re-enabled. Audit any | ||
| # additions: each entry runs arbitrary code at install time. | ||
| TRUSTED_INSTALL_SCRIPTS := esbuild chromedriver tree-sitter tree-sitter-json |
There was a problem hiding this comment.
The supply chain reliability for these is pretty damned strong, given how much is dependent on them. Someone would have to compromise them internally, but that's true of any dependency.
| for awhile, but at least let's get started. | ||
|
|
||
| # Setup | ||
|
|
There was a problem hiding this comment.
Should this also go into the docs for "front-end development" and "full development environments"?
810c02a to
2b7a0d2
Compare
Set ignore-scripts=true at the repo root, plus engine-strict, save-exact, audit, and prefer-offline. This neutralizes the dominant npm supply-chain attack vector — postinstall scripts in transitive dependencies — at the cost of requiring an explicit rebuild for the handful of packages that legitimately need install scripts (esbuild, chromedriver, tree-sitter, tree-sitter-json). The next commit wires that rebuild into the Makefile. Co-Authored-By: Playpen Agent <[email protected]>
2114157 to
814c4cd
Compare
Make docs-install depend on a new root-node-install so the root deps are guaranteed before the website install runs, removing the need for the website/preinstall lifecycle script. Rebuild the small audited list of trusted packages (esbuild, chromedriver, tree-sitter, tree-sitter-json) after the web install so ignore-scripts=true remains the only path that needs maintenance. web/README documents the new workflow. Co-Authored-By: Playpen Agent <[email protected]>
814c4cd to
1f8f0b7
Compare
* main: (43 commits) website/docs: fix email link in CVE-2026-40166 (#22331) website/docs: add that the Grant Types are now on UI (#22315) core: bump ujson from 5.12.0 to 5.12.1 in the uv group across 1 directory (#22329) core: harden npm install against supply-chain attacks (#22245) core: bump django-stubs[compatible-mypy] from 6.0.3 to 6.0.4 (#22319) ci: bump taiki-e/install-action from 2.77.3 to 2.77.4 in /.github/actions/setup (#22321) endpoints: remove `print` line (#22325) website/docs: release notes 2026.5: add section about package reduction (#22308) core, web: update translations (#22318) stages/authenticator_webauthn: Update FIDO MDS3 & Passkey aaguid blobs (#22322) website/docs: Add invitation wizard docs (#22069) website/docs: release notes for 2025.12.5 and 2026.2.3 (#22310) internal: Automated internal backport: CVE-2026-41569.sec.patch to authentik-main (#22301) internal: Automated internal backport: CVE-2026-42849.sec.patch to authentik-main (#22303) internal: Automated internal backport: CVE-2026-40166.sec.patch to authentik-main (#22299) internal: Automated internal backport: GHSA-973w-j457-rp2m.sec.patch to authentik-main (#22305) internal: Automated internal backport: CVE-2026-41577.sec.patch to authentik-main (#22302) website/docs: add mention of drop-down menu, update multiple Integration Guides (#22269) website/docs: edit docs about how to add user/service account (#22228) website/docs: 2026.5 release notes: fix performance improvements wording (#22307) ...
Details
This PR adds a repo-root
.npmrcthat setsignore-scripts=true, neutralizing the dominant npm supply-chain attack vector (malicious lifecycle scripts in transitive dependencies)engine-strict,save-exact,audit, andprefer-offlineto the same.npmrcfor tighter install hygieneroot-node-installtarget out ofnode-install, makesdocs-installdepend on it, and explicitly rebuilds a small audited allowlist (esbuild,chromedriver,tree-sitter,tree-sitter-json) after the web install — these are the only dependencies whose install scripts are actually required for the toolchain to functionwebsite/package.jsonpreinstallhook now that the same orchestration lives inmakeweb/README.md, including the exactnpm rebuildincantation for anyone who bypassesmakeWhy
Two practical motivations:
Defense in depth on every install. Without
ignore-scripts=true, a single compromised transitive dependency can run arbitrary code on every contributor and CI machine duringnpm ci. The lifecycle-script vector has been used in real attacks (event-stream,ua-parser-js, the recentnpm-debugcluster). This change makes that vector a non-default behavior we opt back into for an explicit, audited list.Predictable orchestration. The previous
website/preinstallhook chainednpm ci --prefix ..to make sure root deps existed before the website install. That worked but was invisible: it fired on everynpm installinwebsite/, didn't respect--ignore-scripts, and depended on developers starting from the right directory. Moving the dependency intomakemakes it explicit, composable, and auditable.