Fix vip-next GitHub release pagination - #3051
Open
rinatkhaziev wants to merge 1 commit into
Open
Conversation
Contributor
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Scanned FilesNone |
|
Contributor
There was a problem hiding this comment.
🔵 Needs a closer look
Two unresolved moderate findings remain in pagination validation.
Pull request overview
Fixes vip-next update --check failures when GitHub returns numeric repository URLs in release pagination.
Changes:
- Accepts named and numeric repository pagination paths.
- Detects duplicate
nextlinks across separateLinkheaders. - Adds regression coverage for pagination validation.
File summaries
| File | Description |
|---|---|
internal/update/release_test.go |
Adds regression tests for numeric paths and duplicate pagination links. |
internal/update/github.go |
Updates pagination path validation and multi-header link handling. |
Review details
Suppressed comments (2)
internal/update/github.go:109
strconv.ParseUintaccepts a leading+, so a link such as/repositories/+1/releasespasses this check even though the repository ID is not a decimal-digit path segment. That violates the pagination safeguard and lets malformed links through; validate that every byte inrepositoryIDis0–9before parsing.
id, err := strconv.ParseUint(repositoryID, 10, 64)
return err == nil && id > 0
internal/update/github.go:82
u.Pathis already percent-decoded, so a link such as/repositories/116313791%2Freleases?page=2becomes/repositories/116313791/releasesand passesisReleasePaginationPatheven though its raw path is malformed. Validate the escaped path (or otherwise reject encoded separators) so the new numeric route only accepts the intended path shape.
if err != nil || n <= page || u.Scheme != origin.Scheme || u.Host != origin.Host || !isReleasePaginationPath(u.Path) || u.User != nil || next != 0 {
- Files reviewed: 2/2 changed files
- Comments generated: 0
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
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.



Description
Fixes
vip-next update --checkfailing withinvalid release pagination.GitHub accepts release-list requests at
/repos/Automattic/vip-cli/releases, but its paginationLinkheader canonicalizes the next-page URL to/repositories/<numeric-id>/releases. The updater previously required the named-repository path exactly, so it rejected GitHub's valid response before requesting page 2.This change accepts either release pagination path while preserving the existing safeguards:
Linkheader fields.The change is limited to the Go
vip-nextupdater. The Node CLI's existing update behavior is unchanged.Changelog Description
Fixed
Pull request checklist
Steps to Test
go test ./internal/update -count=1.make test.make lint.vip-nextbinary built from this branch withupdate --checkand verify it reports update status instead ofinvalid release pagination.Manual verification used an isolated temporary cache/config and a binary stamped as
5.0.0-alpha.4; it traversed GitHub's live pagination and reported5.0.0-alpha.5as available on the preview channel.