Update npm plugin to fix double temp file read issue - #662
Merged
scottisloud merged 1 commit intoAug 31, 2026
Conversation
scottisloud
approved these changes
Aug 31, 2026
scottisloud
left a comment
Contributor
There was a problem hiding this comment.
No concerns - Custom provisioner looks straightforward and aligns with many other existing provisioner patterns, so not requesting additional security review.
LGTM
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
I originally introduced this plugin in #658
While recently using the plugin I discovered an issue with the temp file approach related to consuming more than once.
This arose in version pinning of package managers.
When a version of npm or pnpm is specified inside the package.json
e.g.
{ "packageManager": "pnpm@11.24.0" }and this version differs from the global version on the system, the default behaviour is corepack downloads that missing version and spawns a child process using that version.
So the process looks like
The issue here is the temp file 1Password creates is only readable once as a stream. The parent process consumes it, then the child attempts to read it also and hangs indefinitely.
This also occurs with other double read cases (see testing)
This resolves that issue by instead leveraging env vars which do persist to the child process.
Type of change
How To Test
With the previous version of the plugin built you can reproduce the issue with the following
Repro Example 1
{ "name": "npm-fifo-repro", "version": "1.0.0", "private": true, "scripts": { "preinstall": "npm whoami" } }npm installRepro Example 2 (pnpm)
assuming your global pnpm version !== 11.22.0 (otherwise just alter packageManager so not equal to global version)
{ "name": "pnpm-fifo-repro", "version": "1.0.0", "private": true, "packageManager": "pnpm@11.22.0" }pnpm whoamiBoth of these configurations should not hang after rebuilding this version of the plugin
Changelog
Switch to env based approach for npm plugin, resolving file drain process hang issue.