Skip to content

Delete dead code, sanitaze submodule URLs before cloning#6408

Merged
dkurepa merged 4 commits into
dotnet:mainfrom
dkurepa:dkurepa/RemoveAzDev
Jun 17, 2026
Merged

Delete dead code, sanitaze submodule URLs before cloning#6408
dkurepa merged 4 commits into
dotnet:mainfrom
dkurepa:dkurepa/RemoveAzDev

Conversation

@dkurepa

@dkurepa dkurepa commented Jun 16, 2026

Copy link
Copy Markdown
Member

Copilot AI review requested due to automatic review settings June 16, 2026 12:17

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR removes unused endpoints/CLI functionality and adds validation to prevent dangerous repository URLs (notably submodule URLs) from being used during cloning in VMR patch creation.

Changes:

  • Added GitRepoUrlUtils.IsValidRemoteRepoUri plus NUnit coverage for allowlisted HTTPS remotes and known-dangerous URL formats.
  • Added a submodule URL validation gate in VmrPatchHandler before cloning.
  • Removed dead code: PCS AzDevController and DARC clone command implementation/registration.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
test/Maestro/Maestro.Common.Tests/GitRepoUrlUtilsTests.cs Adds tests for allowlisted vs. dangerous repo URL inputs.
src/Maestro/Maestro.Common/GitRepoUrlUtils.cs Introduces repo URL/path allowlist helper used to protect cloning.
src/Microsoft.DotNet.Darc/DarcLib/VirtualMonoRepo/VmrPatchHandler.cs Validates submodule URL before invoking clone manager.
src/ProductConstructionService/ProductConstructionService.Api/Controllers/AzDevController.cs Deletes unused API controller.
src/Microsoft.DotNet.Darc/Darc/Program.cs Removes clone verb registration from CLI options list.
src/Microsoft.DotNet.Darc/Darc/Options/CloneCommandLineOptions.cs Deletes unused clone verb options type.
src/Microsoft.DotNet.Darc/Darc/Operations/CloneOperation.cs Deletes unused deep-clone operation implementation.

Comment thread src/Maestro/Maestro.Common/GitRepoUrlUtils.cs
Comment thread src/Maestro/Maestro.Common/GitRepoUrlUtils.cs
{
var checkoutCommit = change.Before == Constants.EmptyGitObject ? change.After : change.Before;

if (!GitRepoUrlUtils.IsValidRemoteRepoUri(change.Url))

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.

I don't understand the URI validation. We can have submodules from wherever?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Do you mean submodules don't have to be in GitHub or AzDo?

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.

Not necessarily. We used to have one from Google from whatever address.

But also how does this fix the issue that we'd send the token from the parent repo to the submodule when getting it? Isn't that what the issue was about?

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.

@dkurepa so I guess this one can go in?

@dkurepa dkurepa merged commit 58af080 into dotnet:main Jun 17, 2026
9 of 11 checks passed
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.

3 participants