Skip to content

Commit 3537ea5

Browse files
GirlBossRushplaypen-agentdewi-tik
authored
website/docs: document npm install-script blocking (#22461)
* website/docs: document npm install-script blocking The repo's `.npmrc` sets `ignore-scripts=true` to neutralize the dominant npm supply-chain attack pattern (preinstall/postinstall payloads, as used by the recent "Shai-Hulud" and "Mini Shai-Hulud" incidents). The trade-off is that a handful of packages that ship native binaries — esbuild, chromedriver, tree-sitter — need to be rebuilt explicitly when their install step is required. Today this is implicit; a new contributor whose build fails because esbuild's binary didn't unpack has no obvious next step except to disable the protection. Documenting it in both setup guides points them at `npm rebuild --foreground-scripts <pkg>` and makes the "don't flip `ignore-scripts` off" guidance explicit. No code or config changes — docs only. Co-authored-by: Agent <279763771+playpen-agent@users.noreply.github.com> * Use separate file. * Apply suggestions from code review Co-authored-by: Dewi Roberts <dewi@goauthentik.io> Signed-off-by: Dewi Roberts <dewi@goauthentik.io> --------- Signed-off-by: Dewi Roberts <dewi@goauthentik.io> Co-authored-by: Agent <279763771+playpen-agent@users.noreply.github.com> Co-authored-by: Dewi Roberts <dewi@goauthentik.io>
1 parent 9efb6c3 commit 3537ea5

4 files changed

Lines changed: 19 additions & 1 deletion

File tree

website/docs/developer-docs/contributing.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ When you are creating an enhancement suggestion, please fill in [the template](h
120120

121121
authentik can be run locally, although depending on which part you want to work on, different prerequisites are required.
122122

123-
This is documented in the [developer docs](./setup/frontend-dev-environment.md).
123+
This is documented in the [developer docs](./setup/frontend-dev-environment.mdx).
124124

125125
### Help with the docs
126126

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
:::info NPM install scripts are disabled by default
2+
The repository's NPM runtime configuration file (`.npmrc`) sets `ignore-scripts=true`. This means that `preinstall`/`install`/`postinstall` lifecycle scripts do not run during `npm ci`. This neutralizes a dominant NPM supply-chain attack pattern at the cost of skipping a few legitimate native-binary unpacks.
3+
4+
If the watch build fails because a package needs its install script (commonly `esbuild`, `chromedriver`, `tree-sitter`, or `tree-sitter-json`), rebuild only that package, for example:
5+
6+
```shell
7+
npm rebuild --foreground-scripts esbuild chromedriver tree-sitter tree-sitter-json
8+
```
9+
10+
**Do not** edit `.npmrc` to flip `ignore-scripts` off — that re-introduces the risk repository-wide.
11+
:::

website/docs/developer-docs/setup/frontend-dev-environment.md renamed to website/docs/developer-docs/setup/frontend-dev-environment.mdx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ tags:
88
- docker
99
---
1010

11+
import NPMInstallScriptsAdmonition from "./\_npm-install-scripts-admonition.mdx";
12+
1113
If you're focusing solely on frontend development, you can create a minimal development environment using Docker and Node.js. This setup allows you to make and preview changes to the frontend in real-time, without needing to interact with the backend.
1214

1315
### Prerequisites
@@ -55,6 +57,8 @@ If you're focusing solely on frontend development, you can create a minimal deve
5557
make web-watch
5658
```
5759

60+
<NPMInstallScriptsAdmonition />
61+
5862
5. In a new terminal, navigate to the cloned repository root and start the backend containers with Docker Compose.
5963

6064
```shell

website/docs/developer-docs/setup/full-dev-environment.mdx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ tags:
1111

1212
import TabItem from "@theme/TabItem";
1313
import Tabs from "@theme/Tabs";
14+
import NPMInstallScriptsAdmonition from "./\_npm-install-scripts-admonition.mdx";
1415

1516
## Prerequisites
1617

@@ -126,6 +127,8 @@ Install all required JavaScript and Python dependencies and create an isolated P
126127
make install
127128
```
128129

130+
<NPMInstallScriptsAdmonition />
131+
129132
### Generate development configuration
130133

131134
Create a local configuration file that uses the local databases for development:

0 commit comments

Comments
 (0)