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

Get-ChocolateyWebFile should pass the Options parameter to Get-WebFileName and Get-WebHeaders #3191

Open
4 tasks done
mymasse opened this issue Jun 2, 2023 · 0 comments · May be fixed by #3395
Open
4 tasks done

Comments

@mymasse
Copy link

mymasse commented Jun 2, 2023

Checklist

  • I have verified this is the correct repository for opening this issue.
  • I have verified no other issues exist related to my problem.
  • I have verified this is not an issue for a specific package.
  • I have verified this issue is not security related.

What You Are Seeing?

We use chocolatey on an Air-gapped network for which we upload the nuget packages to our Artifactory server. This server requires basic authentication to access any resources.

We modify the nuget packages install scripts so that calls to Install-Chocolateypackage use the Options parameter in which we add an Authorization Headers.

This works fine and downloads the packages correctly, however it triggers errors which could be avoided.

What is Expected?

No errors are generated when download packages using Authorization headers.

How Did You Get This To Happen?

  1. Modify a package to add the 'Options' parameter with and Authorization header
  2. Upload this package to a repository requiring basic auth
  3. choco install <package>

System Details

  • Operating System: 10.0.19045.0
  • Windows PowerShell version: 5.1.19041.2673
  • Chocolatey CLI Version: 2.0.0
  • Chocolatey Licensed Extension version: N/A
  • Chocolatey License type: N/A
  • Terminal/Emulator: Microsoft Terminal

Installed Packages

N/A

Output Log

- Running Get-WebFileName -url <URL> -defaultName <NAME>
- Url request/response fialed - file name will be <NAME>: Exception calling "GetResponse" with "0" argument(s): "The remote servier returned an error: (401) Unauthorized."
- Running Get-WebHeaders -url <URL> -ErrorAction 'Stop'
- Setting the UserAgent to 'chocolatey command line'
- Request Header:
-   'Accept':'*/*'
-   'User-Agent':'chocolatey command line'
- Attempt to get header for <URL> failed.
The remote file tierh doesn't exist, is unauthorized, or is forbidden for url <URL>. Exception calling "GetResponse" with "0" argument(s): "The remote servier returned an error: (401) Unauthorized."

Additional Context

The following should allow receiving Options

  • Get-WebHeaders
  • Get-WebFileName

The following should be changed to pass the Options

@mymasse mymasse added the Bug label Jun 2, 2023
@pauby pauby added Improvement and removed Bug labels Jun 3, 2023
flcdrg added a commit to flcdrg/choco that referenced this issue Feb 12, 2024
@flcdrg flcdrg linked a pull request Feb 12, 2024 that will close this issue
10 tasks
flcdrg added a commit to flcdrg/choco that referenced this issue Jun 10, 2024
flcdrg added a commit to flcdrg/choco that referenced this issue Sep 15, 2024
flcdrg added a commit to flcdrg/choco that referenced this issue Sep 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants