Skip to content

Commit 376cb0a

Browse files
committed
feat(yarn2): Disable the execution of postinstall scripts
Use the `YARN_ENABLE_SCRIPTS` environment variable to disable the execution of postinstall scripts for security reasons. Signed-off-by: Martin Nonnenmacher <martin.nonnenmacher@bosch.com>
1 parent 483215f commit 376cb0a

File tree

1 file changed

+4
-0
lines changed
  • plugins/package-managers/node/src/main/kotlin/yarn2

1 file changed

+4
-0
lines changed

plugins/package-managers/node/src/main/kotlin/yarn2/Yarn2.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,10 @@ class Yarn2(override val descriptor: PluginDescriptor = Yarn2Factory.descriptor,
186186
"install",
187187
workingDir = workingDir,
188188
environment = mapOf(
189+
// Disable the execution of postinstall scripts for security reasons.
190+
// See: https://yarnpkg.com/configuration/yarnrc#enableScripts
191+
"YARN_ENABLE_SCRIPTS" to "false",
192+
189193
// Set the node linker to "node-modules" as the "node_modules" directory is required by this class to
190194
// filter out optional dependencies that were not installed.
191195
// See: https://yarnpkg.com/features/linkers

0 commit comments

Comments
 (0)