Skip to content

URL-encode template variables in RegistryURL#11

Merged
andrew merged 1 commit intomainfrom
fix/registry-url-encoding
May 2, 2026
Merged

URL-encode template variables in RegistryURL#11
andrew merged 1 commit intomainfrom
fix/registry-url-encoding

Conversation

@andrew
Copy link
Copy Markdown
Contributor

@andrew andrew commented May 2, 2026

expandTemplate() in registry.go interpolated namespace, name, and version directly into URL templates via strings.ReplaceAll without any encoding. A name like evil/../../secret would produce a URL containing raw path traversal sequences.

Wrapped each replacement with url.PathEscape() so that characters like /, ?, # are percent-encoded before insertion into the URL template.

Added TestRegistryURLEscapesSpecialChars to verify that path traversal in a package name gets escaped.

@andrew andrew merged commit b4d7d03 into main May 2, 2026
2 checks passed
@andrew andrew deleted the fix/registry-url-encoding branch May 2, 2026 16:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant