jberezanski / ChocolateyPackages

Chocolatey packages maintained by me
MIT License
83 stars 51 forks source link

`Add-VisualStudioComponent` fails with empty checksum #131

Closed giggio closed 1 year ago

giggio commented 1 year ago

After running:

Add-VisualStudioComponent -PackageName dummy -Component Component.Dotfuscator -VisualStudioYear 2022 -ApplicableProducts Community -Verbose

You get an error message (partial logs):

VERBOSE: Local cached file 'C:\Users\ContainerAdministrator\AppData\Local\Temp\chocolatey-visualstudio.extension\ChannelManifest_574806083.man' does not
exist
VERBOSE: Downloading the manifest file (channel manifest)
Downloading channel manifest
  from 'https://aka.ms/vs/17/release/channel'

Download of ChannelManifest_574806083.man (70.4 KB) completed.
WARNING: Missing package checksums are not allowed (by default for HTTP/FTP,
 HTTPS when feature 'allowEmptyChecksumsSecure' is disabled) for
 safety and security reasons. Although we strongly advise against it,
 if you need this functionality, please set the feature
 'allowEmptyChecksums' ('choco feature enable -n
 allowEmptyChecksums')
 or pass in the option '--allow-empty-checksums'. You can also pass
 checksums at runtime (recommended). See choco install -? for details.
This package downloads over HTTPS but does not yet have package checksums to verify the package. We recommend asking the maintainer to add checksums to this
package. In the meantime if you need this package to work correctly, please enable the feature allowEmptyChecksumsSecure, provide the runtime switch
'--allow-empty-checksums-secure', or pass in checksums at runtime (recommended - see 'choco install -?' / 'choco upgrade -?' for details).

I traced the problem to this line: https://github.com/jberezanski/ChocolateyPackages/blob/master/chocolatey-visualstudio.extension/extensions/Get-VSManifest.ps1#L69

Even setting choco feature enable -n allowEmptyChecksums is not helping.

It seems that maybe this cmdlet is not usable because of the checksum, which seems to be something new in Chocolatey.

I have found a workaround:

$env:ChocolateyIgnoreChecksums = 'true'

Still, there should be a better way to do this.

jberezanski commented 1 year ago

As suggested in the message from Chocolatey, please try enabling the allowEmptyChecksumsSecure feature (not allowEmptyChecksums). The extension downloads multiple data files (via HTTPS) without prior knowledge of their checksums, so it will not function correctly with this feature disabled. (Note that the allowEmptyChecksumsSecure feature is enabled by default.)