From 058c30f1e6201d08db6af51faaf88f23feab4a3c Mon Sep 17 00:00:00 2001 From: Matt Gajownik Date: Sun, 31 May 2026 14:40:24 +1000 Subject: [PATCH 1/6] Temporarily recreate implied Localhost permissions OnShowPermissionPrompt is only called *once* when a page requests permission. If it is denied, even automatically, this code path will never be triggered again. --- browser-client.cpp | 22 ++++++++++++++++++++++ browser-client.hpp | 13 +++++++++++++ panel/browser-panel-client.cpp | 18 ++++++++++++++++++ panel/browser-panel-client.hpp | 8 ++++++++ 4 files changed, 61 insertions(+) diff --git a/browser-client.cpp b/browser-client.cpp index ef149c0..de4587e 100644 --- a/browser-client.cpp +++ b/browser-client.cpp @@ -56,6 +56,13 @@ CefRefPtr BrowserClient::GetDisplayHandler() return this; } +#if CHROME_VERSION_BUILD >= 6533 +CefRefPtr BrowserClient::GetPermissionHandler() +{ + return this; +} +#endif + CefRefPtr BrowserClient::GetLifeSpanHandler() { return this; @@ -306,6 +313,21 @@ bool BrowserClient::OnTooltip(CefRefPtr, CefString &text) return true; } +#if CHROME_VERSION_BUILD >= 6533 +/* CefPermissionHandler */ +bool BrowserClient::OnShowPermissionPrompt(CefRefPtr, uint64_t, const CefString &, + uint32_t requested_permissions, + CefRefPtr callback) +{ + // Implicitly allow Localhost access to retain previous behavior for now + if ((requested_permissions & CEF_PERMISSION_TYPE_LOOPBACK_NETWORK) != 0) { + callback->Continue(CEF_PERMISSION_RESULT_ACCEPT); + return true; + } + return false; +} +#endif + void BrowserClient::OnPaint(CefRefPtr, PaintElementType type, const RectList &, const void *buffer, int width, int height) { diff --git a/browser-client.hpp b/browser-client.hpp index 851ee4e..5046b82 100644 --- a/browser-client.hpp +++ b/browser-client.hpp @@ -27,6 +27,9 @@ struct BrowserSource; class BrowserClient : public CefClient, public CefDisplayHandler, +#if CHROME_VERSION_BUILD >= 6533 + public CefPermissionHandler, +#endif public CefLifeSpanHandler, public CefRequestHandler, public CefResourceRequestHandler, @@ -66,6 +69,9 @@ class BrowserClient : public CefClient, virtual CefRefPtr GetLoadHandler() override; virtual CefRefPtr GetRenderHandler() override; virtual CefRefPtr GetDisplayHandler() override; +#if CHROME_VERSION_BUILD >= 6533 + virtual CefRefPtr GetPermissionHandler() override; +#endif virtual CefRefPtr GetLifeSpanHandler() override; virtual CefRefPtr GetRequestHandler() override; virtual CefRefPtr GetContextMenuHandler() override; @@ -80,6 +86,13 @@ class BrowserClient : public CefClient, const CefString &source, int line) override; virtual bool OnTooltip(CefRefPtr browser, CefString &text) override; + /* CefPermissionHandler */ +#if CHROME_VERSION_BUILD >= 6533 + virtual bool OnShowPermissionPrompt(CefRefPtr browser, uint64_t prompt_id, + const CefString &requesting_origin, uint32_t requested_permissions, + CefRefPtr callback) override; +#endif + /* CefLifeSpanHandler */ virtual bool OnBeforePopup(CefRefPtr browser, CefRefPtr frame, #if CHROME_VERSION_BUILD >= 6834 diff --git a/panel/browser-panel-client.cpp b/panel/browser-panel-client.cpp index 555992c..2b482c4 100644 --- a/panel/browser-panel-client.cpp +++ b/panel/browser-panel-client.cpp @@ -43,6 +43,11 @@ CefRefPtr QCefBrowserClient::GetCommandHandler() { return this; } + +CefRefPtr QCefBrowserClient::GetPermissionHandler() +{ + return this; +} #endif CefRefPtr QCefBrowserClient::GetRequestHandler() @@ -81,6 +86,19 @@ bool QCefBrowserClient::OnChromeCommand(CefRefPtr, int, cef_window_o { return true; } + +/* CefPermissionHandler */ +bool QCefBrowserClient::OnShowPermissionPrompt(CefRefPtr browser, uint64_t, const CefString &, + uint32_t requested_permissions, + CefRefPtr callback) +{ + // Implicitly allow Localhost access to retain previous behavior for now + if ((requested_permissions & CEF_PERMISSION_TYPE_LOOPBACK_NETWORK) != 0) { + callback->Continue(CEF_PERMISSION_RESULT_ACCEPT); + return true; + } + return false; +} #endif /* CefDisplayHandler */ diff --git a/panel/browser-panel-client.hpp b/panel/browser-panel-client.hpp index ea44000..ad23151 100644 --- a/panel/browser-panel-client.hpp +++ b/panel/browser-panel-client.hpp @@ -9,6 +9,7 @@ class QCefBrowserClient : public CefClient, public CefDisplayHandler, #if CHROME_VERSION_BUILD >= 6533 public CefCommandHandler, + public CefPermissionHandler, #endif public CefRequestHandler, public CefLifeSpanHandler, @@ -31,6 +32,7 @@ class QCefBrowserClient : public CefClient, virtual CefRefPtr GetDisplayHandler() override; #if CHROME_VERSION_BUILD >= 6533 virtual CefRefPtr GetCommandHandler() override; + virtual CefRefPtr GetPermissionHandler() override; #endif virtual CefRefPtr GetRequestHandler() override; virtual CefRefPtr GetLifeSpanHandler() override; @@ -43,6 +45,12 @@ class QCefBrowserClient : public CefClient, #if CHROME_VERSION_BUILD >= 6533 virtual bool OnChromeCommand(CefRefPtr browser, int command_id, cef_window_open_disposition_t disposition) override; + + /* CefPermissionHandler */ + virtual bool OnShowPermissionPrompt(CefRefPtr browser, uint64_t prompt_id, + const CefString &requesting_origin, uint32_t requested_permissions, + CefRefPtr callback) override; + #endif /* CefDisplayHandler */ From d0acf1ce0ff5e5fab3eabef26f9e98bf984c1325 Mon Sep 17 00:00:00 2001 From: Ryan Foster Date: Thu, 8 Oct 2026 12:44:36 -0400 Subject: [PATCH 2/6] Update version to 2.27.2 --- browser-version.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/browser-version.h b/browser-version.h index aa2c7af..ec4ddec 100644 --- a/browser-version.h +++ b/browser-version.h @@ -2,7 +2,7 @@ #define OBS_BROWSER_VERSION_MAJOR 2 #define OBS_BROWSER_VERSION_MINOR 27 -#define OBS_BROWSER_VERSION_PATCH 1 +#define OBS_BROWSER_VERSION_PATCH 2 #ifndef MAKE_SEMANTIC_VERSION #define MAKE_SEMANTIC_VERSION(major, minor, patch) ((major << 24) | (minor << 16) | patch) From 9ecf652c9df4a0cace934917ce5ae754da58a529 Mon Sep 17 00:00:00 2001 From: Ryan Foster Date: Thu, 8 Oct 2026 13:04:49 -0400 Subject: [PATCH 3/6] Fix unused variable warning Fails to compile when this warning is turned into an error. --- panel/browser-panel-client.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/panel/browser-panel-client.cpp b/panel/browser-panel-client.cpp index 2b482c4..4da3b8a 100644 --- a/panel/browser-panel-client.cpp +++ b/panel/browser-panel-client.cpp @@ -88,7 +88,7 @@ bool QCefBrowserClient::OnChromeCommand(CefRefPtr, int, cef_window_o } /* CefPermissionHandler */ -bool QCefBrowserClient::OnShowPermissionPrompt(CefRefPtr browser, uint64_t, const CefString &, +bool QCefBrowserClient::OnShowPermissionPrompt(CefRefPtr, uint64_t, const CefString &, uint32_t requested_permissions, CefRefPtr callback) { From 6b6d45629207b6b01def7ef0c72e9d64a07c163b Mon Sep 17 00:00:00 2001 From: Warchamp7 Date: Tue, 13 Oct 2026 16:51:50 -0400 Subject: [PATCH 4/6] Additional restrictions on custom scheme handler Adds additional hardening to the custom scheme handler for local files to ensure they are coming from a local file frame context. A fetch request made from an insecure page (http://) with the option "no-cors" may be delivered to the scheme handler successfully. A request made from a secure page (https://) already fails due to mixed content restrictions. This is additional protections for what is ultimately legacy functionality dating back to the original OBS Classic and we should consider removing the http://absolute handler entirely in a future update, instead preferring the sane defaults and handling of Chromium itself as it pertains to local files. --- browser-scheme.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/browser-scheme.cpp b/browser-scheme.cpp index b9ea148..1da6ed3 100644 --- a/browser-scheme.cpp +++ b/browser-scheme.cpp @@ -28,6 +28,16 @@ CefRefPtr BrowserSchemeHandlerFactory::Create(CefRefPtrGetMainFrame()->GetURL(); + if (!frameURL.empty()) { + CefURLParts frameParts; + CefParseURL(frameURL, frameParts); + std::string frameOrigin = CefString(&frameParts.origin); + if (frameOrigin != "http://absolute/") { + return nullptr; + } + } + CefURLParts parts; CefParseURL(request->GetURL(), parts); From 4d341a6960e080f96b4e8ce65d12627535791634 Mon Sep 17 00:00:00 2001 From: Warchamp7 Date: Thu, 15 Oct 2026 18:41:23 -0400 Subject: [PATCH 5/6] Fix handling of filepaths in migration Passing a std::string to std::filesystem will use the system codepage. On Windows, this means it will interpret const char* as ANSI but the paths returned by libobs are utf8. If the path only contains ASCII characters, then everything is fine. If the path contains non ASCII characters, then it leads to errors. --- obs-browser-plugin.cpp | 71 +++++++++++++++++++++++++----------------- 1 file changed, 42 insertions(+), 29 deletions(-) diff --git a/obs-browser-plugin.cpp b/obs-browser-plugin.cpp index 0496eb8..985b72b 100644 --- a/obs-browser-plugin.cpp +++ b/obs-browser-plugin.cpp @@ -79,6 +79,20 @@ static std::wstring deviceId; bool hwaccel = false; +namespace { +// Naive conversions between char* (Ex. from libobs) and filesystem::path using the platform codepage. +std::filesystem::path pathFromUtf8(const char *path) +{ + return std::filesystem::path{reinterpret_cast(path)}; +} + +std::string utf8BytesFromPath(std::filesystem::path path) +{ + const std::u8string u8 = path.u8string(); + return std::string{u8.begin(), u8.end()}; +} +} // namespace + /* ========================================================================= */ #ifdef ENABLE_BROWSER_QT_LOOP @@ -732,15 +746,15 @@ static void check_hwaccel_support(void) #endif #if CHROME_VERSION_BUILD > 6533 -static void MigrateProfileConfigDir(std::string oldDir, std::string newDir, bool makeDirs) +static void MigrateProfileConfigDir(filesystem::path oldDir, filesystem::path newDir, bool makeDirs) { namespace fs = std::filesystem; BPtr configPath = obs_module_config_path("."); - fs::path rootPath{configPath.Get()}; + fs::path rootPath{pathFromUtf8(configPath.Get())}; - fs::path oldPath = rootPath / fs::path(oldDir); - fs::path newPath = rootPath / fs::path(newDir); + fs::path oldPath = rootPath / oldDir; + fs::path newPath = rootPath / newDir; if (!fs::exists(oldPath)) { return; @@ -757,21 +771,20 @@ static void MigrateProfileConfigDir(std::string oldDir, std::string newDir, bool } } -static void MigrateDefaultProfileSubdirs(std::string parent, bool makeDirs) +static void MigrateDefaultProfileSubdirs(filesystem::path parent, bool makeDirs) { - constexpr std::array kMigrationDirectories{ - "Local Storage", - "Session Storage", - "Network", + namespace fs = std::filesystem; + + constexpr std::array kMigrationDirectories{ + u8"Local Storage", + u8"Session Storage", + u8"Network", }; - constexpr std::string_view kDefaultDirectoryPrefix{"Default/"}; + constexpr std::u8string_view kDefaultDirectoryPrefix{u8"Default"}; - for (std::string_view directory : kMigrationDirectories) { - std::string oldDirectory{parent}; - oldDirectory.append(directory); - std::string newDirectory{parent}; - newDirectory.append(kDefaultDirectoryPrefix); - newDirectory.append(directory); + for (std::u8string_view directory : kMigrationDirectories) { + fs::path oldDirectory = parent / directory; + fs::path newDirectory = parent / kDefaultDirectoryPrefix / directory; MigrateProfileConfigDir(oldDirectory, newDirectory, makeDirs); } @@ -781,7 +794,7 @@ static void MigrateToChromeRuntime() { namespace fs = std::filesystem; BPtr defaultConfigPath = obs_module_config_path("Default"); - fs::path defaultPath{defaultConfigPath.Get()}; + fs::path defaultPath{pathFromUtf8(defaultConfigPath.Get())}; // User has already previously launched with Chrome Runtime if (fs::exists(defaultPath)) { blog(LOG_INFO, "[obs-browser]: Chrome Runtime Default profile detected. No migration necessary."); @@ -789,7 +802,7 @@ static void MigrateToChromeRuntime() } BPtr localPrefsConfigPath = obs_module_config_path("LocalPrefs.json"); - fs::path localPrefs{localPrefsConfigPath.Get()}; + fs::path localPrefs{pathFromUtf8(localPrefsConfigPath.Get())}; // User has never launched old OBS Browser before if (!fs::exists(localPrefs)) { blog(LOG_DEBUG, "[obs-browser]: Alloy Runtime preferences not found. No migration necessary."); @@ -807,7 +820,7 @@ static void MigrateToChromeRuntime() MigrateDefaultProfileSubdirs("", false); BPtr newLocalPrefsConfigPath = obs_module_config_path("Local State"); - fs::path newLocalPrefs{newLocalPrefsConfigPath.Get()}; + fs::path newLocalPrefs{pathFromUtf8(newLocalPrefsConfigPath.Get())}; try { fs::copy(localPrefs, newLocalPrefs); } catch (const fs::filesystem_error &error) { @@ -817,24 +830,24 @@ static void MigrateToChromeRuntime() constexpr std::string_view prefix = "obs_profile_cookies"; BPtr serviceProfilesPath = obs_module_config_path(prefix.data()); - fs::path serviceProfiles{serviceProfilesPath.Get()}; + fs::path serviceProfiles{pathFromUtf8(serviceProfilesPath.Get())}; if (fs::exists(serviceProfiles)) { // User has service integration cookies that also must be copied for (auto const &dir_entry : std::filesystem::directory_iterator{serviceProfiles}) { if (!dir_entry.is_directory()) { continue; } - std::string name{dir_entry.path().filename().string()}; - std::string oldDir{prefix}; - oldDir.append("/"); - oldDir.append(name); - - std::string newDir{prefix}; - newDir.append("_"); - newDir.append(name); + fs::path name{dir_entry.path().filename()}; + + fs::path oldDir = fs::path{prefix} / name; + + fs::path newDir{prefix}; + newDir += "_"; + newDir += name; + MigrateProfileConfigDir(oldDir, newDir, true); - blog(LOG_INFO, "[obs-browser]: Migrated cookies for %s.", name.c_str()); + blog(LOG_INFO, "[obs-browser]: Migrated cookies for %s.", utf8BytesFromPath(name).c_str()); } } From 07227af86e0d9d6845bd5a583783a0d14c1025d2 Mon Sep 17 00:00:00 2001 From: Ryan Foster Date: Fri, 16 Oct 2026 17:20:46 -0400 Subject: [PATCH 6/6] Update version to 2.27.3 --- browser-version.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/browser-version.h b/browser-version.h index ec4ddec..73d4c83 100644 --- a/browser-version.h +++ b/browser-version.h @@ -2,7 +2,7 @@ #define OBS_BROWSER_VERSION_MAJOR 2 #define OBS_BROWSER_VERSION_MINOR 27 -#define OBS_BROWSER_VERSION_PATCH 2 +#define OBS_BROWSER_VERSION_PATCH 3 #ifndef MAKE_SEMANTIC_VERSION #define MAKE_SEMANTIC_VERSION(major, minor, patch) ((major << 24) | (minor << 16) | patch)