Validate allowed git schemes more carefully. - #31147
Open
kayliespace wants to merge 1 commit into
Open
kayliespace wants to merge 1 commit into
kayliespace wants to merge 1 commit into
Conversation
kayliespace
force-pushed
the
kaylie-09-15-2026-validate-git-repo-spec-uris
branch
2 times, most recently
from
September 15, 2026 21:16
f07e712 to
714227c
Compare
kayliespace
commented
Sep 15, 2026
| new GitSchemeEntry("https", "https://", IndexRegistry::validateUriGitRepoSpec), | ||
| new GitSchemeEntry("ssh", "ssh://", IndexRegistry::validateUriGitRepoSpec), | ||
| new GitSchemeEntry("git", "git://", IndexRegistry::validateUriGitRepoSpec), | ||
| new GitSchemeEntry("file", "file://", IndexRegistry::validateFileUriGitRepoSpec), |
Contributor
Author
There was a problem hiding this comment.
Remark: This was intentionally loosened, because //src/test/py/bazel:bazel_module_test expects a file URI like file://c:/... to be valid on windows.
This is, however, not ever considered valid by Java and Java is correct (the correct form is either file:///c:/ or file://localhost/c:/.)
Uncertain if making this more restrictive is actually desired or not.
|
✅ Bazel docs preview is ready! Updated pages Preview URL: https://bazel-pr-31147.mintlify.app/ Updated for |
kayliespace
force-pushed
the
kaylie-09-15-2026-validate-git-repo-spec-uris
branch
4 times, most recently
from
September 16, 2026 23:03
c3f72c3 to
942260d
Compare
Per a comment in bazelbuild#31129, but I noticed that none of the other allowed schemes are validated either. This corrects that and validates all schemes. Xona-Autoformatter-Enabled: 0
kayliespace
force-pushed
the
kaylie-09-15-2026-validate-git-repo-spec-uris
branch
from
September 17, 2026 17:17
942260d to
91bc147
Compare
kayliespace
marked this pull request as ready for review
September 17, 2026 17:17
Contributor
Author
|
Ready for review. |
This branch has not been deployed
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
Per a comment in #31129, but I noticed that none of the other allowed schemes are validated either.
This corrects that and validates all schemes.
Stacked on #31129
Motivation
The current git_repository validation attempts to be more strict about allowed/disallowed hosts but does so using simple prefix comparison, PR review suggests this is probably undesirable, so this introduces proper validation.
Build API Changes
No
Checklist
Release Notes
RELNOTES[INC]: Bazel now validates that git repository entries in a bazel registry have correctly formed remote URIs, and rejects malformed URIs.