brave / brave-browser

Brave browser for Android, iOS, Linux, macOS, Windows.
https://brave.com
Mozilla Public License 2.0
17.77k stars 2.32k forks source link

Brave ignores change of UserDataDir through registry #41854

Open thendricks0 opened 2 days ago

thendricks0 commented 2 days ago

Description

I tried changing the UserDataDir using Policies documented here: https://support.brave.com/hc/en-us/articles/360039248271-Group-Policy

This is my example reg:

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\BraveSoftware\Brave]
"UserDataDir"="D:\\CustomAppData\\BraveSoftware\\Brave-Browser\\User Data"
"BraveRewardsDisabled"=dword:00000001
"BraveWalletDisabled"=dword:00000001
"BraveVPNDisabled"=dword:00000001

I moved my original User Data dir from %LOCALAPPDATA%\BraveSoftware\Brave-Browser to the new directory.

If I start Brave now it creates a new directory under %LOCALAPPDATA%\BraveSoftware\Brave-Browser\User Data with a new profile etc.

When I open brave://policy it even shows the registry keys I set AND the disabling of Rewards, Wallets and VPN works as well. Only the User Data change doesn't work at all.

For fun I just tried replacing the double backslashes \\ with single slashes / but Brave simply ignores any change, I can also add an invalid directory, it simply does not work.

The directory path is completely valid, I can open the dir just fine.

I tested this with Google Chrome and it works fine there. Just for fun I also tried setting it in HKEY_CURRENT_USER\SOFTWARE\Policies\BraveSoftware\Brave, which is also recognized but still the UserDataDir is ignored. And I also tried setting the UserDataDir in HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Chromium to see if it still affected Brave, but it doesn't.

Steps to reproduce

  1. Remove %LOCALAPPDATA%\BraveSoftware\Brave-Browser\User Data or rename it
  2. Import the registry example, make sure to change UserDataDir to a valid path
  3. Start Brave
  4. See that Rewards, Wallet and VPN features are disabled, but the %LOCALAPPDATA%\BraveSoftware\Brave-Browser\User Data is re-created and the new directory from the reg file is not used
  5. Check brave://policy to see that all policies are recognized by Brave

Actual result

UserDataDir policy is ignored, also visible in brave://version

Expected result

UserDataDir policy is not ignored

Reproduces how often

Easily reproduced

Brave version (brave://version info)

Brave 1.71.118 Chromium: 130.0.6723.70 (Official Build) (64-bit)
Revision d29310b051bde8ba041cd7b4edcb41ce951be12c
OS Windows 11 Version 23H2 (Build 22631.4317)
Command Line "C:\Users\xxx\AppData\Local\BraveSoftware\Brave-Browser\Application\brave.exe" --disable-domain-reliability --enable-dom-distiller --enable-distillability-service --origin-trial-public-key=bYUKPJoPnCxeNvu72j4EmPuK7tr1PAC7SHh8ld9Mw3E=,fMS4mpO6buLQ/QMd+zJmxzty/VQ6B1EUZqoCU04zoRU= --lso-url=https://no-thanks.invalid --sync-url=https://sync-v2.brave.com/v2 --variations-server-url=https://variations.brave.com/seed --variations-insecure-server-url=https://variations.brave.com/seed --flag-switches-begin --flag-switches-end --component-updater=url-source=https://go-updater.brave.com/extensions
Executable Path C:\Users\xxx\AppData\Local\BraveSoftware\Brave-Browser\Application\brave.exe
Profile Path C:\Users\xxx\AppData\Local\BraveSoftware\Brave-Browser\User Data\Default

Channel information

Reproducibility

Miscellaneous information

No response

thendricks0 commented 2 days ago

Starting brave with --user-data-dir="<path>" works though as a workaround.