Skip to content

Commit

Permalink
Handle legitimate GHES cases
Browse files Browse the repository at this point in the history
  • Loading branch information
felipesu19 authored Sep 24, 2024
1 parent a715be2 commit c5da3eb
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/configuration/configuration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,16 @@ export function useEnterprise(): boolean {
export function getGitHubApiUri(): string {
if (!useEnterprise()) return DEFAULT_GITHUB_API;
const base = getConfiguration().get<string>("github-enterprise.uri", DEFAULT_GITHUB_API).replace(/\/$/, "");
return base === DEFAULT_GITHUB_API ? base : `api.${base}`;
if(base === DEFAULT_GITHUB_API) {
return base;
}

if(base.includes(".ghe.com")){

Check failure

Code scanning / CodeQL

Incomplete URL substring sanitization High

'
.ghe.com
' can be anywhere in the URL, and arbitrary hosts may come before or after it.
return `api.${base}`
}else{
return `${base}/api/v3`;
}

}

async function updateLanguageServerApiUrl(context: vscode.ExtensionContext) {
Expand Down

0 comments on commit c5da3eb

Please sign in to comment.