Skip to content

core: harden npm install against supply-chain attacks - #22245

Merged
GirlBossRush merged 4 commits into
mainfrom
core/npm-install-hardening
May 13, 2026
Merged

GirlBossRush merged 4 commits into
mainfrom
core/npm-install-hardening

Conversation

@GirlBossRush

@GirlBossRush GirlBossRush commented May 12, 2026 •

Copy link
Copy Markdown
Contributor

Details

This PR adds a repo-root .npmrc that sets ignore-scripts=true, neutralizing the dominant npm supply-chain attack vector (malicious lifecycle scripts in transitive dependencies)

  • Adds engine-strict, save-exact, audit, and prefer-offline to the same .npmrc for tighter install hygiene
  • Refactors the Makefile to factor a root-node-install target out of node-install, makes docs-install depend 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 function
  • Retires the website/package.json preinstall hook now that the same orchestration lives in make
  • Documents the new install workflow in web/README.md, including the exact npm rebuild incantation for anyone who bypasses make

Why

Two practical motivations:

  1. 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 during npm ci. The lifecycle-script vector has been used in real attacks (event-stream, ua-parser-js, the recent npm-debug cluster). This change makes that vector a non-default behavior we opt back into for an explicit, audited list.

  2. Predictable orchestration. The previous website/preinstall hook chained npm ci --prefix .. to make sure root deps existed before the website install. That worked but was invisible: it fired on every npm install in website/, didn't respect --ignore-scripts, and depended on developers starting from the right directory. Moving the dependency into make makes it explicit, composable, and auditable.

@GirlBossRush
GirlBossRush requested review from a team as code owners May 12, 2026 01:28
@netlify

netlify Bot commented May 12, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for authentik-storybook ready!

Name Link
🔨 Latest commit 2b7a0d2
🔍 Latest deploy log https://app.netlify.com/projects/authentik-storybook/deploys/6a0452aaacc4780008123cc2
😎 Deploy Preview https://deploy-preview-22245--authentik-storybook.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify

netlify Bot commented May 12, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for authentik-integrations ready!

Name Link
🔨 Latest commit 14bd2d7
🔍 Latest deploy log https://app.netlify.com/projects/authentik-integrations/deploys/6a0453055e1e4600086a5e9e
😎 Deploy Preview https://deploy-preview-22245--authentik-integrations.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@GirlBossRush
GirlBossRush force-pushed the core/npm-install-hardening branch from a162cfd to 67c58a6 Compare May 12, 2026 01:31
@netlify

netlify Bot commented May 12, 2026

Copy link
Copy Markdown

✅ Deploy Preview for authentik-docs ready!

Name Link
🔨 Latest commit a162cfd
🔍 Latest deploy log https://app.netlify.com/projects/authentik-docs/deploys/6a028252506537000807089f
😎 Deploy Preview https://deploy-preview-22245--authentik-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@codecov

codecov Bot commented May 12, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.30%. Comparing base (68a6b04) to head (1f8f0b7).
⚠️ Report is 3 commits behind head on main.
✅ All tests successful. No failed tests found.

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     
Flag Coverage Δ
conformance 36.64% <ø> (+<0.01%) ⬆️
e2e 41.90% <ø> (+<0.01%) ⬆️
integration 33.07% <ø> (+<0.01%) ⬆️
rust 0.00% <ø> (ø)
unit 92.19% <ø> (+<0.01%) ⬆️
unit-migrate 92.23% <ø> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Comment thread .npmrc
audit=true

# Suppress funding banners.
fund=false

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
fund=false
fund=true

Honestly... Might as well.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh oops i completely misread it. figured it was disable funding and not enable. Yea better keep this off

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the explanation. I was just as confused as Dominic.

@github-actions

github-actions Bot commented May 12, 2026 •

Copy link
Copy Markdown
Contributor

authentik PR Installation instructions

Instructions for docker-compose

Add the following block to your .env file:

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)s

Afterwards, run the upgrade commands from the latest release notes.

Instructions for Kubernetes

Add the following block to your values.yml file:

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-1f8f0b73e740dbf9dfeb3287d00003efd1f19d19

Afterwards, run the upgrade commands from the latest release notes.

@GirlBossRush
GirlBossRush force-pushed the core/npm-install-hardening branch from bab806f to 2986f58 Compare May 12, 2026 10:30
@netlify

netlify Bot commented May 12, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for authentik-docs ready!

Name Link
🔨 Latest commit 2b7a0d2
🔍 Latest deploy log https://app.netlify.com/projects/authentik-docs/deploys/6a0452aa73d87300084332ac
😎 Deploy Preview https://deploy-preview-22245--authentik-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@GirlBossRush
GirlBossRush force-pushed the core/npm-install-hardening branch 2 times, most recently from a68b6af to f6bb175 Compare May 12, 2026 11:45
Comment thread .npmrc Outdated
@@ -0,0 +1,22 @@
# Block lifecycle scripts (preinstall/install/postinstall/prepare) from

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's add this to CODEOWNERS as well

@rissson rissson left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a welcomed change!

Comment thread Makefile
# `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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@dominic-r dominic-r left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

!!!

@GirlBossRush
GirlBossRush force-pushed the core/npm-install-hardening branch from f6bb175 to 810c02a Compare May 12, 2026 16:17

@kensternberg-authentik kensternberg-authentik left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These changes look good; I like Marc's suggestion, and maybe have a follow-up with docs about the development environment.

Comment thread .npmrc
audit=true

# Suppress funding banners.
fund=false

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the explanation. I was just as confused as Dominic.

Comment thread Makefile
# `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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread web/README.md
for awhile, but at least let's get started.

# Setup

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this also go into the docs for "front-end development" and "full development environments"?

@GirlBossRush
GirlBossRush force-pushed the core/npm-install-hardening branch from 810c02a to 2b7a0d2 Compare May 13, 2026 10:30
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]>
@GirlBossRush
GirlBossRush force-pushed the core/npm-install-hardening branch 2 times, most recently from 2114157 to 814c4cd Compare May 13, 2026 11:46
GirlBossRush and others added 3 commits May 13, 2026 13:47
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]>
@GirlBossRush
GirlBossRush force-pushed the core/npm-install-hardening branch from 814c4cd to 1f8f0b7 Compare May 13, 2026 11:47
@GirlBossRush
GirlBossRush enabled auto-merge (squash) May 13, 2026 12:16
@GirlBossRush
GirlBossRush merged commit 2c3d11a into main May 13, 2026
169 of 170 checks passed
@GirlBossRush
GirlBossRush deleted the core/npm-install-hardening branch May 13, 2026 12:20
kensternberg-authentik added a commit that referenced this pull request May 18, 2026
* 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)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants