Skip to content

Firefox managed storage properties other than adminSettings not applying #2067

@theaquamarine

Description

@theaquamarine

Prerequisites

I tried to reproduce the issue when...

  • uBO is the only extension
  • uBO with default lists/settings
  • using a new, unmodified browser profile

Description

When configuring uBlock's managed storage properties for Firefox, properties other than adminSettings aren't being applied, but they're applied properly in Chrome and Edge. I'm using the Windows registry, but have tested quickly using a json and I think the same thing is happening.

I believe the issue is Firefox is escaping the properties and causing them to be read as strings rather than objects, as typeof (await vAPI.adminStorage.get(['toOverwrite'])).toOverwrite is string in Firefox but object in Chrome and Edge. adminSettings works as JSON.parse() is used on it, but not on the other properties, so the fix is probably more if ( typeof json === 'string' && json !== '' ) {data = JSON.parse(json);} like https://github.com/gorhill/uBlock/blob/ab6a59daf8bd183cbaf9f07d22f9d432d4adfc44/src/js/storage.js#L1392

The properties are also shown escaped on about:policies in Firefox even if they are not escaped in the registry (but not escaped on chrome://policy or edge://policy) suggesting Firefox is escaping them, but I've not been able to find anything saying this if this is expected.

A specific URL where the issue occurs

https://github.com

Steps to Reproduce

  1. Configure an admin policy other than adminSettings, eg toOverwrite [HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Mozilla\Firefox\3rdparty\Extensions\[email protected]] "toOverwrite"="{\"trustedSiteDirectives\": [\"example.com\",\"example.org\"]}"

  2. Start Firefox

Expected behavior

Settings are applied, in this example trusted sites are set to example.com and example.org

Actual behavior

Settings are applied, in this example trusted sites are not set

uBlock Origin version

1.41.8

Browser name and version

Firefox 98.0.2

Operating System and version

Windows Server 2019 17763.737

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions