tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit a80c99ed577d91c78909f004a347563898338a53
parent cd9bb28c070b2873ad77a3d96456ce686b052e68
Author: Tom Ritter <tom@mozilla.com>
Date:   Mon, 29 Dec 2025 20:28:59 +0000

Bug 2005866: Collect more detailed Math operation data r=timhuang

Differential Revision: https://phabricator.services.mozilla.com/D276713

Diffstat:
Mtoolkit/components/resistfingerprinting/UserCharacteristicsPageService.sys.mjs | 80+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mtoolkit/components/resistfingerprinting/metrics.yaml | 20++++++++++++++++++++
2 files changed, 100 insertions(+), 0 deletions(-)

diff --git a/toolkit/components/resistfingerprinting/UserCharacteristicsPageService.sys.mjs b/toolkit/components/resistfingerprinting/UserCharacteristicsPageService.sys.mjs @@ -158,6 +158,7 @@ export class UserCharacteristicsPageService { [this.populateZoomPrefs, []], [this.populateDisabledMediaPrefs, []], [this.populateMathOps, []], + [this.populateMathOpsFdlibm2, []], [this.populateMappableData, [data.output]], [this.populateGamepads, [data.gamepads]], [this.populateClientInfo, []], @@ -724,6 +725,85 @@ export class UserCharacteristicsPageService { } } + async populateMathOpsFdlibm2() { + // IF YOU ADD ENTRIES TO THIS LIST, PLEASE ALSO UPDATE THE COUNT IN + // toolkit/components/resistfingerprinting/tests/browser/browser_usercharacteristics_math.js + const getResults = () => { + const results = []; + + // Math constants + results.push(Math.PI); + results.push(Math.E); + results.push(Math.SQRT2); + results.push(Math.SQRT1_2); + results.push(Math.LN2); + results.push(Math.LN10); + results.push(Math.LOG2E); + results.push(Math.LOG10E); + + // Intermediate values from operation 15: Math.pow(Math.PI, -100) + results.push(Math.pow(Math.PI, -100)); + + // Intermediate values from operation 16: Math.log(1e154 + Math.sqrt(1e154^2 - 1)) + const v16 = 1e154; + results.push(v16); + results.push(v16 * v16); + const sqrt16 = Math.sqrt(v16 * v16 - 1); + results.push(sqrt16); + results.push(v16 + sqrt16); + + // Intermediate values from operation 17: Math.log(1 + Math.sqrt(2)) + const sqrt2 = Math.sqrt(2); + results.push(sqrt2); + results.push(1 + sqrt2); + + // Intermediate values from operation 18: Math.log((1 + 0.5) / (1 - 0.5)) / 2 + results.push(1 + 0.5); + results.push(1 - 0.5); + results.push((1 + 0.5) / (1 - 0.5)); + + // Intermediate values from operation 19: Math.exp(1) - 1 / Math.exp(1) / 2 + const exp1 = Math.exp(1); + results.push(exp1); + results.push(1 / exp1); + results.push(1 / exp1 / 2); + results.push(exp1 - 1 / exp1 / 2); + + // Intermediate values from operation 20: (Math.exp(1) + 1 / Math.exp(1)) / 2 + results.push(exp1 + 1 / exp1); + results.push((exp1 + 1 / exp1) / 2); + + // Intermediate values from operation 21: Math.exp(1) - 1 + results.push(exp1 - 1); + + // Intermediate values from operation 22: (Math.exp(2) - 1) / (Math.exp(2) + 1) + const exp2 = Math.exp(2); + results.push(exp2); + results.push(exp2 - 1); + results.push(exp2 + 1); + results.push((exp2 - 1) / (exp2 + 1)); + + // Intermediate values from operation 23: Math.log(1 + 10) + results.push(1 + 10); + + // Additional illustrative values + results.push(Math.sqrt(3)); + results.push(Math.sqrt(5)); + results.push(Math.pow(2, 0.5)); + results.push(Math.pow(Math.E, 2)); + results.push(Math.log(Math.E)); + results.push(Math.log(10)); + + return results; + }; + + const sandbox = Cu.Sandbox(null, { + alwaysUseFdlibm: true, + }); + const results = Cu.evalInSandbox(`(${getResults.toString()})()`, sandbox); + Glean.characteristics.mathOpsFdlibm2.set(JSON.stringify(results)); + } + async populateClientInfo() { const buildID = Services.appinfo.appBuildID; const buildDate = diff --git a/toolkit/components/resistfingerprinting/metrics.yaml b/toolkit/components/resistfingerprinting/metrics.yaml @@ -3415,6 +3415,26 @@ characteristics: # is more like 'technical' (per the Data Review), I'm marking highly sensitive. - highly_sensitive + math_ops_fdlibm_2: + type: text + description: > + Result of additional fingerprintable math operations, with fdlibm enabled + lifetime: application + send_in_pings: + - user-characteristics + notification_emails: + - tom@mozilla.com + bugs: + - https://bugzilla.mozilla.org/show_bug.cgi?id=1879151 + - https://bugzilla.mozilla.org/show_bug.cgi?id=2005866 + data_reviews: + - https://bugzilla.mozilla.org/show_bug.cgi?id=2005866 + expires: never + data_sensitivity: + # Text metrics are _required_ to be web_activity or highly_sensitive, so even though this + # is more like 'technical' (per the Data Review), I'm marking highly sensitive. + - highly_sensitive + keyboard_layout: type: string description: >