Skip to content

Commit

Permalink
allow to redirect only for whitelisted trusted protocols (#17559)
Browse files Browse the repository at this point in the history
* fix IDE-69: allow to redirect only for whitelisted trusted protocols

* Update components/dashboard/src/service/service.tsx

Co-authored-by: Filip Troníček <[email protected]>

* drop security

---------

Co-authored-by: Filip Troníček <[email protected]>
  • Loading branch information
akosyakov and filiptronicek committed May 12, 2023
1 parent 72e822c commit 6771283
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion components/dashboard/src/service/service.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,10 @@ export class IDEFrontendService implements IDEFrontendDashboardService.IServer {
let redirect = false;
try {
const desktopLink = new URL(url);
redirect = desktopLink.protocol !== "http:" && desktopLink.protocol !== "https:";
// allow to redirect only for whitelisted trusted protocols
// IDE-69
const trustedProtocols = ["vscode:", "vscode-insiders:", "jetbrains-gateway:"];
redirect = trustedProtocols.includes(desktopLink.protocol);
} catch (e) {
console.error("invalid desktop link:", e);
}
Expand Down

0 comments on commit 6771283

Please sign in to comment.