-
Notifications
You must be signed in to change notification settings - Fork 74
Description
This issue is a proposal to extend the declarativeNetRequest API to add a way to disable an individual malfunctioning rule that is part of one of the static rulesets bundled with an extension.
This would allow extension developers to react in a timely manner to static rules with undesirable behavior, without hampering the functionality of the extension or risking unwanted side effects.
Motivation
Manifest v3 extensions may include static rulesets that will only be updated when the extension itself is updated. From time to time, these static lists might include rules that are found to have undesirable behaviour (either because of malice or human error).
While session and dynamic rules can be added and removed one by one, static rules can only be enabled and disabled along with every other rule in their ruleset. Therefore, the only solutions provided by the current API are to either:
- disable the entire ruleset, breaking the functionality of the extension, or
- wait until the next version of the extension is released, which could take weeks.
A possible workaround might be to add a dynamic rule which overrides the malfunctioning static rule, but doing that risks causing unwanted side effects as the new rule could conflict with other (correct) static rules.
Proposal
Since extensions are already able to review the contents of their static rulesets, it would be enough to add a way in the declarativeNetRequest API to disable a static rule (or a collection of them).
My proposal is that a collection of disabled rules is added as an optional field to UpdateRulesetOptions:
UpdateRulesetOptions.disableRulesof typeDisableRulesInfo[]
where
DisableRulesInforepresents the rules that must be disabled for a given ruleset, with the following properties:rulesetId:stringrepresenting the id of an enabled static ruleset;disableRulesIds:long[]containing the IDs of the rules in that ruleset to be disabled.
A main reason for choosing this approach over other alternatives (e.g. a separate method) is that it allows the result of calling updateEnabledRulesets to be a predictable atomic change of the state of the API, without depending on its previous state.
While not being strictly necessary to fix this issue, it would be a good idea to also add a method getDisabledRules() that returns the collection of rules that have been disabled in the currently active rulesets. Together with getEnabledRulesets() and other methods this would provide a way to know the detailed state of the API at any given time.
References
- This issue was reported as Chromium bug 1225229
- Chrome Extension API proposal (Google docs)