├── .prettierrc.json ├── version.json ├── .prettierignore ├── .python-version ├── requirements.in ├── .github ├── CODEOWNERS └── workflows │ └── test.yml ├── .dockerignore ├── .gitignore ├── Dockerfile ├── CookieBannerRuleList.schema.json ├── package.json ├── requirements.txt ├── README.md ├── test └── validateRules.js ├── rs-publish.py └── LICENSE /.prettierrc.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /version.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /.prettierignore: -------------------------------------------------------------------------------- 1 | node_modules -------------------------------------------------------------------------------- /.python-version: -------------------------------------------------------------------------------- 1 | 3.11.3 2 | -------------------------------------------------------------------------------- /requirements.in: -------------------------------------------------------------------------------- 1 | kinto-http 2 | -------------------------------------------------------------------------------- /.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | * @mozilla/cbh-rule-reviewers 2 | -------------------------------------------------------------------------------- /.dockerignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | test 3 | .circleci 4 | .github 5 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # npm packages 2 | /node_modules/ 3 | 4 | # python venv 5 | /venv/ 6 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM python:3.11.3-slim 2 | 3 | WORKDIR /usr/src/app 4 | 5 | COPY ./requirements.txt ./ 6 | 7 | RUN python -m pip install --no-cache-dir -r requirements.txt 8 | 9 | COPY ./rs-publish.py ./version.json ./cookie-banner-rules-list.json ./ 10 | 11 | CMD ["python", "./rs-publish.py"] 12 | -------------------------------------------------------------------------------- /CookieBannerRuleList.schema.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "object", 3 | "required": ["data"], 4 | "properties": { 5 | "data": { 6 | "type": "array", 7 | "items": { 8 | "$ref": "https://hg.mozilla.org/mozilla-central/raw-file/tip/toolkit/components/cookiebanners/schema/CookieBannerRule.schema.json" 9 | } 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /.github/workflows/test.yml: -------------------------------------------------------------------------------- 1 | name: Node.js CI 2 | 3 | on: 4 | push: 5 | branches: [main] 6 | pull_request: 7 | branches: [main] 8 | 9 | jobs: 10 | test: 11 | runs-on: ubuntu-latest 12 | steps: 13 | - uses: actions/checkout@v3 14 | - uses: actions/setup-node@v3 15 | with: 16 | node-version: 16 17 | cache: "npm" 18 | - run: npm ci 19 | - run: npm run test-formatting 20 | - run: npm run test-validate-rules 21 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "cookie-banner-rules-list", 3 | "version": "1.0.0", 4 | "description": "Rules List for how Firefox's Automated Cookie Banner Preference Manager is to interact with banners on a site by site basis", 5 | "scripts": { 6 | "test": "npm run test-formatting && npm run test-validate-rules", 7 | "test-validate-rules": "node test/validateRules.js", 8 | "test-formatting": "prettier --check .", 9 | "prettier": "prettier --write ." 10 | }, 11 | "repository": { 12 | "type": "git", 13 | "url": "git+https://github.com/mozilla/cookie-banner-rules-list.git" 14 | }, 15 | "author": "", 16 | "license": "MPL-2.0", 17 | "bugs": { 18 | "url": "https://github.com/mozilla/cookie-banner-rules-list/issues" 19 | }, 20 | "homepage": "https://github.com/mozilla/cookie-banner-rules-list#readme", 21 | "private": "true", 22 | "devDependencies": { 23 | "ajv": "^8.12.0", 24 | "node-fetch": "^3.3.2", 25 | "prettier": "3.0.3" 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | # 2 | # This file is autogenerated by pip-compile with Python 3.11 3 | # by the following command: 4 | # 5 | # pip-compile --generate-hashes requirements.in 6 | # 7 | backoff==2.1.2 \ 8 | --hash=sha256:407f1bc0f22723648a8880821b935ce5df8475cf04f7b6b5017ae264d30f6069 \ 9 | --hash=sha256:b135e6d7c7513ba2bfd6895bc32bc8c66c6f3b0279b4c6cd866053cfd7d3126b 10 | # via kinto-http 11 | certifi==2024.7.4 \ 12 | --hash=sha256:5a1e7645bc0ec61a09e26c36f6106dd4cf40c6db3a1fb6352b0244e7fb057c7b \ 13 | --hash=sha256:c198e21b1289c2ab85ee4e67bb4b4ef3ead0892059901a8d5b622f24a1101e90 14 | # via requests 15 | charset-normalizer==2.1.1 \ 16 | --hash=sha256:5a3d016c7c547f69d6f81fb0db9449ce888b418b5b9952cc5e6e66843e9dd845 \ 17 | --hash=sha256:83e9a75d1911279afd89352c68b45348559d1fc0506b054b346651b5e7fee29f 18 | # via requests 19 | idna==3.7 \ 20 | --hash=sha256:028ff3aadf0609c1fd278d8ea3089299412a7a8b9bd005dd08b9f8285bcb5cfc \ 21 | --hash=sha256:82fee1fc78add43492d3a1898bfa6d8a904cc97d8427f683ed8e798d07761aa0 22 | # via requests 23 | kinto-http==11.0.1 \ 24 | --hash=sha256:294ef42073a4accd577468525f5d8ed30003c6eaaaa1f091e46cd0993d6fceb6 \ 25 | --hash=sha256:baf213bf137b3b9819cf14b51e0fb798adf1040ded5f065f99b386943762d4f9 26 | # via -r requirements.in 27 | requests==2.32.0 \ 28 | --hash=sha256:f2c3881dddb70d056c5bd7600a4fae312b2a300e39be6a118d30b90bd27262b5 \ 29 | --hash=sha256:fa5490319474c82ef1d2c9bc459d3652e3ae4ef4c4ebdd18a21145a47ca4b6b8 30 | # via kinto-http 31 | unidecode==1.3.4 \ 32 | --hash=sha256:8e4352fb93d5a735c788110d2e7ac8e8031eb06ccbfe8d324ab71735015f9342 \ 33 | --hash=sha256:afa04efcdd818a93237574791be9b2817d7077c25a068b00f8cff7baa4e59257 34 | # via kinto-http 35 | urllib3==1.26.19 \ 36 | --hash=sha256:37a0344459b199fce0e80b0d3569837ec6b6937435c5244e7fd73fa6006830f3 \ 37 | --hash=sha256:3e3d753a8618b86d7de333b4223005f68720bcd6a7d2bcb9fbd2229ec7c1e429 38 | # via requests 39 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Cookie Banner Rule List 2 | 3 | Rules List for Firefox's automated cookie banner handling feature. 4 | 5 | > [!IMPORTANT] 6 | > Pull requests for cookie banner rules are currently not being accepted since 7 | > Cookie Banner Handling is currently not enabled in Firefox. 8 | 9 | ## How to Add or Update Rules 10 | 11 | ### Test Rules 12 | 13 | You can test rules locally in Firefox before adding them to the repository with the `cookiebanners.listService.testRules` pref. It accepts a JSON array of rules. Test rules will take precedence over rules from the global list. 14 | 15 | Since the feature is still in development, please use the latest version of [Firefox Nightly](https://nightly.mozilla.org) for testing. You need to set the following prefs to enable the feature: 16 | 17 | - `cookiebanners.service.mode` = `1` (reject all) or `2` (reject all or fall back to accept all). 18 | - `cookiebanners.bannerClicking.enabled` = `true` - Enables the clicking feature. 19 | - `cookiebanners.cookieInjector.enabled` = `true` - Enables the cookie injection feature. 20 | 21 | ### Submit Rules 22 | 23 | Once you have confirmed that your updated / added rules work in Nightly, you can add them to the rules file [cookie-banner-rules-list.json](./cookie-banner-rules-list.json) so they can be deployed to all Firefox clients. 24 | 25 | When adding rules to the array in the file, make sure that you don't add duplicates rules or rules with invalid JSON. Each rule needs to have a unique `id` field containing a UUID. You can generate one in your terminal with `uuidgen`. 26 | 27 | See [CookieBannerRuleList.schema.json](./CookieBannerRuleList.schema.json) and [CookieBannerRule.schema.json](https://hg.mozilla.org/mozilla-central/raw-file/tip/toolkit/components/cookiebanners/schema/CookieBannerRule.schema.json) for the exact rule format required. 28 | 29 | Before submitting run the following commands to ensure the rule list is well formatted and valid: 30 | 31 | Install dependencies: 32 | 33 | ``` 34 | npm install 35 | ``` 36 | 37 | Run tests: 38 | 39 | ``` 40 | npm test 41 | ``` 42 | 43 | You can correct any prettier formatting issues automatically with 44 | 45 | ``` 46 | npm run prettier 47 | ``` 48 | 49 | To submit your rule list change please create a pull request. Include the list of affected domains in the description. 50 | 51 | ### Example Rule 52 | 53 | Here is an example rule that both defines cookies to set and a cookie banner to click on: 54 | 55 | ```json 56 | { 57 | "domains": ["example.com", "example.org"], 58 | "click": { 59 | "hide": "#bannerParent", 60 | "optIn": "#accept-btn", 61 | "optOut": "#reject-btn", 62 | "presence": ".cookie-banner" 63 | }, 64 | "cookies": { 65 | "optOut": [ 66 | { 67 | "name": "cookieBannerConsent", 68 | "value": "0" 69 | } 70 | ] 71 | }, 72 | "id": "706cca25-cea5-49e8-9179-ff3f55c9c1d3" 73 | } 74 | ``` 75 | 76 | Not all fields are mandatory. See [CookieBannerRule.schema.json](https://hg.mozilla.org/mozilla-central/raw-file/tip/toolkit/components/cookiebanners/schema/CookieBannerRule.schema.json) for details. 77 | 78 | If a rule defines both click rules and cookies the implementation will first try to set cookies and only attempt to handle the banner if it still shows up. 79 | 80 | 81 | 82 | ## Deployment 83 | 84 | The [rs-publish.py](./rs-publish.py) script from this repo publishes the latest cookie-banner-rules-list.json and updates the associated collection in RemoteSettings: 85 | 86 | When running the script, logs are emitted to stdout indicate if the collection was updated, and if so, provide a short summary of the modifications, and ultimately ask for a data review of those changes (unless `ENVIRONMENT` is set to `dev`, in which case changes are automatically published) 87 | -------------------------------------------------------------------------------- /test/validateRules.js: -------------------------------------------------------------------------------- 1 | /* This Source Code Form is subject to the terms of the Mozilla Public 2 | * License, v. 2.0. If a copy of the MPL was not distributed with this 3 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 4 | 5 | const Ajv = require("ajv"); 6 | const fsPromise = require("fs").promises; 7 | 8 | const schema = require("../CookieBannerRuleList.schema.json"); 9 | const { exit } = require("process"); 10 | 11 | const RULE_LIST_FILE = "cookie-banner-rules-list.json"; 12 | 13 | // ID of the rule which contains sites where the mechanism is disabled. 14 | const RULE_ID_DISABLED = "disabled"; 15 | 16 | let fetch; 17 | 18 | /** 19 | * Load schema from URI via HTTP. 20 | * @param {string} uri - URI to load schema from. 21 | * @returns {Promise} - Resolve with the schema JSON object or rejects 22 | * on error. 23 | */ 24 | async function loadSchema(uri) { 25 | // node-fetch no longer supports importing via require(). We can't use the 26 | // global import because this is not a module. Use a dynamic import instead. 27 | // This code can be switched over to the regular fetch once node supports 28 | // it. 29 | if (!fetch) { 30 | fetch = (await import("node-fetch")).default; 31 | } 32 | 33 | const response = await fetch(uri); 34 | if (response.statusCode >= 400) 35 | throw new Error("Loading error: " + response.statusCode); 36 | return response.json(); 37 | } 38 | 39 | function exitWithError(reason) { 40 | console.error(`❌ ${RULE_LIST_FILE} is invalid: ${reason}`); 41 | exit(1); 42 | } 43 | 44 | const ajv = new Ajv({ loadSchema, allErrors: true }); 45 | 46 | (async () => { 47 | // 1. Load and parse the rules list. 48 | const ruleListStr = await fsPromise.readFile(RULE_LIST_FILE, { 49 | encoding: "utf-8", 50 | }); 51 | 52 | let ruleList; 53 | try { 54 | ruleList = JSON.parse(ruleListStr); 55 | } catch (error) { 56 | console.error("Error while parsing rule list", error); 57 | exitWithError("Invalid JSON"); 58 | } 59 | 60 | // 2. Validate rules list against schema. 61 | // The loadSchema method is passed to support fetching remote schemas 62 | // embedded via $ref in CookieBannerRuleList.schema.json. 63 | const validate = await ajv.compileAsync(schema); 64 | const valid = validate(ruleList); 65 | if (!valid) { 66 | console.info("Rule list validation error", validate.errors); 67 | exitWithError("Schema validation error"); 68 | } 69 | 70 | // 3. Check for duplicate rules (id or domains) 71 | const idSet = new Set(); 72 | const domainSet = new Set(); 73 | 74 | let foundDuplicates = false; 75 | ruleList.data.forEach((rule, i) => { 76 | if (idSet.has(rule.id)) { 77 | console.error(`Duplicate id ${rule.id} for rule #${i}`); 78 | foundDuplicates = true; 79 | } 80 | // This still allows for global rules which have an empty domains array. 81 | let duplicateDomains = rule.domains.filter((d) => domainSet.has(d)); 82 | if (duplicateDomains.length) { 83 | console.error(`Duplicate domain/s for rule #${i}`, duplicateDomains); 84 | foundDuplicates = true; 85 | } 86 | 87 | idSet.add(rule.id); 88 | rule.domains.forEach((d) => domainSet.add(d)); 89 | }); 90 | if (foundDuplicates) { 91 | exitWithError("Found duplicate rules"); 92 | } 93 | 94 | // 4. Check for empty rules that have no click or cookie injection rule. 95 | // Allow detect-only click rules that only have a presence field. 96 | // Also allow the "disabled" rule which contains all sites the mechanism is 97 | // disabled for. 98 | let foundEmptyRules = false; 99 | ruleList.data.forEach((rule, i) => { 100 | if ( 101 | rule.id !== RULE_ID_DISABLED && 102 | !rule.cookies?.optIn?.length && 103 | !rule.cookies?.optOut?.length && 104 | !rule.click?.presence 105 | ) { 106 | console.error(`Empty rule rule #${i} id: ${rule.id}`); 107 | foundEmptyRules = true; 108 | } 109 | }); 110 | if (foundEmptyRules) { 111 | exitWithError("Found empty rules"); 112 | } 113 | 114 | console.info(`✅ ${RULE_LIST_FILE} is valid.`); 115 | })(); 116 | -------------------------------------------------------------------------------- /rs-publish.py: -------------------------------------------------------------------------------- 1 | import json 2 | import os 3 | import sys 4 | import requests 5 | 6 | from kinto_http import Client, BearerTokenAuth 7 | 8 | AUTH = os.getenv("AUTHORIZATION", "") 9 | BUCKET = "main-workspace" 10 | COLLECTION = "cookie-banner-rules-list" 11 | 12 | 13 | class GitHubRepo: 14 | def __init__(self, org, repo): 15 | self.__org = org 16 | self.__repo = repo 17 | 18 | def __api_get(self, url): 19 | headers = {"Accept": "application/vnd.github+json"} 20 | 21 | response = requests.get(f"https://api.github.com{url}", headers=headers) 22 | doc = None 23 | 24 | if response.ok: 25 | doc = response.json() 26 | 27 | else: 28 | try: 29 | raise Exception( 30 | f'could not get latest release for "{self.__org}/{self.__repo}!"' 31 | ) 32 | 33 | except Exception as err: 34 | print(err, file=sys.stderr) 35 | sys.exit(1) 36 | 37 | return doc.get("tag_name") 38 | 39 | def __get(self, url): 40 | response = requests.get(url) 41 | body = None 42 | 43 | if response.ok: 44 | body = response.text 45 | 46 | else: 47 | try: 48 | raise Exception(f'could not get url: "{url}"!') 49 | 50 | except Exception as err: 51 | print(err, file=sys.stderr) 52 | sys.exit(1) 53 | 54 | return body 55 | 56 | def get_latest_release(self): 57 | latest_release = self.__api_get( 58 | f"/repos/{self.__org}/{self.__repo}/releases/latest" 59 | ) 60 | 61 | return latest_release 62 | 63 | def get_file_content(self, commitish, path): 64 | return self.__get( 65 | f"https://raw.githubusercontent.com/{self.__org}/{self.__repo}/{commitish}/{path}" 66 | ) 67 | 68 | 69 | # fetch cookie-banner-rules-list.json of latest release from github.com/mozilla/cookie-banner-rules-list 70 | gh_repo = GitHubRepo("mozilla", "cookie-banner-rules-list") 71 | latest_release = gh_repo.get_latest_release() 72 | source_records = json.loads( 73 | gh_repo.get_file_content(latest_release, "cookie-banner-rules-list.json") 74 | ).get("data") 75 | 76 | client = Client( 77 | server_url=os.getenv("SERVER", "https://remote-settings-dev.allizom.org/v1/"), 78 | bucket=BUCKET, 79 | collection=COLLECTION, 80 | auth=tuple(AUTH.split(":", 1)) if ":" in AUTH else BearerTokenAuth(AUTH), 81 | ) 82 | 83 | records_by_id = {r["id"]: r for r in client.get_records()} 84 | 85 | # Create or update the destination records. 86 | to_create = [] 87 | to_update = [] 88 | for r in source_records: 89 | record = records_by_id.pop(r["id"], None) 90 | 91 | # Record does not exist, create it. 92 | if record is None: 93 | to_create.append(r) 94 | continue 95 | 96 | # Record exists, check if it matches the record from the repo. 97 | # RemoteSettings includes meta-data fields which would always cause a 98 | # mismatch when comparing records. Remove them before compare. 99 | del record["last_modified"] 100 | del record["schema"] 101 | 102 | # Update the record on mismatch. 103 | if r != record: 104 | to_update.append(r) 105 | 106 | # Delete the records missing from source. 107 | to_delete = records_by_id.values() 108 | 109 | has_pending_changes = (len(to_create) + len(to_update) + len(to_delete)) > 0 110 | if not has_pending_changes: 111 | print("Records are in sync. Nothing to do.") 112 | sys.exit(0) 113 | 114 | with client.batch() as batch: 115 | for r in to_create: 116 | batch.create_record(data=r) 117 | for r in to_update: 118 | # Let the server assign a new timestamp. 119 | if "last_modified" in r: 120 | del r["last_modified"] 121 | batch.update_record(data=r) 122 | for r in to_delete: 123 | batch.delete_record(id=r["id"]) 124 | 125 | ops_count = len(batch.results()) 126 | 127 | # If collection has multi-signoff, request review, otherwise auto-approve changes. 128 | server_info = client.server_info() 129 | signer_config = server_info["capabilities"].get("signer", {}) 130 | signer_resources = signer_config.get("resources", []) 131 | # Check collection config (sign-off required etc.) 132 | signed_dest = [ 133 | r 134 | for r in signer_resources 135 | if r["source"]["bucket"] == BUCKET and r["source"]["collection"] == COLLECTION 136 | ] 137 | if len(signed_dest) == 0: 138 | # Not explicitly configured. Check if configured at bucket level? 139 | signed_dest = [ 140 | r 141 | for r in signer_resources 142 | if r["source"]["bucket"] == BUCKET and r["source"]["collection"] is None 143 | ] 144 | # Collection has no signoff features (eg. dev server). Nothing to do. 145 | if len(signed_dest) == 0: 146 | print(f"Done. {ops_count} changes applied.") 147 | sys.exit(0) 148 | 149 | has_signoff_disabled = not signed_dest[0].get( 150 | "to_review_enabled", signer_config["to_review_enabled"] 151 | ) and not signed_dest[0].get( 152 | "group_check_enabled", signer_config["group_check_enabled"] 153 | ) 154 | if has_signoff_disabled: 155 | # Approve the changes. 156 | client.patch_collection(data={"status": "to-sign"}) 157 | print(f"Done. {ops_count} changes applied and signed.") 158 | else: 159 | # Request review. 160 | client.patch_collection(data={"status": "to-review"}) 161 | print(f"Done. Requested review for {ops_count} changes.") 162 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Mozilla Public License Version 2.0 2 | ================================== 3 | 4 | 1. Definitions 5 | -------------- 6 | 7 | 1.1. "Contributor" 8 | means each individual or legal entity that creates, contributes to 9 | the creation of, or owns Covered Software. 10 | 11 | 1.2. "Contributor Version" 12 | means the combination of the Contributions of others (if any) used 13 | by a Contributor and that particular Contributor's Contribution. 14 | 15 | 1.3. "Contribution" 16 | means Covered Software of a particular Contributor. 17 | 18 | 1.4. "Covered Software" 19 | means Source Code Form to which the initial Contributor has attached 20 | the notice in Exhibit A, the Executable Form of such Source Code 21 | Form, and Modifications of such Source Code Form, in each case 22 | including portions thereof. 23 | 24 | 1.5. "Incompatible With Secondary Licenses" 25 | means 26 | 27 | (a) that the initial Contributor has attached the notice described 28 | in Exhibit B to the Covered Software; or 29 | 30 | (b) that the Covered Software was made available under the terms of 31 | version 1.1 or earlier of the License, but not also under the 32 | terms of a Secondary License. 33 | 34 | 1.6. "Executable Form" 35 | means any form of the work other than Source Code Form. 36 | 37 | 1.7. "Larger Work" 38 | means a work that combines Covered Software with other material, in 39 | a separate file or files, that is not Covered Software. 40 | 41 | 1.8. "License" 42 | means this document. 43 | 44 | 1.9. "Licensable" 45 | means having the right to grant, to the maximum extent possible, 46 | whether at the time of the initial grant or subsequently, any and 47 | all of the rights conveyed by this License. 48 | 49 | 1.10. "Modifications" 50 | means any of the following: 51 | 52 | (a) any file in Source Code Form that results from an addition to, 53 | deletion from, or modification of the contents of Covered 54 | Software; or 55 | 56 | (b) any new file in Source Code Form that contains any Covered 57 | Software. 58 | 59 | 1.11. "Patent Claims" of a Contributor 60 | means any patent claim(s), including without limitation, method, 61 | process, and apparatus claims, in any patent Licensable by such 62 | Contributor that would be infringed, but for the grant of the 63 | License, by the making, using, selling, offering for sale, having 64 | made, import, or transfer of either its Contributions or its 65 | Contributor Version. 66 | 67 | 1.12. "Secondary License" 68 | means either the GNU General Public License, Version 2.0, the GNU 69 | Lesser General Public License, Version 2.1, the GNU Affero General 70 | Public License, Version 3.0, or any later versions of those 71 | licenses. 72 | 73 | 1.13. "Source Code Form" 74 | means the form of the work preferred for making modifications. 75 | 76 | 1.14. "You" (or "Your") 77 | means an individual or a legal entity exercising rights under this 78 | License. For legal entities, "You" includes any entity that 79 | controls, is controlled by, or is under common control with You. For 80 | purposes of this definition, "control" means (a) the power, direct 81 | or indirect, to cause the direction or management of such entity, 82 | whether by contract or otherwise, or (b) ownership of more than 83 | fifty percent (50%) of the outstanding shares or beneficial 84 | ownership of such entity. 85 | 86 | 2. License Grants and Conditions 87 | -------------------------------- 88 | 89 | 2.1. Grants 90 | 91 | Each Contributor hereby grants You a world-wide, royalty-free, 92 | non-exclusive license: 93 | 94 | (a) under intellectual property rights (other than patent or trademark) 95 | Licensable by such Contributor to use, reproduce, make available, 96 | modify, display, perform, distribute, and otherwise exploit its 97 | Contributions, either on an unmodified basis, with Modifications, or 98 | as part of a Larger Work; and 99 | 100 | (b) under Patent Claims of such Contributor to make, use, sell, offer 101 | for sale, have made, import, and otherwise transfer either its 102 | Contributions or its Contributor Version. 103 | 104 | 2.2. Effective Date 105 | 106 | The licenses granted in Section 2.1 with respect to any Contribution 107 | become effective for each Contribution on the date the Contributor first 108 | distributes such Contribution. 109 | 110 | 2.3. Limitations on Grant Scope 111 | 112 | The licenses granted in this Section 2 are the only rights granted under 113 | this License. No additional rights or licenses will be implied from the 114 | distribution or licensing of Covered Software under this License. 115 | Notwithstanding Section 2.1(b) above, no patent license is granted by a 116 | Contributor: 117 | 118 | (a) for any code that a Contributor has removed from Covered Software; 119 | or 120 | 121 | (b) for infringements caused by: (i) Your and any other third party's 122 | modifications of Covered Software, or (ii) the combination of its 123 | Contributions with other software (except as part of its Contributor 124 | Version); or 125 | 126 | (c) under Patent Claims infringed by Covered Software in the absence of 127 | its Contributions. 128 | 129 | This License does not grant any rights in the trademarks, service marks, 130 | or logos of any Contributor (except as may be necessary to comply with 131 | the notice requirements in Section 3.4). 132 | 133 | 2.4. Subsequent Licenses 134 | 135 | No Contributor makes additional grants as a result of Your choice to 136 | distribute the Covered Software under a subsequent version of this 137 | License (see Section 10.2) or under the terms of a Secondary License (if 138 | permitted under the terms of Section 3.3). 139 | 140 | 2.5. Representation 141 | 142 | Each Contributor represents that the Contributor believes its 143 | Contributions are its original creation(s) or it has sufficient rights 144 | to grant the rights to its Contributions conveyed by this License. 145 | 146 | 2.6. Fair Use 147 | 148 | This License is not intended to limit any rights You have under 149 | applicable copyright doctrines of fair use, fair dealing, or other 150 | equivalents. 151 | 152 | 2.7. Conditions 153 | 154 | Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted 155 | in Section 2.1. 156 | 157 | 3. Responsibilities 158 | ------------------- 159 | 160 | 3.1. Distribution of Source Form 161 | 162 | All distribution of Covered Software in Source Code Form, including any 163 | Modifications that You create or to which You contribute, must be under 164 | the terms of this License. You must inform recipients that the Source 165 | Code Form of the Covered Software is governed by the terms of this 166 | License, and how they can obtain a copy of this License. You may not 167 | attempt to alter or restrict the recipients' rights in the Source Code 168 | Form. 169 | 170 | 3.2. Distribution of Executable Form 171 | 172 | If You distribute Covered Software in Executable Form then: 173 | 174 | (a) such Covered Software must also be made available in Source Code 175 | Form, as described in Section 3.1, and You must inform recipients of 176 | the Executable Form how they can obtain a copy of such Source Code 177 | Form by reasonable means in a timely manner, at a charge no more 178 | than the cost of distribution to the recipient; and 179 | 180 | (b) You may distribute such Executable Form under the terms of this 181 | License, or sublicense it under different terms, provided that the 182 | license for the Executable Form does not attempt to limit or alter 183 | the recipients' rights in the Source Code Form under this License. 184 | 185 | 3.3. Distribution of a Larger Work 186 | 187 | You may create and distribute a Larger Work under terms of Your choice, 188 | provided that You also comply with the requirements of this License for 189 | the Covered Software. If the Larger Work is a combination of Covered 190 | Software with a work governed by one or more Secondary Licenses, and the 191 | Covered Software is not Incompatible With Secondary Licenses, this 192 | License permits You to additionally distribute such Covered Software 193 | under the terms of such Secondary License(s), so that the recipient of 194 | the Larger Work may, at their option, further distribute the Covered 195 | Software under the terms of either this License or such Secondary 196 | License(s). 197 | 198 | 3.4. Notices 199 | 200 | You may not remove or alter the substance of any license notices 201 | (including copyright notices, patent notices, disclaimers of warranty, 202 | or limitations of liability) contained within the Source Code Form of 203 | the Covered Software, except that You may alter any license notices to 204 | the extent required to remedy known factual inaccuracies. 205 | 206 | 3.5. Application of Additional Terms 207 | 208 | You may choose to offer, and to charge a fee for, warranty, support, 209 | indemnity or liability obligations to one or more recipients of Covered 210 | Software. However, You may do so only on Your own behalf, and not on 211 | behalf of any Contributor. You must make it absolutely clear that any 212 | such warranty, support, indemnity, or liability obligation is offered by 213 | You alone, and You hereby agree to indemnify every Contributor for any 214 | liability incurred by such Contributor as a result of warranty, support, 215 | indemnity or liability terms You offer. You may include additional 216 | disclaimers of warranty and limitations of liability specific to any 217 | jurisdiction. 218 | 219 | 4. Inability to Comply Due to Statute or Regulation 220 | --------------------------------------------------- 221 | 222 | If it is impossible for You to comply with any of the terms of this 223 | License with respect to some or all of the Covered Software due to 224 | statute, judicial order, or regulation then You must: (a) comply with 225 | the terms of this License to the maximum extent possible; and (b) 226 | describe the limitations and the code they affect. Such description must 227 | be placed in a text file included with all distributions of the Covered 228 | Software under this License. Except to the extent prohibited by statute 229 | or regulation, such description must be sufficiently detailed for a 230 | recipient of ordinary skill to be able to understand it. 231 | 232 | 5. Termination 233 | -------------- 234 | 235 | 5.1. The rights granted under this License will terminate automatically 236 | if You fail to comply with any of its terms. However, if You become 237 | compliant, then the rights granted under this License from a particular 238 | Contributor are reinstated (a) provisionally, unless and until such 239 | Contributor explicitly and finally terminates Your grants, and (b) on an 240 | ongoing basis, if such Contributor fails to notify You of the 241 | non-compliance by some reasonable means prior to 60 days after You have 242 | come back into compliance. Moreover, Your grants from a particular 243 | Contributor are reinstated on an ongoing basis if such Contributor 244 | notifies You of the non-compliance by some reasonable means, this is the 245 | first time You have received notice of non-compliance with this License 246 | from such Contributor, and You become compliant prior to 30 days after 247 | Your receipt of the notice. 248 | 249 | 5.2. If You initiate litigation against any entity by asserting a patent 250 | infringement claim (excluding declaratory judgment actions, 251 | counter-claims, and cross-claims) alleging that a Contributor Version 252 | directly or indirectly infringes any patent, then the rights granted to 253 | You by any and all Contributors for the Covered Software under Section 254 | 2.1 of this License shall terminate. 255 | 256 | 5.3. In the event of termination under Sections 5.1 or 5.2 above, all 257 | end user license agreements (excluding distributors and resellers) which 258 | have been validly granted by You or Your distributors under this License 259 | prior to termination shall survive termination. 260 | 261 | ************************************************************************ 262 | * * 263 | * 6. Disclaimer of Warranty * 264 | * ------------------------- * 265 | * * 266 | * Covered Software is provided under this License on an "as is" * 267 | * basis, without warranty of any kind, either expressed, implied, or * 268 | * statutory, including, without limitation, warranties that the * 269 | * Covered Software is free of defects, merchantable, fit for a * 270 | * particular purpose or non-infringing. The entire risk as to the * 271 | * quality and performance of the Covered Software is with You. * 272 | * Should any Covered Software prove defective in any respect, You * 273 | * (not any Contributor) assume the cost of any necessary servicing, * 274 | * repair, or correction. This disclaimer of warranty constitutes an * 275 | * essential part of this License. No use of any Covered Software is * 276 | * authorized under this License except under this disclaimer. * 277 | * * 278 | ************************************************************************ 279 | 280 | ************************************************************************ 281 | * * 282 | * 7. Limitation of Liability * 283 | * -------------------------- * 284 | * * 285 | * Under no circumstances and under no legal theory, whether tort * 286 | * (including negligence), contract, or otherwise, shall any * 287 | * Contributor, or anyone who distributes Covered Software as * 288 | * permitted above, be liable to You for any direct, indirect, * 289 | * special, incidental, or consequential damages of any character * 290 | * including, without limitation, damages for lost profits, loss of * 291 | * goodwill, work stoppage, computer failure or malfunction, or any * 292 | * and all other commercial damages or losses, even if such party * 293 | * shall have been informed of the possibility of such damages. This * 294 | * limitation of liability shall not apply to liability for death or * 295 | * personal injury resulting from such party's negligence to the * 296 | * extent applicable law prohibits such limitation. Some * 297 | * jurisdictions do not allow the exclusion or limitation of * 298 | * incidental or consequential damages, so this exclusion and * 299 | * limitation may not apply to You. * 300 | * * 301 | ************************************************************************ 302 | 303 | 8. Litigation 304 | ------------- 305 | 306 | Any litigation relating to this License may be brought only in the 307 | courts of a jurisdiction where the defendant maintains its principal 308 | place of business and such litigation shall be governed by laws of that 309 | jurisdiction, without reference to its conflict-of-law provisions. 310 | Nothing in this Section shall prevent a party's ability to bring 311 | cross-claims or counter-claims. 312 | 313 | 9. Miscellaneous 314 | ---------------- 315 | 316 | This License represents the complete agreement concerning the subject 317 | matter hereof. If any provision of this License is held to be 318 | unenforceable, such provision shall be reformed only to the extent 319 | necessary to make it enforceable. Any law or regulation which provides 320 | that the language of a contract shall be construed against the drafter 321 | shall not be used to construe this License against a Contributor. 322 | 323 | 10. Versions of the License 324 | --------------------------- 325 | 326 | 10.1. New Versions 327 | 328 | Mozilla Foundation is the license steward. Except as provided in Section 329 | 10.3, no one other than the license steward has the right to modify or 330 | publish new versions of this License. Each version will be given a 331 | distinguishing version number. 332 | 333 | 10.2. Effect of New Versions 334 | 335 | You may distribute the Covered Software under the terms of the version 336 | of the License under which You originally received the Covered Software, 337 | or under the terms of any subsequent version published by the license 338 | steward. 339 | 340 | 10.3. Modified Versions 341 | 342 | If you create software not governed by this License, and you want to 343 | create a new license for such software, you may create and use a 344 | modified version of this License if you rename the license and remove 345 | any references to the name of the license steward (except to note that 346 | such modified license differs from this License). 347 | 348 | 10.4. Distributing Source Code Form that is Incompatible With Secondary 349 | Licenses 350 | 351 | If You choose to distribute Source Code Form that is Incompatible With 352 | Secondary Licenses under the terms of this version of the License, the 353 | notice described in Exhibit B of this License must be attached. 354 | 355 | Exhibit A - Source Code Form License Notice 356 | ------------------------------------------- 357 | 358 | This Source Code Form is subject to the terms of the Mozilla Public 359 | License, v. 2.0. If a copy of the MPL was not distributed with this 360 | file, You can obtain one at http://mozilla.org/MPL/2.0/. 361 | 362 | If it is not possible or desirable to put the notice in a particular 363 | file, then You may include the notice in a location (such as a LICENSE 364 | file in a relevant directory) where a recipient would be likely to look 365 | for such a notice. 366 | 367 | You may add additional accurate notices of copyright ownership. 368 | 369 | Exhibit B - "Incompatible With Secondary Licenses" Notice 370 | --------------------------------------------------------- 371 | 372 | This Source Code Form is "Incompatible With Secondary Licenses", as 373 | defined by the Mozilla Public License, v. 2.0. 374 | --------------------------------------------------------------------------------