Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

security: remove postinstall script in favor of prepublish script #615

Open
coolaj86 opened this issue Oct 21, 2023 · 3 comments
Open

security: remove postinstall script in favor of prepublish script #615

coolaj86 opened this issue Oct 21, 2023 · 3 comments

Comments

@coolaj86
Copy link

coolaj86 commented Oct 21, 2023

(socket) [email protected] contains risks:
Install scripts - Install scripts are run when the package is installed. The majority of malware in npm is hidden in install scripts.
Accept risks of installing these packages (y/N)?

See also: @SocketDev

Feature requests and proposals

The postinstall script will always run, even for deeply nested dependencies.

The prepublish script will run when someone is running npm install from the repo, and before npm publish.

Currently the install script is used to write a message to the screen which is not actually necessary for people who have this as a dependency.

@dominikg
Copy link
Member

the message is intended for users, but I agree that it would be better if it was made at runtime if a missing dependency was detected. vite handles this for sass for example, reminding you to install it if you didn't

@dominikg
Copy link
Member

it is however not a security issue in this case as it only runs "echo". You can safely disable this postinstall script with your package manager if it still concerns you

@linonetwo
Copy link

linonetwo commented Oct 26, 2024

postinstall cause install failed

(base) PS C:\Users\linonetwo\Documents\repo-c> pnpm dlx tiddlywiki-plugin-dev@latest init principles
 WARN  3 deprecated subdependencies found: @types/[email protected], [email protected], [email protected]
Packages: +262
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Progress: resolved 296, reused 262, downloaded 0, added 262, done
AppData/Local/pnpm-cache/dlx/lnl3bso5nsziqdo3mm5irqwjda/192c80c5316-55c/node_modules/.pnpm/[email protected][email protected][email protected][email protected]/Local/pnpm-cache/dlx/lnl3bso5nsziqdo3mm5irqwjda/192c80c5316-55c/node_modules/.pnpm/[email protected][email protected][email protected][email protected][email protected]_s_5rjt4kelkk6vyjtbgrhdvx47um/node_modules/svelte-preprocess: Running postinstall script, failed in 4ms
.../node_modules/svelte-preprocess postinstall$ echo "[svelte-preprocess] Don't forget to install the preprocessors packages that will be used: sass, stylus, less…
└─ Failed in 4ms at C:\Users\linonetwo\AppData\Local\pnpm-cache\dlx\lnl3bso5nsziqdo3mm5irqwjda\192c80c5316-55c\node_modules\.pnpm\[email protected][email protected][email protected][email protected][email protected]_s_5rjt4kelkk6vyjtbgrhdvx47um\node_modules\svelte-preprocess
 ELIFECYCLE  Command failed with exit code -4058.

solved after move into optionalDependencies

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

No branches or pull requests

3 participants