Skip to content

Commit

Permalink
Restrict trusted domain auto-insertion to github domains.
Browse files Browse the repository at this point in the history
Ref #97532.
Reasoning is otherwise it would be possible for an extension to simply insert an entry into .git/config. This is still possible in thoery, but at least only for github.
  • Loading branch information
Jackson Kearl committed May 12, 2020
1 parent 288852d commit 6ba01ef
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/vs/workbench/contrib/url/browser/trustedDomains.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,11 +133,11 @@ async function getRemotes(fileService: IFileService, textFileService: ITextFileS
const domains = new Set<string>();
let match: RegExpExecArray | null;

const RemoteMatcher = /^\s*url\s*=\s*(?:git@|https:\/\/)([^:\/]*)(?::|\/)([^.]*)\.git\s*$/mg;
const RemoteMatcher = /^\s*url\s*=\s*(?:git@|https:\/\/)github\.com(?::|\/)([^.]*)\.git\s*$/mg;
while (match = RemoteMatcher.exec(content)) {
const [domain, repo] = [match[1], match[2]];
if (domain && repo) {
domains.add(`https://${domain}/${repo}/`);
domains.add(`https://github.com/${repo}/`);
}
}
return [...domains];
Expand Down

0 comments on commit 6ba01ef

Please sign in to comment.