NuGet / NuGetGallery

NuGet Gallery is a package repository that powers https://www.nuget.org. Use this repo for reporting NuGet.org issues.
https://www.nuget.org/
Apache License 2.0
1.54k stars 644 forks source link

[NuGet.org Bug]: Obsolete URLs for image hosting (documentation) #9693

Closed raphaelmoreira closed 8 months ago

raphaelmoreira commented 1 year ago

Impact

Other

Describe the bug

On the official website, about how to package a library, in the "Allowed domains for images and badges" section, the following suggested links no longer exist:

Repro Steps

Just access these links.

Expected Behavior

Update documentation and remove the obsolete links

Screenshots

No response

Additional Context and logs

No response

joelverhagen commented 1 year ago

Thanks for bring this to our attention @raphaelmoreira! In general, testing the root path of an allowed image host is not a sufficient test to determine whether the service is active or not. In many cases, a full image URL still works. For example raw.githubusercontent.com has many working URLs such as https://raw.githubusercontent.com/JamesNK/Newtonsoft.Json/master/Doc/icons/logo.jpg.

However, there are indeed some hosts that appear to be retired or down. I wrote a query to find a sample URL for each host.

Query for internal reference ```kusto let AllowedHosts = pack_array( "api.bintray.com", "api.codacy.com", "app.codacy.com", "api.codeclimate.com", "api.dependabot.com", "api.travis-ci.com", "api.travis-ci.org", "api.reuse.software", "app.fossa.io", "app.fossa.com", "badge.fury.io", "badgen.net", "badges.gitter.im", "bettercodehub.com", "buildstats.info", "caniuse.bitsofco.de", "cdn.jsdelivr.net", "cdn.syncfusion.com", "ci.appveyor.com", "circleci.com", "codecov.io", "codefactor.io", "coveralls.io", "dev.azure.com", "flat.badgen.net", "gitlab.com", "img.shields.io", "i.imgur.com", "isitmaintained.com", "opencollective.com", "snyk.io", "sonarcloud.io", "travis-ci.com", "travis-ci.org", "avatars.githubusercontent.com", "raw.github.com", "raw.githubusercontent.com", "user-images.githubusercontent.com", "camo.githubusercontent.com" ); let GithubBadgeUrlRegEx = "^(https|http):\\/\\/github\\.com\\/[^/]+\\/[^/]+(\\/actions)?\\/workflows\\/.*badge\\.svg"; let ImageHostReport = NiPackageReadmes | where isnotempty(Content) | join kind=inner (NiPackageDownloads | distinct LowerId, TotalDownloads) on LowerId | extend Images = extract_all("!\\[([^\\]]*)\\]\\(([^\\)]+)\\)", Content) | where isnotempty(Images) | project Id, Version, LowerId, Identity, TotalDownloads, Images | mv-expand Image = Images | extend ImageAlt = tostring(Image[0]) | extend ImageUrl = tostring(Image[1]) | project-away Images, Image | extend ParsedImageUrl = parse_url(ImageUrl) | extend ImageHost = tolower(tostring(ParsedImageUrl.Host)) | where isempty(ParsedImageUrl.Host) == false | extend AllowedHost = set_has_element(AllowedHosts, ImageHost) and tolower(ParsedImageUrl.Scheme) in ("http", "https") | extend GithubBadge = tolower(ImageUrl) matches regex GithubBadgeUrlRegEx | extend Type = iif(AllowedHost, ImageHost, iif(GithubBadge, "GitHub badge", "Blocked")) | summarize PackageIdCount = dcount(LowerId), (_, SampleId, SampleVersion, SampleUrl) = arg_max(TotalDownloads, Id, Version, ImageUrl) by Type | project-away _ | order by PackageIdCount desc; let QuestionedHosts = pack_array( "api.bintray.com", "api.codeclimate.com", "api.dependabot.com", "api.travis-ci.org", "avatars.githubusercontent.com", "badges.gitter.im", "bettercodehub.com", "camo.githubusercontent.com", "cdn.syncfusion.com", "opencollective.com", "raw.github.com", "raw.githubusercontent.com", "user-images.githubusercontent.com" ); ImageHostReport | where set_has_element(QuestionedHosts, Type) | project-away PackageIdCount | order by Type asc ```
Type SampleId SampleVersion SampleUrl
api.bintray.com Radiusnetworks.Flybuy.Android.v28 1.0.2 https://api.bintray.com/packages/radiusnetworks/flybuy-sdk/com.radiusnetworks.flybuy/images/download.svg
api.codeclimate.com nhapi 3.0.0 https://api.codeclimate.com/v1/badges/63027fc59b840d0008fd/test_coverage
api.dependabot.com Mandrill.net 7.1.1 https://api.dependabot.com/badges/status?host=github&repo=feinoujc/Mandrill.net
api.travis-ci.org Paket 6.0.9 https://api.travis-ci.org/fsprojects/Paket.svg?branch=master
avatars.githubusercontent.com Prometheus.Client 5.2.0 https://avatars.githubusercontent.com/u/878437?s=75&v=4
badges.gitter.im MimeKit 4.2.0 https://badges.gitter.im/Join%20Chat.svg
bettercodehub.com Certes 2.3.0 https://bettercodehub.com/edge/badge/fszlin/certes?branch=master
camo.githubusercontent.com AutoMapper 12.0.0 https://camo.githubusercontent.com/603a9fdf1c6578e4df423ecdb784cb5d634e016850c10ba0798970fd48c55d41/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f6175746f6d61707065722f6c6f676f2e706e67
cdn.syncfusion.com Syncfusion.Pdf.Net.Core 22.1.36 https://cdn.syncfusion.com/nuget-readme/fileformats/net-pdf-library.png
opencollective.com Cake.Tool 3.0.0 https://opencollective.com/cake/sponsors.svg
raw.github.com Polly 8.0.0 https://raw.github.com/App-vNext/Polly/main/Polly-Logo.png
raw.githubusercontent.com Newtonsoft.Json 13.0.2-beta2 https://raw.githubusercontent.com/JamesNK/Newtonsoft.Json/master/Doc/icons/logo.jpg
user-images.githubusercontent.com ClosedXML 0.100.1 https://user-images.githubusercontent.com/7634052/208317997-24765ff2-17c2-4272-9b66-5d98fe08c089.png

Some of these (such as api.bintray.com) are broken and for very explainable reasons. For example, Bintray was retired by JFrog (https://jfrog.com/blog/into-the-sunset-bintray-jcenter-gocenter-and-chartcenter/). We should go through the list and verify the hosts are still acceptable.

lyndaidaii commented 9 months ago

We need update the api.travis-ci.org to app.travis-ci.com sine they migrated from .org to .com https://www.travis-ci.com/blog/2021-05-07-orgshutdown/, sample url: https://app.travis-ci.com/travis-ci/travis-rubies.svg?branch=build

There is issue with api.dependabot.com, here is workaround if badge on api.dependabot.com doesn't work: https://github.com/dependabot/feedback/issues/6#issuecomment-504674854

bettercodehub.com us retired. we could remove it from allowlist. bintray is no longer active, remove it from allowlist