svelte-preprocess icon indicating copy to clipboard operation
svelte-preprocess copied to clipboard

security: remove `postinstall` script in favor of `prepublish` script

Open coolaj86 opened this issue 8 months ago • 2 comments

(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.

coolaj86 avatar Oct 21 '23 18:10 coolaj86

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 avatar Dec 17 '23 11:12 dominikg

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

dominikg avatar Dec 17 '23 11:12 dominikg