JavaScript Restrictor
Browser extension that improves privacy and security
|
Fingerprint Detector (FPD) main logic, fingerprinting evaluation and other essentials. More...
Functions | |
if (typeof browser.browserAction.setBadgeTextColor==="function") | |
function async | initFpd () |
function | balanceUnsupportedWrappers () |
function | correctGroupCriteria (rootGroup, effectedGroups, level) |
function | evaluateGroups (tabId) |
function | evaluateGroupsCriteria (rootGroup, level, tabId) |
function | evaluateResourcesCriteria (resource, groupName, level, tabId) |
function async | fpdCommonMessageListener (record, sender) |
function | fpdRequestCancel (requestDetails) |
function async | fpdLoadConfiguration () |
function | processGroupsRecursive (input, groupsLevel) |
function | isFpdWhitelisted (hostname) |
function | isFpdOn (tabId) |
function | notifyFingerprintBlocking (tabId) |
function | generateFpdReport (tabId) |
function | refreshDb (tabId) |
function | periodicEvaluation (tabId, delay) |
function | evaluateFingerprinting (tabId) |
function | clearStorageFacilities (url) |
function | split_resource (text) |
Variables | |
var | fpDetectionOn |
var | fpdWhitelist = {} |
var | fpdSettings = {} |
const | exceptionWrappers = ["CSSStyleDeclaration.prototype.fontFamily"] |
var | fpdObservable = new Observable() |
var | fpdGlobals |
const | FPD_DEF_SETTINGS |
Fingerprint Detector (FPD) main logic, fingerprinting evaluation and other essentials.
This file is part of Fingerprint Detector (FPD) and contains API groups evaluation logic. File also contains event listeners used for API logging, requests blocking and tabs management.
function balanceUnsupportedWrappers | ( | ) |
This function provides ability to balance/optimalize evaluation heuristics for cross-browser behaviour uniformity. It checks which resources are unsupported for given browser and adjust criteria of loaded FPD configuration accordingly.
function clearStorageFacilities | ( | url | ) |
The function that clears all supported browser storage mechanisms for a given origin.
url | URL address of the origin. |
function correctGroupCriteria | ( | rootGroup, | |
effectedGroups, | |||
level | |||
) |
The function that corrects groups criteria according to unsupported wrappers. Groups should be deleted when more than half of weights (resources) cannot be obtained in the same group (whole group is invalidated). Groups criteria of "value" type are also recomputed to take into account unsupported resources and deleted groups/subgroups.
rootGroup | Group object of certain level from FPD configuration (in "fp_levels.wrappers" format). |
effectedGroups | Object containing groups effected by criteria adjustment and corresponding deleted subgroups. |
level | FPD configuration level identifier. |
function evaluateFingerprinting | ( | tabId | ) |
The function that starts evaluation process and if fingerprinting is detected, it reacts accordingly.
tabId | Integer number representing ID of evaluated browser tab. |
function evaluateGroups | ( | tabId | ) |
The function initializing evaluation of logged API calls (fpDb) according to groups criteria (fpGroups).
tabId | Integer number representing ID of browser tab that is going to be evaluated. |
function evaluateGroupsCriteria | ( | rootGroup, | |
level, | |||
tabId | |||
) |
The function that evaluates group criteria according to evaluation of its child items (groups/resources).
rootGroup | Group name that needs to be evaluated. |
level | Level ID of groups and wrappers used for evaluation. |
tabId | Integer number representing ID of evaluated browser tab. |
Result object contains following properties: actualWeight (Obtained weight value of group after evaluation) maxWeight (Maximum obtainable weight value of group) type (Type of group item - group/call/get/set) accesses (Number of accesses to specified resource - groups always 0)
function evaluateResourcesCriteria | ( | resource, | |
groupName, | |||
level, | |||
tabId | |||
) |
The function that evaluates resource (wrapper) criteria according to API calls logs.
resource | Full name of resource/wrapper. |
groupName | Name of direct parent group. |
level | Level ID of groups and wrappers used for evaluation. |
tabId | Integer number representing ID of evaluated browser tab. |
Result object contains following properties (all of them in context of parent group): actualWeight (Obtained weight value of resource after evaluation) maxWeight (Maximum obtainable weight value of resource) type (Type of resource - call/get/set) accesses (Number of accesses to specified resource)
function async fpdCommonMessageListener | ( | record, | |
sender | |||
) |
Callback function that parses and handles messages recieved by FPD module. Messages may contain wrappers logging data that are stored into fpDb object. Also listen for popup messages to update FPD state and whitelist.
message | Receives full message. |
sender | Sender of the message. |
function async fpdLoadConfiguration | ( | ) |
The function that loads module configuration from sync storage.
function fpdRequestCancel | ( | requestDetails | ) |
The function that makes decisions about requests blocking. If blocking enabled, also clear browsing data.
requestDetails | Details about the request. |
function generateFpdReport | ( | tabId | ) |
The function that generates a report about fingerprinting evaluation in a separate window.
tabId | Integer number representing ID of evaluated browser tab. |
if | ( | typeof browser.browserAction. | setBadgeTextColor = == "function" | ) |
function async initFpd | ( | ) |
This function initializes FPD module, loads configuration from storage, and registers listeners needed for fingerprinting detection.
function isFpdOn | ( | tabId | ) |
The function that returns FPD setting for given url.
tabId | Tab identifier for which FPD setting is needed. |
function isFpdWhitelisted | ( | hostname | ) |
Check if the hostname or any of it's domains is whitelisted.
hostname | Any hostname (subdomains allowed). |
function notifyFingerprintBlocking | ( | tabId | ) |
The function that creates notification and informs user about fingerprinting activity.
tabId | Integer number representing ID of suspicious browser tab. |
function periodicEvaluation | ( | tabId, | |
delay | |||
) |
The function that periodically starts fingerprinting evaluation without the need for a request. Delay is increased exponentially and doubles in every call.
tabId | Integer number representing ID of browser tab. |
delay | Initial value of a delay in milliseconds. |
function processGroupsRecursive | ( | input, | |
groupsLevel | |||
) |
The function transforming recursive groups definition into indexed fpGroups object.
input | Group object from loaded JSON format. |
groupsLevel | Level ID of groups to process. |
function refreshDb | ( | tabId | ) |
Clear all stored logs for a tab.
tabId | Integer number representing ID of browser tab. |
function split_resource | ( | text | ) |
The function splitting resource string into path and name. For example: "window.navigator.userAgent" => path: "window.navigator", name: "userAgent"
wrappers | text String representing full name of resource. |
const exceptionWrappers = ["CSSStyleDeclaration.prototype.fontFamily"] |
Array containing names of unsupported wrappers that should be treated like supported ones during groups evaluation.
const FPD_DEF_SETTINGS |
Definition of settings supported by this module.
var fpDetectionOn |
FPD enable flag. Evaluate only when active.
var fpdGlobals |
var fpdObservable = new Observable() |
API logs database of following structure: "tabId" : { "resource" : { "type" : { arguments { arg : "access count" }, total : "total access count" } } }
*values in quotations are substituted by concrete names
var fpdSettings = {} |
Associative array of settings supported by this module.
var fpdWhitelist = {} |
Associative array of hosts, that are currently among trusted ones.