Repository navigation
Harden nuget catalog fetches, URL parsing and pagination - #127
Conversation
Only follow nuget catalog URLs on the registry origin, make scheme stripping linear with a length cap, and cap paginated version listings.
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
bc926fa to
2ba5129
Compare
|
Looks good to me. The One thing in the nuget change: when a catalog Smaller: |
|
@simonchrz Fixed the retry issue in 51a546b. The catalog client copy now uses The redirect tests now use the default client and assert one attempt for rejected redirects and ten requests for a redirect loop. The public |
simonchrz
left a comment
There was a problem hiding this comment.
LGTM, retry fix confirmed.
nuget
FetchVersionsfollowed each catalog entry's@idto whatever host it named, so a hostile registry response could point it at loopback or cloud metadata addresses and get the body back asIntegrity. It now only fetches catalog leaves on the same scheme and host as the registry base URL. nuget.org serves both fromapi.nuget.org, so integrity is unaffected there.urlparser.removeSchemesstripped one prefix per iteration and re-lowercased the remaining string each time, so a repository field ofGIT:repeated was quadratic (100 KB took about 12s). It now walks an offset withstrings.EqualFold, andCleanandNormalizereturn "" for input over 4096 bytes.The githubactions tag listing, golang pkgsite listing and swift registry listing kept paging for as long as the server said there was more. They now stop after
core.MaxPages(1000) pages and returnErrTooManyPages, re-exported from the root package. For golang that falls back to the module proxy like any other pkgsite error.