FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

fix: guard against short paths in changelog GitHub URL redirect by AruneshDwivedi · Pull Request #9688 · updatecli/updatecli · GitHub

fix: guard against short paths in changelog GitHub URL redirect - #9688

Merged
olblak merged 2 commits into
updatecli:mainfrom
AruneshDwivedi:fix/dockerimage-changelog-panic
Jul 22, 2026
Merged

fix: guard against short paths in changelog GitHub URL redirect#9688
olblak merged 2 commits into
updatecli:mainfrom
AruneshDwivedi:fix/dockerimage-changelog-panic

Conversation

Copy link
Copy Markdown
Contributor

redirectToGitHubRawContent splits the changelog URL path on "/" and reads index 3 without checking the length, so a github.com changelog URL with fewer than four path segments panics with index out of range. Since the URL comes from the org.opencontainers.image.changelog image annotation, a short value like https://github.com/CHANGELOG.md crashes the run.

Split once, check the slice has more than three elements before touching index 3, and leave short paths unchanged.

Signed-off-by: Arunesh Dwivedi <arunesh.dwivedi@example.com>

olblak commented Jul 20, 2026

Copy link
Copy Markdown
Member

Hi @AruneshDwivedi,
I am not familiar with those short changelog url.
Do you have an example of a failing pipeline due to this?

AruneshDwivedi commented Jul 20, 2026
edited
Loading

Copy link
Copy Markdown
Contributor Author

@olblak good question it's a real panic, not a theoretical one.
An image annotated with org.opencontainers.image.changelog: https://github.com/CHANGELOG.md (short URL, changelog at repo root) hits redirectToGitHubRawContent, which does strings.Split(u.Path, "/")[3]. That path only has two segments, so it panics with index out of range [3] with length 2 and kills the whole run. Any pipeline doing dockerimage changelog autodiscovery over such an image crashes. put up a fix in #9689 with a test that repros it. The example in my earlier message used a 4-segment URL by mistake that one doesn't panic; the 2-segment github.com/CHANGELOG.md is the actual trigger.

olblak commented Jul 21, 2026

Copy link
Copy Markdown
Member

Thanks for the explanation, why did you created two differernt pullrequest with the same content
#9688 vs #9689

olblak left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Thanks for the pullrequest

olblak enabled auto-merge (squash) July 22, 2026 06:27
olblak merged commit f66ba0d into updatecli:main Jul 22, 2026
8 checks passed
olblak added bug Something isn't working resource-dockerfile Resource of kind Dockerfile labels Jul 22, 2026
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

Labels

bug Something isn't working resource-dockerfile Resource of kind Dockerfile

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants


Back | FazBrowse Home | New Git URL