From 76ce8b72bf79de45eb6ed97c9f24456cbd24def2 Mon Sep 17 00:00:00 2001 From: Yang Cao Date: Mon, 5 May 2025 12:05:28 -0400 Subject: [PATCH] Potential fix for code scanning alert no. 6: Incomplete URL substring sanitization Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> --- src/git/repository.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/git/repository.ts b/src/git/repository.ts index a58a4377..e62253cc 100644 --- a/src/git/repository.ts +++ b/src/git/repository.ts @@ -78,7 +78,7 @@ export async function getGitHubUrls(): Promise { remote.length > 0 && (remote[0].pushUrl?.indexOf("github.com") !== -1 || (useEnterprise() && remote[0].pushUrl?.indexOf(new URL(getGitHubApiUri()).host) !== -1) || - remote[0].pushUrl?.indexOf(".ghe.com") !== -1) + (remote[0].pushUrl ? new URL(remote[0].pushUrl).host.endsWith(".ghe.com") : false)) ) { const url = remote[0].pushUrl;