From 26f28b6ae4e33b3250a975e7e30510a03bf56efa Mon Sep 17 00:00:00 2001 From: Samuel Attard Date: Thu, 20 Aug 2020 20:47:10 -0700 Subject: [PATCH] fix: add handling for non-absolute extension paths (#25068) --- shell/browser/api/electron_api_session.cc | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/shell/browser/api/electron_api_session.cc b/shell/browser/api/electron_api_session.cc index 8bb13bc12c00..cee557485252 100644 --- a/shell/browser/api/electron_api_session.cc +++ b/shell/browser/api/electron_api_session.cc @@ -684,6 +684,13 @@ v8::Local Session::LoadExtension( v8::Isolate* isolate = JavascriptEnvironment::GetIsolate(); gin_helper::Promise promise(isolate); v8::Local handle = promise.GetHandle(); + + if (!extension_path.IsAbsolute()) { + promise.RejectWithErrorMessage( + "The path to the extension in 'loadExtension' must be absolute"); + return handle; + } + if (browser_context()->IsOffTheRecord()) { promise.RejectWithErrorMessage( "Extensions cannot be loaded in a temporary session");