Skip to content

fix(forge): read Azure DevOps collection, legacy SSH, and default-repo remotes - #4764

Merged
max-sixty merged 3 commits into
mainfrom
fix/issue-4763
Nov 10, 2026
Merged

max-sixty merged 3 commits into
mainfrom
fix/issue-4763

Conversation

@worktrunk-bot

@worktrunk-bot worktrunk-bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Collaborator

GitRemoteUrl::azure_organization / azure_project read the org and project from fixed positions in the remote path. Three valid Azure DevOps remote forms broke that, so wt list --format json reported a wrong repo.forge.project and url, and the az CI lookup got the same wrong project (or, for the legacy SSH host, the org vs-ssh):

Remote Before After
https://myorg.visualstudio.com/DefaultCollection/My%20Project/_git/my-repo project DefaultCollection project My%20Project
[email protected]:v3/myorg/My%20Project/my-repo host vs-ssh.visualstudio.com, owner vs-ssh, project v3 host myorg.visualstudio.com, owner myorg, project My%20Project
https://dev.azure.com/myorg/_git/my-repo project _git, url …/myorg/_git/_git/my-repo project my-repo, url …/myorg/my-repo/_git/my-repo

A new private azure_coordinates resolves (web host, org, project) for every shape. It strips a leading DefaultCollection on *.visualstudio.com, reads v3/{org}/{project} on both SSH hosts, and falls back to the repo name when the project segment is omitted (the project's default repo shares its name). The two accessors, web_url, repo_info, the PR-checkout org detection, and the CI-status context all go through it. The CI-status path and the PR path now take the host from the new azure_web_host rather than the raw remote host, so the legacy SSH host maps to {org}.visualstudio.com.

repo_info_from_remote_azure_devops_collection_legacy_ssh_and_default_repo covers the reporter's three remotes plus the visualstudio.com short forms. Before the change, the issue's repro gave the wrong values in the table; after it, a local build gives the expected ones. Existing Azure unit and integration tests pass.

project and name still keep the URL's percent-encoding (My%20Project), as the issue notes. This PR leaves that unchanged.

Closes #4763 — automated triage

…o remotes

The Azure org/project accessors picked fixed positions in the remote path,
so three valid remote shapes gave a wrong project (and web URL):
DefaultCollection-prefixed visualstudio.com URLs, the legacy
{org}@vs-ssh.visualstudio.com:v3/... SSH host, and the short
dev.azure.com/{org}/_git/{repo} form for a project's default repo.
One azure_coordinates helper now resolves web host, org and project for
every shape, and the CI-status and PR paths use its web host.

Closes #4763
@max-sixty

Copy link
Copy Markdown
Owner

@worktrunk-bot The new vs-ssh.visualstudio.com path puts the organization from the remote path directly into an HTTPS hostname. For [email protected]:v3/attacker.example#/proj/repo, azure_coordinates constructs attacker.example#.visualstudio.com; az_org_url then produces https://attacker.example#.visualstudio.com, whose parsed destination host is attacker.example. The Git style remote parser accepts this path. Please validate that the organization is a safe single DNS label before constructing the web host, and add a regression test for a URL delimiter in that segment. Microsoft's Azure CLI parser uses this validation at the same conversion.

This was written by Codex on behalf of max-sixty

…abel

The vs-ssh.visualstudio.com path puts the organization into the
{org}.visualstudio.com web host, so a URL delimiter in that segment
(e.g. v3/attacker.example#/proj/repo) redirected the host.
@worktrunk-bot

Copy link
Copy Markdown
Collaborator Author

Fixed in 21455da. In the vs-ssh.visualstudio.com branch, azure_coordinates now rejects an organization that isn't a single DNS label (1–63 ASCII letters, digits, or hyphens, with no hyphen at either end). It does this before building {org}.visualstudio.com. Rejecting it there makes azure_web_host, web_url, and the az_org_url and CI paths that read from it all return None.

The regression cases cover a remote with attacker.example#, one with a dot, one with [email protected], and one with a leading hyphen. Each now yields no web host and no web URL.

@max-sixty
max-sixty merged commit 11f8b5b into main Nov 10, 2026
36 checks passed
@max-sixty
max-sixty deleted the fix/issue-4763 branch November 10, 2026 12:39
This was referenced Nov 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

automated-fix Automated CI fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Azure DevOps: repo.forge gives a wrong project for 3 forms of remote

2 participants