Repository navigation
Conversation
Part of git-pkgs#501. The NuGet service index rewrite, the registration copy that points links at the proxy and leaves out versions in cooldown, the registration times decoder, the flat container version filter and the link and path helpers move into internal/metadata/nuget. The package takes the URLs, the cooldown policy and the evaluation time in Options and reports withheld versions through a callback, so it doesn't depend on handler.Proxy and builds for wasip1. The handler keeps fetching, caching, routes and downloads; its function names stay as thin wrappers. A registration request decides cooldown at one evaluation time for the leaf check and the copy.
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 44 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #501, the NuGet step.
As in #612 for npm, the NuGet metadata transformations move out of
internal/handlerintointernal/metadata/nuget:RewriteServiceIndexandServiceURL, which point the services the proxy handles at itWriteRegistration, the streaming registration copy that points links at the proxy and, with filtering on, leaves out the leaves cooldown holds back and the pages that end up empty, correcting counts and boundsDecodeTimes,TimesandRelease, which read only the members that decide cooldown, the wayWriteRegistrationcopies themFilterVersionsfor the flat container version list, andDecodeDocumentProxyLink,CatalogPath,RegistrationPagePath,RegistrationID,RegistrationLeafVersion,VersionKeyandUnlistedTimeThe package takes its inputs explicitly in
Options: upstream and proxy URLs, the cooldown policy and the time cooldown is evaluated at. It reports versions cooldown holds back throughOnWithheld, which the handler records as before. It doesn't depend onhandler.Proxy.What stays in the handler: fetching and the metadata cache, the fallback to older registration hives, expanding linked pages, the catalog lookup for unlisted versions, downloads and error responses. The handler's function names stay as thin wrappers and
nugetTimesis an alias fornuget.Times, so the handler tests run unchanged.Cooldown is checked with
Evaluateat oneEvaluatedAtinstead ofIsAllowedper leaf, as ininternal/metadata/npm. The handler passestime.Now(), and a registration request now uses one time for the leaf check and the copy, so results are the same unless a request runs across a cooldown boundary.TestCooldownSupportedCoversHandlersalso readsinternal/metadata, since NuGet's cooldown call now lives there; it's the same change as in #804.Portability:
GOOS=wasip1 GOARCH=wasm go build ./internal/metadata/nugetworks.imports_test.gofails on any non-standard import outside an allowlist (cooldown, purl, vers, packageurl-go,internal/packageurl) and onnet,net/http,log/slogordatabase/sql. The package has its own copy of the path traversal check, since the handler's can't be imported.New tests in
internal/metadata/nugetcover the service index, cooldown evaluated atEvaluatedAtwith the callback, no policy and no callback, blocked versions in nested registrations, the version list filter, the registration copy with and without filtering and with inlined pages, the times decoder, and the link and path helpers including traversal and foreign hosts. They were mutation-checked, as was the handler's wiring. There are no NuGet benchmarks to compare.go test ./...andgolangci-lint run ./...pass.