Skip to content

feat: Smart allowlisting [EE-735]

Vitalie Maldur requested to merge smart-allowlisting into master

Implementation of smart allowlisting as described in the PRD.

We are using filter's metadata to know when the filter should expire or renew. Used properties:

  • createdAt - timestamp of filter creation/renewal.
  • expiresInMs - time in ms after which the filter should expire.
  • autoExtendExpiry - if true, the expiry time will be extended every time the filter is used before expiration, false otherwise.
  • expiresAt - timestamp indicating when a filter should expire
  • autoExtendMs - milliseconds to extend the filter if needed.

We are using webNavigation.onBeforeNavigate event listener to check for filter expiration and webNavigation.onCompleted event listener to check for the renewal of filters.

Example usage

import * as EWE from `@eyeo/webext-ad-filtering-solution`;

// expire filter after 1 day
EWE.filters.add('@@example.com$document', {
  expiresAt: Date.now() + 24 * 60 * 60 * 1000, // in 1 day
});

// expire filter after 3 days with auto renewal
EWE.filters.add('@@example.com$document', {
  expiresAt: Date.now() + 3 * 24 * 60 * 60 * 1000, // in 3 days
  autoExtendMs: 3 * 24 * 60 * 60 * 1000, // 3 days
});

Note: Filter expiration works on any type of filter, but the renewal works only for the allowlisting filters.

Edited by Vitalie Maldur

Merge request reports