chocolatey / package-validator

Windows service to validate packages conform to package standards
Apache License 2.0
31 stars 29 forks source link

Valid URL results in 404 result #222

Closed gep13 closed 4 years ago

gep13 commented 4 years ago

As reported here:

https://twitter.com/moontear/status/1220690603924697092

This URL:

https://www.microsoft.com/en-us/edge

Is not validating correctly.

Checking the logs for package-validator, the URL results in a 404 response from the server, but loading it in the browser works fine.

gep13 commented 4 years ago

Digging into this, I can replicate the issue in Fiddler. Inspecting the headers for a valid request:

image

And a failing one:

image

One thing that is different is the User Agent.

gep13 commented 4 years ago

Switching the User Agent to the same that comes from the request in Google Chrome:

image

Makes it work.

We discussed this previously, and suggested that setting the User Agent to something specific to Package Validator would make sense, but this looks like a specific example where this breaks the URL validation.

I am going to switch this to use the same string that Chrome emits:

Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.130 Safari/537.36