fix(bootstrap): cut the host part before stripping userinfo (mc-gcmer) (#7616)
* fix(bootstrap): cut the host part before stripping userinfo (mc-gcmer) urlHostname stripped userinfo through the first "@" anywhere in the URL, before cutting out the host part, so an "@" in a path, query or fragment picked the host: https://my-dolt.example.com/x@github.com/path read as github.com. isGitCodeRepoURL then called it a forge, and doltRemoteURL rewrote what is really a Dolt remotesapi URL to git+https:// (the GH#3339 class). The SCP branch made the same split, so both my-dolt.example.com:org/x@github.com:db and the local path ./backups/me@github.com:db read as github.com too. Cut the host part first, then strip userinfo through its last "@": - scheme URLs: the authority, ending at the first "/", "?" or "#". That is the host net/url dials, and Dolt's earl.Parse hands scheme URLs to net/url. Taking the last "@" matches net/url too, so https://a@b@github.com/org/db is now a forge, as Dolt would dial it, instead of going raw to the remotesapi client (the #4421 class). - SCP: everything before the first ":", unless a "/" comes first (a local path) - the split doltremote.FromGitURL makes. TestIsGitCodeRepoURL gains the path/query/fragment-@, SCP path-@, local-path-@ and last-@ cases, 7 of them red before this change, plus userinfo controls in both URL forms that stay green. Agent-Signature: claude-code-claude-opus-5-5-max on behalf of Julian Knutsen Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix(bootstrap): scrub credentials from the Bootstrap failed message (mc-gcmer) An unencoded "#" or "?" in a sync.remote password ends the URL's authority early, so urlHostname no longer reads the remote as a forge and bootstrap clones it as configured. The clone error then carries the URL, password included, twice: sanitizeURL passes through a URL net/url cannot parse, and Dolt's "invalid remote url:" repeats it. Scrub the error with scrubURLCredentials where "Bootstrap failed:" prints it. TestEmbeddedBootstrapCloneFailureScrubsCredentials pins this; it fails against the pre-fix binary for both "pa#ss" and "pa?ss", and the new test is registered in the embedded shard manifest. Also add a forgeSyncRemoteForms row for multi-@ userinfo without a .git suffix, so the routing pin covers a URL only its host can make a forge. The row fails with the base urlHostname. Review: PR #7616 synthesis F1 (minor) and F5 (nit). Agent-Signature: claude-code-claude-opus-5-5-unknown-reasoning on behalf of Julian Knutsen Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Eddie the Engineer <338826946+gascity-eddie[bot]@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
bdd16d6383
commit
4a67d0d028
4 changed files with 84 additions and 9 deletions
1
.github/scripts/embedded-cmd-test-shards.txt
vendored
1
.github/scripts/embedded-cmd-test-shards.txt
vendored
|
|
@ -145,6 +145,7 @@
|
|||
100 60 TestEmbeddedCommentsCLI
|
||||
100 60 TestEmbeddedRoutedWriteMissDoesNotCreateTargetDatabase
|
||||
|
||||
100 61 TestEmbeddedBootstrapCloneFailureScrubsCredentials
|
||||
100 61 TestEmbeddedContributorRoutedWritesCommitInPlanning
|
||||
100 61 TestEmbeddedUpdateRoutedStoreCommitsTargetHead
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue