chocolatey / choco

Chocolatey - the package manager for Windows
https://chocolatey.org
Other
10.11k stars 893 forks source link

On package update, recognize and inform users if an installer script has not changed #1911

Open KirkMunro opened 4 years ago

KirkMunro commented 4 years ago

Whenever I install or update packages using choco, I always review the installation scripts. This becomes very tedious on updates, because often the script itself does not change at all -- the bits that are installed change, which may mean some file names/URLs have changed, but the script that does the installation does not change, so I end up reviewing the same code over and over again, and that's just something to make my eyes glaze over and I may miss something important.

It would be very helpful if choco, on update, could recognize if a given script did or did not change since the last version of the package was installed, and notify me appropriately. Presumably if I trusted the script before, I trust it still, especially if it did not change. This way my choco updates would be much easier to review/approve, and I could focus my attention on scripts that actually changed when I update installed packages.

vexx32 commented 4 years ago

Would be very cool to have a basic diff display if needed for install scripts that have changed. 🤔

ferventcoder commented 4 years ago

Thanks for writing that up!

majkinetor commented 4 years ago

This is nice security idea, might not be so trivial to implement tho. It could also be implmented as PoC outside of choco, by for example hooking cup bat script.

For example, in cup.bat

It would be very helpful if choco, on update, could recognize if a given script did or did not change since the last version of the package was installed, and notify me appropriately.

Notify is one option but leaving it only one is meh. Cup should have option to abort install of changed packages until run with force or something.

KirkMunro commented 4 years ago

I wonder if tying in a PowerShell Gallery here would help. Scripts are versioned in the Gallery, downloadable from a Gallery, and Choco could leverage the public one or offer its own. Just thinking an idea out loud.

Leveraging a gallery and isolating installer scripts could also help for installers that use a boilerplate shared script, passing in a JSON payload that defines what to install into a script that they download.

majkinetor commented 4 years ago

I don't like it, many do not use gallery.

TheCakeIsNaOH commented 4 years ago

This could be included as an extension without too much difficulty if https://github.com/chocolatey/choco/issues/1911 is implemented.