prefpicker


Nameprefpicker JSON
Version 2.2.0 PyPI version JSON
download
home_pagehttps://github.com/MozillaSecurity/prefpicker
SummaryPrefPicker - Manage & generate prefs.js files
upload_time2024-12-17 16:34:08
maintainerMozilla Fuzzing Team
docs_urlNone
authorTyson Smith
requires_python>=3.9
licenseMPL 2.0
keywords firefox fuzz fuzzing test testing
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            PrefPicker
==========
[![Task Status](https://community-tc.services.mozilla.com/api/github/v1/repository/MozillaSecurity/prefpicker/master/badge.svg)](https://community-tc.services.mozilla.com/api/github/v1/repository/MozillaSecurity/prefpicker/master/latest)
[![codecov](https://codecov.io/gh/MozillaSecurity/prefpicker/branch/master/graph/badge.svg)](https://codecov.io/gh/MozillaSecurity/prefpicker)
[![Matrix](https://img.shields.io/badge/dynamic/json?color=green&label=chat&query=%24.chunk[%3F(%40.canonical_alias%3D%3D%22%23fuzzing%3Amozilla.org%22)].num_joined_members&suffix=%20users&url=https%3A%2F%2Fmozilla.modular.im%2F_matrix%2Fclient%2Fr0%2FpublicRooms&style=flat&logo=matrix)](https://riot.im/app/#/room/#fuzzing:mozilla.org)
[![PyPI](https://img.shields.io/pypi/v/prefpicker)](https://pypi.org/project/prefpicker)


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](https://hg.mozilla.org/mozilla-central/file/tip/modules/libpref/init/all.js) or in [StaticPrefList.yml](https://hg.mozilla.org/mozilla-central/file/tip/modules/libpref/init/StaticPrefList.yaml).

__**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 exclude the pref from the 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

```yml
# 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 exclude the pref
```

Updating Templates and Adding Prefs
-----------------------------------
Prefs are found in the `.yml` files in the [template](/src/prefpicker/templates) directory.
Only prefs that are ready to be tested should be added.
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 to the default variant.

Quick Setup
-----------

Use pip to install prefpicker.

```bash
pip install prefpicker
```

Examples
--------

Use a built-in [template](/src/prefpicker/templates) to generate an up-to-date `prefs.js` file.

```bash
prefpicker browser-fuzzing.yml prefs.js
```

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

```bash
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:

```js
// 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
```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/MozillaSecurity/prefpicker",
    "name": "prefpicker",
    "maintainer": "Mozilla Fuzzing Team",
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": "fuzzing@mozilla.com",
    "keywords": "firefox fuzz fuzzing test testing",
    "author": "Tyson Smith",
    "author_email": "twsmith@mozilla.com",
    "download_url": "https://files.pythonhosted.org/packages/31/c2/adbd3d1969f70de96965b565443293046f05b942656b5f409cfa8a4974d5/prefpicker-2.2.0.tar.gz",
    "platform": null,
    "description": "PrefPicker\n==========\n[![Task Status](https://community-tc.services.mozilla.com/api/github/v1/repository/MozillaSecurity/prefpicker/master/badge.svg)](https://community-tc.services.mozilla.com/api/github/v1/repository/MozillaSecurity/prefpicker/master/latest)\n[![codecov](https://codecov.io/gh/MozillaSecurity/prefpicker/branch/master/graph/badge.svg)](https://codecov.io/gh/MozillaSecurity/prefpicker)\n[![Matrix](https://img.shields.io/badge/dynamic/json?color=green&label=chat&query=%24.chunk[%3F(%40.canonical_alias%3D%3D%22%23fuzzing%3Amozilla.org%22)].num_joined_members&suffix=%20users&url=https%3A%2F%2Fmozilla.modular.im%2F_matrix%2Fclient%2Fr0%2FpublicRooms&style=flat&logo=matrix)](https://riot.im/app/#/room/#fuzzing:mozilla.org)\n[![PyPI](https://img.shields.io/pypi/v/prefpicker)](https://pypi.org/project/prefpicker)\n\n\nManage & generate prefs.js files for use when testing Firefox. This tool is intended to simplify the use and tracking of prefs used by\nour fuzzing tools. The template files can be modified to allow the creation of custom prefs.js files without\nthe need to maintain a separate mostly duplicate version of a prefs file.\n\nYAML Template Structure\n-----------------------\n\nThe template document is made up of variants, prefs and values.\n\n_**pref**_ is the name of the preference that will be added to the prefs.js file. This is an unquoted string.\nValid prefs can be found in [all.js](https://hg.mozilla.org/mozilla-central/file/tip/modules/libpref/init/all.js) or in [StaticPrefList.yml](https://hg.mozilla.org/mozilla-central/file/tip/modules/libpref/init/StaticPrefList.yaml).\n\n__**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.\n\n_**value**_ can be a `bool`, `int`, `string` or `null`. Adding multiple potential values is possible.\nWhen multiple values are present one is chosen at random when generating the output.\nUsing a value of `null` will exclude the pref from the prefs.js file (acts as browser default).\n\n_**variant**_ is a subset of values to be used in place of the default values.\nThe default variant is used unless a variant is specified.\n\nThere are a few mechanisms in place to help keep the file in order:\n- All prefs must have a default variant\n- All variants must be defined in the variant list\n- All variants in the variant list must be used\n- All variants must be a list and contain values\n\n```yml\n# example.yml\nvariant:              # list of extra variants, default is implied\n- alt                 # name of variant\npref:\n  pref.name:          # unquoted name of the pref used in prefs.js\n    review_on_close:  # optional\n    - 123456\n    variants:\n      default:        # variant definition, default is required\n      - 0             # potential value\n      alt:            # extra optional variant\n      - 1             # if multiple values are defined one is chosen randomly\n      - null          # null is a special case meaning exclude the pref\n```\n\nUpdating Templates and Adding Prefs\n-----------------------------------\nPrefs are found in the `.yml` files in the [template](/src/prefpicker/templates) directory.\nOnly prefs that are ready to be tested should be added.\nWhen 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.\nIf a pref does not already exist and is only used with non-default variants a `null` entry must be added to the default variant.\n\nQuick Setup\n-----------\n\nUse pip to install prefpicker.\n\n```bash\npip install prefpicker\n```\n\nExamples\n--------\n\nUse a built-in [template](/src/prefpicker/templates) to generate an up-to-date `prefs.js` file.\n\n```bash\nprefpicker browser-fuzzing.yml prefs.js\n```\n\nOr generate a `prefs.js` file from a custom template using the `webrender` variant:\n\n```bash\nuser@machine:~/prefpicker$ prefpicker custom/template.yml ~/Desktop/prefs.js --variant webrender\nLoading 'template.yml'...\nLoaded 255 prefs and 5 variants\nGenerating 'prefs.js' using variant 'webrender'...\nDone.\n```\n\nThe resulting `prefs.js` file is ready to be used with Firefox. It will look something like this:\n\n```js\n// Generated with PrefPicker @ 2020-02-08 00:50:29 UTC\n// Variant 'webrender'\n/// ... snip\nuser_pref(\"fuzzing.enabled\", true);\n/// ... snip\n// 'gfx.webrender.all' defined by variant 'webrender'\nuser_pref(\"gfx.webrender.all\", true);\n/// ... snip\n```\n",
    "bugtrack_url": null,
    "license": "MPL 2.0",
    "summary": "PrefPicker - Manage & generate prefs.js files",
    "version": "2.2.0",
    "project_urls": {
        "Homepage": "https://github.com/MozillaSecurity/prefpicker"
    },
    "split_keywords": [
        "firefox",
        "fuzz",
        "fuzzing",
        "test",
        "testing"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "8483cbf294853ec459b4f9c50176d6200dc608890ef7009479b89b3660f74255",
                "md5": "4684a0fdbb86c8c953f7179e1660db95",
                "sha256": "eb2adf0766ce65276d08a7864b029335f3f68ee60bba39c518d58c5b7890233d"
            },
            "downloads": -1,
            "filename": "prefpicker-2.2.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "4684a0fdbb86c8c953f7179e1660db95",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 23619,
            "upload_time": "2024-12-17T16:34:06",
            "upload_time_iso_8601": "2024-12-17T16:34:06.453860Z",
            "url": "https://files.pythonhosted.org/packages/84/83/cbf294853ec459b4f9c50176d6200dc608890ef7009479b89b3660f74255/prefpicker-2.2.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "31c2adbd3d1969f70de96965b565443293046f05b942656b5f409cfa8a4974d5",
                "md5": "dcea582714c097d6e49445205b469985",
                "sha256": "4c8b4ccab48b339a832c4e9e41ae825587cdfc46b1e61a47ebf10e8a885c3150"
            },
            "downloads": -1,
            "filename": "prefpicker-2.2.0.tar.gz",
            "has_sig": false,
            "md5_digest": "dcea582714c097d6e49445205b469985",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 27024,
            "upload_time": "2024-12-17T16:34:08",
            "upload_time_iso_8601": "2024-12-17T16:34:08.855074Z",
            "url": "https://files.pythonhosted.org/packages/31/c2/adbd3d1969f70de96965b565443293046f05b942656b5f409cfa8a4974d5/prefpicker-2.2.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-12-17 16:34:08",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "MozillaSecurity",
    "github_project": "prefpicker",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "tox": true,
    "lcname": "prefpicker"
}
        
Elapsed time: 0.45428s