]> git.maquefel.me Git - brevno-suite/hugo/commit
Harden Node tool execution with --permission flag
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Sat, 11 Apr 2026 10:41:48 +0000 (12:41 +0200)
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Wed, 22 Apr 2026 13:47:34 +0000 (15:47 +0200)
commita54c398b93821865547a9e21c73aad8a1d7f7bc1
treead2b4f48db8d3bd39f6dc4a2722958e95b66c74b
parentf5fce935e768f4c301fb5c825e512a17f8a13e2e
Harden Node tool execution with --permission flag

Add security.node.permissions config to run Node tools (PostCSS, Babel,
TailwindCSS) under Node's permission model, restricting file system access
to the working directory by default.

The binary resolution is simplified to node_modules/.bin → PATH (npx removed).
For both locations, the actual JS entry point is resolved via symlinks (macOS/Linux)
or by parsing npm wrapper scripts (Windows .cmd), then executed as
"node --permission --allow-fs-read=<path> --allow-fs-write=<path> <script>".

Users can opt out by removing "node" from security.exec.allow.

Closes #7287
16 files changed:
.github/workflows/test.yml
common/hexec/exec.go
common/hexec/exec_integration_test.go [new file with mode: 0644]
common/hexec/exec_test.go [new file with mode: 0644]
common/hugo/hugo.go
config/security/securityConfig.go
config/security/securityConfig_test.go
deps/deps.go
hugolib/filesystems/basefs.go
hugolib/integrationtest_builder.go
markup/asciidocext/asciidoc_integration_test.go
resources/resource_transformers/babel/babel.go
resources/resource_transformers/babel/babel_integration_test.go
resources/resource_transformers/cssjs/postcss.go
resources/resource_transformers/cssjs/postcss_integration_test.go
resources/resource_transformers/cssjs/tailwindcss.go