Extension Blocklisting:Code Design: Difference between revisions

m
no edit summary
mNo edit summary
mNo edit summary
Line 1: Line 1:
= Blacklisting Code Design =
''Please comment in the Talk page (use the Discussion tab above)''


== Update model ==
== Update model ==
* Download a blacklist file on a timer (86400 default)
* Download a blocklist file on a timer (86400 default)
* If items are newly blacklisted or unblacklisted, adjust the datasource appropriately and prompt to restart.
* If items are newly blocklisted or unblocklisted, adjust the datasource appropriately and prompt to restart.
* The blacklist file will be placed in the profile-dir.
* The blocklist file will be placed in the profile-dir.
* Blacklist is _replaced_ on each update, not merged or otherwise combined.
* Blocklist is _replaced_ on each update, not merged or otherwise combined.


== Blacklist syntax ==
== Blocklist syntax ==


* The blacklist file has a flexible xml syntax that will use default values for values that are not specified. All Extension Manager items must be children of <tt>emItems</tt> in order to ease the use of this file for additional blacklist items such as plugins that are not managed by the Extension Manager.
* The blocklist file has a flexible xml syntax that will use default values for values that are not specified. All Extension Manager items must be children of <tt>emItems</tt> in order to ease the use of this file for additional blocklist items such as plugins that are not managed by the Extension Manager.


Examples:
Examples:
<pre><blacklist xmlns="http://www.mozilla.org/2006/blacklist">
<pre><blocklist xmlns="http://www.mozilla.org/2006/blocklist">
   <emItems>
   <emItems>
     <emItem id="item_1@domain">
     <emItem id="item_1@domain">
Line 51: Line 51:
     <emItem id="item_5@domain"/>
     <emItem id="item_5@domain"/>
   </emItems>
   </emItems>
</blacklist></pre>
</blocklist></pre>
Examples Explained:
Examples Explained:
* The <tt>item_1@domain</tt> Extension Manager item will be blacklisted if a version between <tt>1.0</tt> and <tt>2.0.*</tt> (e.g. less than <tt>2.1</tt>) is installed and the Firefox (e.g. <tt>id</tt> equal to <tt>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</tt>) version is between <tt>1.5</tt> and <tt>1.5.*</tt> (e.g. less than <tt>1.6</tt>), the Firefox version is between 1.7 and <tt>1.7.*</tt> (e.g. less than <tt>1.8</tt>), or the Toolkit version is between <tt>1.8</tt> and <tt>1.8.*</tt> (e.g. less than <tt>1.9</tt>). Also, the item_1@domain Extension Manager item will be blacklisted if a version between <tt>3.0</tt> and <tt>3.0.*</tt> (e.g. less than <tt>3.1</tt>) is installed and the Firefox (e.g. <tt>id</tt> equal to <tt>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</tt>) version is between <tt>1.5</tt> and <tt>1.5.*</tt> (e.g. less than <tt>1.6</tt>) or the Toolkit version is between <tt>1.8</tt> and <tt>1.8.*</tt> (e.g. less than <tt>1.9</tt>).
* The <tt>item_1@domain</tt> Extension Manager item will be blocklisted if a version between <tt>1.0</tt> and <tt>2.0.*</tt> (e.g. less than <tt>2.1</tt>) is installed and the Firefox (e.g. <tt>id</tt> equal to <tt>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</tt>) version is between <tt>1.5</tt> and <tt>1.5.*</tt> (e.g. less than <tt>1.6</tt>), the Firefox version is between 1.7 and <tt>1.7.*</tt> (e.g. less than <tt>1.8</tt>), or the Toolkit version is between <tt>1.8</tt> and <tt>1.8.*</tt> (e.g. less than <tt>1.9</tt>). Also, the item_1@domain Extension Manager item will be blocklisted if a version between <tt>3.0</tt> and <tt>3.0.*</tt> (e.g. less than <tt>3.1</tt>) is installed and the Firefox (e.g. <tt>id</tt> equal to <tt>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</tt>) version is between <tt>1.5</tt> and <tt>1.5.*</tt> (e.g. less than <tt>1.6</tt>) or the Toolkit version is between <tt>1.8</tt> and <tt>1.8.*</tt> (e.g. less than <tt>1.9</tt>).
* The <tt>item_2@domain</tt> Extension Manager item will be blacklisted if a version between <tt>3.1</tt> and <tt>4.*</tt> (e.g. less than <tt>5</tt>) is installed for all version of the current application.
* The <tt>item_2@domain</tt> Extension Manager item will be blocklisted if a version between <tt>3.1</tt> and <tt>4.*</tt> (e.g. less than <tt>5</tt>) is installed for all version of the current application.
* All version of the item_3@domain Extension Manager item will be blacklisted if the Firefox (e.g. <tt>id</tt> equal to <tt>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</tt>) version is between <tt>1.5</tt> and <tt>1.5.*</tt> (e.g. less than <tt>1.6</tt>).
* All version of the item_3@domain Extension Manager item will be blocklisted if the Firefox (e.g. <tt>id</tt> equal to <tt>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</tt>) version is between <tt>1.5</tt> and <tt>1.5.*</tt> (e.g. less than <tt>1.6</tt>).
* All versions of the <tt>item_4@domain</tt> Extension Manager item will be blacklisted if the current application version is between <tt>1.5</tt> and <tt>1.5.*</tt> (e.g. less than <tt>1.6</tt>).
* All versions of the <tt>item_4@domain</tt> Extension Manager item will be blocklisted if the current application version is between <tt>1.5</tt> and <tt>1.5.*</tt> (e.g. less than <tt>1.6</tt>).
* All versions of the <tt>item_5@domain</tt> Extension Manager item will be blacklisted for all version of the current application.
* All versions of the <tt>item_5@domain</tt> Extension Manager item will be blocklisted for all version of the current application.


As can be seen it is possible to blacklist all version of an extension for all versions of an application as well as any combination of application id's along with version ranges for both the extension id and application id. Also, by not specifying a value and instead using the default value it is possible to lessen the size of the blacklist xml file. This is possible by using the following defaults:
As can be seen it is possible to blocklist all version of an extension for all versions of an application as well as any combination of application id's along with version ranges for both the extension id and application id. Also, by not specifying a value and instead using the default value it is possible to lessen the size of the blocklist xml file. This is possible by using the following defaults:
* <tt>minVersion</tt> = 0
* <tt>minVersion</tt> = 0
* <tt>maxVersion</tt> = *
* <tt>maxVersion</tt> = *
Line 66: Line 66:
At first glance it may seem more appropriate to use a plain text file and parse delimited values. The draw back of this method are that extension id's and application id's would have to be specified multiple times whereas with this format we are able to specify each extension id one time only and each application id for an extension id one time only.
At first glance it may seem more appropriate to use a plain text file and parse delimited values. The draw back of this method are that extension id's and application id's would have to be specified multiple times whereas with this format we are able to specify each extension id one time only and each application id for an extension id one time only.


If an extension's metadata matches all of the conditions it will be blacklisted and no further checking for that extension will be performed. This allows handling of overlapping ranges though there has been no use case for supporting overlapping ranges.
If an extension's metadata matches all of the conditions it will be blocklisted and no further checking for that extension will be performed. This allows handling of overlapping ranges though there has been no use case for supporting overlapping ranges.


Support for a <tt>targetApplication</tt> <tt>id</tt> of <tt>toolkit@mozilla.org</tt> has been added since this will be necessary after [https://bugzilla.mozilla.org/show_bug.cgi?id=299716 Bug 299716] is fixed.
Support for a <tt>targetApplication</tt> <tt>id</tt> of <tt>toolkit@mozilla.org</tt> has been added since this will be necessary after [https://bugzilla.mozilla.org/show_bug.cgi?id=299716 Bug 299716] is fixed.


We will be using individual blacklist files for each application in order to not penalize one application that has few or no blacklist items with the blacklist for an application that contains numerous blacklisted items.
We will be using individual blocklist files for each application in order to not penalize one application that has few or no blocklist items with the blocklist for an application that contains numerous blocklisted items.
Confirmed users
1,041

edits