Repository navigation
fix: clarify missing or empty data_collection_permissions.required - #6246
Open
Thanatos9404 wants to merge 1 commit into
Open
Thanatos9404 wants to merge 1 commit into
Thanatos9404 wants to merge 1 commit into
Conversation
An extension that doesn't collect any data, or only declares optional data collection permissions, has to set "required" to ["none"]. Leaving "required" out, or setting it to [], was reported with the generic schema errors (MANIFEST_FIELD_REQUIRED, or JSON_INVALID with "Your JSON file could not be parsed."), which don't say what to do. Map both schema errors to a new MISSING_REQUIRED_DATA_COLLECTION_PERMISSIONS error that points to ["none"] and the data consent documentation. It is still an error, and the manifest is still invalid. Fixes mozilla#6118
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #6246 +/- ##
=======================================
Coverage 98.68% 98.69%
=======================================
Files 49 49
Lines 2963 2978 +15
Branches 918 923 +5
=======================================
+ Hits 2924 2939 +15
Misses 39 39 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #6118
An extension that doesn't collect any data, or only declares optional data collection permissions, has to set
"required": ["none"](now documented, mozilla/extension-workshop#2402). Whenrequiredwas left out or empty, the linter reported generic schema errors that don't say so:data_collection_permissions{"optional": ["technicalAndInteraction"]}MANIFEST_FIELD_REQUIRED:"/browser_specific_settings/gecko/data_collection_permissions" must have required property 'required', description "See https://mzl.la/1ZOhoEN (MDN Docs) for more information."MISSING_REQUIRED_DATA_COLLECTION_PERMISSIONS{"required": [], "optional": ["technicalAndInteraction"]}JSON_INVALID:"/browser_specific_settings/gecko/data_collection_permissions/required" must NOT have fewer than 1 items, description "Your JSON file could not be parsed."MISSING_REQUIRED_DATA_COLLECTION_PERMISSIONSAs suggested in the issue, this adds a message next to the existing data collection ones:
errorLookup()maps the two schema errors behind this (requiredwithmissingProperty: 'required'on thedata_collection_permissionsobject, andminItemson itsrequiredlist) to the new message, underbrowser_specific_settingsand the MV2applicationskey. It is still an error and the manifest is still invalid; only the text changes. The issue mentions a warning, butsrc/schema/updates/manifest.jsonmakesrequiredmandatory with at least one item, so a warning would change what AMO accepts rather than how it explains it.The rule is added to
docs/rules.md, anddocs/index.htmlis regenerated withscripts/build-rules.Tests
The two existing tests that asserted the generic messages now expect the new one. I added the two cases from the issue (only
optionalset, withrequiredmissing or empty), one forapplications, and one checking that arequiredvalue that isn't a list is still reported asMANIFEST_FIELD_INVALID. The five new-message cases fail on master.Run locally on Linux with Node 22:
npm run build,npm run test-once(64 suites, 1,737 tests passed),npm run test-integration-linter,npm run lint(no errors; the 3 existingjest/expect-expectwarnings intest.manifestjson.jsare unrelated), and Prettier on the changed files. I also ranbin/addons-linteron the two manifests above, before and after the change.