Skip to main content

PrefPicker - Manage & generate prefs.js files

Project description

PrefPicker

Task Status codecov Matrix PyPI

Manage & generate prefs.js files for use when testing Firefox. This tool is intended to simplify the use and tracking of prefs used by our fuzzing tools. The template files can be modified to allow the creation of custom prefs.js files without the need to maintain a separate mostly duplicate version of a prefs file.

YAML Template Structure

The template document is made up of variants, prefs and values.

pref is the name of the preference that will be added to the prefs.js file. This is an unquoted string. Valid prefs can be found in all.js or in StaticPrefList.yml.

review_on_close is optional. It is a list of relevant Bugzilla IDs used to help avoid obsolete entries. When all bugs in the list are closed the entry will be reviewed and removed if appropriate.

value can be a bool, int, string or null. Adding multiple potential values is possible. When multiple values are present one is chosen at random when generating the output. Using a value of null will skip adding the pref to the output prefs.js file (acts as browser default).

variant is a subset of values to be used in place of the default values. The default variant is used unless a variant is specified.

There are a few mechanisms in place to help keep the file in order:

  • All prefs must have a default variant
  • All variants must be defined in the variant list
  • All variants in the variant list must be used
  • All variants must be a list and contain values
# example.yml
variant:              # list of extra variants, default is implied
- alt                 # name of variant
pref:
  pref.name:          # unquoted name of the pref used in prefs.js
    review_on_close:  # optional
    - 123456
    variants:
      default:        # variant definition, default is required
      - 0             # potential value
      alt:            # extra optional variant
      - 1             # if multiple values are defined one is chosen randomly
      - null          # null is a special case meaning do not add the pref

Quick Setup

Use pip to install prefpicker.

pip install prefpicker

Examples

Use a built-in template to generate an up-to-date prefs.js file.

prefpicker browser-fuzzing.yml prefs.js

Or generate a prefs.js file from a custom template using the webrender variant:

user@machine:~/prefpicker$ prefpicker custom/template.yml ~/Desktop/prefs.js --variant webrender
Loading 'template.yml'...
Loaded 255 prefs and 5 variants
Generating 'prefs.js' using variant 'webrender'...
Done.

The resulting prefs.js file is ready to be used with Firefox. It will look something like this:

// Generated with PrefPicker @ 2020-02-08 00:50:29 UTC
// Variant 'webrender'
/// ... snip
user_pref("fuzzing.enabled", true);
/// ... snip
// 'gfx.webrender.all' defined by variant 'webrender'
user_pref("gfx.webrender.all", true);
/// ... snip
// Fingerprint '13370ddba11'

Updating Templates

When adding a pref to a template it is encouraged to add a comment that provides justification and points to a bug in Bugzilla for additional context. If a pref does not already exist and is only used with non-default variants a 'null' entry must be added for the default variant.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

prefpicker-1.4.0.tar.gz (24.9 kB view details)

Uploaded Source

Built Distribution

prefpicker-1.4.0-py3-none-any.whl (22.1 kB view details)

Uploaded Python 3

File details

Details for the file prefpicker-1.4.0.tar.gz.

File metadata

  • Download URL: prefpicker-1.4.0.tar.gz
  • Upload date:
  • Size: 24.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.9.2 readme-renderer/37.3 requests/2.28.1 requests-toolbelt/0.10.1 urllib3/1.26.13 tqdm/4.64.1 importlib-metadata/5.2.0 keyring/23.13.1 rfc3986/2.0.0 colorama/0.4.6 CPython/3.8.15

File hashes

Hashes for prefpicker-1.4.0.tar.gz
Algorithm Hash digest
SHA256 b5c7ffa0bed7ace071aa697c438cce0ddc0885f3396f00a54d65fb43ec295e58
MD5 e4074c1c5ffa90e3aed1deb584c89fe6
BLAKE2b-256 d96040a7693bd44e798e2cae138d9fdccbfbd6282f6fec97d770ef4490ab7fcf

See more details on using hashes here.

File details

Details for the file prefpicker-1.4.0-py3-none-any.whl.

File metadata

  • Download URL: prefpicker-1.4.0-py3-none-any.whl
  • Upload date:
  • Size: 22.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.9.2 readme-renderer/37.3 requests/2.28.1 requests-toolbelt/0.10.1 urllib3/1.26.13 tqdm/4.64.1 importlib-metadata/5.2.0 keyring/23.13.1 rfc3986/2.0.0 colorama/0.4.6 CPython/3.8.15

File hashes

Hashes for prefpicker-1.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 608cc76abea67ecda4a77e409f999dc78ef5c925c88926ba0dd7efccd71af9dd
MD5 10b8d29ee5496ab2d7d61003c997ee94
BLAKE2b-256 d0084c3007ed2ed7ae3f10b63de70137037e023cfe532d83c667a2300b7ec0c6

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page