Skip to content

Commit

Permalink
ELECTRON-1505: add checks for url length (#774)
Browse files Browse the repository at this point in the history
  • Loading branch information
VishwasShashidhar authored Aug 29, 2019
1 parent 04ae257 commit 7666ee5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/app/child-window-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,10 @@ export const handleChildWindow = (webContents: WebContents): void => {
}
});
} else {
if (newWinUrl && newWinUrl.length > 2083) {
logger.info(`child-window-handler: new window url length is greater than 2083, not performing any action!`);
return;
}
logger.info(`child-window-handler: new window url is ${newWinUrl} which is not of the same host,
so opening it in the default browser!`);
event.preventDefault();
Expand Down
4 changes: 4 additions & 0 deletions src/app/protocol-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ class ProtocolHandler {
* @param isAppRunning {Boolean} - whether the application is running
*/
public sendProtocol(url: string, isAppRunning: boolean = true): void {
if (url && url.length > 2083) {
logger.info(`protocol-handler: protocol handler url length is greater than 2083, not performing any action!`);
return;
}
logger.info(`protocol handler: processing protocol request for the url ${url}!`);
if (!this.preloadWebContents || !isAppRunning) {
logger.info(`protocol handler: app was started from the protocol request. Caching the URL ${url}!`);
Expand Down

0 comments on commit 7666ee5

Please sign in to comment.