[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [Git][tpo/applications/tor-browser][base-browser-115.7.0esr-13.5-1] Bug 42397: change RFP-spoofed TZ to Atlantic/Reykjavik.



Title: GitLab

ma1 pushed to branch base-browser-115.7.0esr-13.5-1 at The Tor Project / Applications / Tor Browser

Commits:

  • e9d1e586
    by hackademix at 2024-02-06T11:48:03+01:00
    Bug 42397: change RFP-spoofed TZ to Atlantic/Reykjavik.
    

4 changed files:

Changes:

  • browser/components/resistfingerprinting/test/browser/browser_timezone.js
    1 1
     /**
    
    2 2
      * Bug 1330890 - A test case for verifying Date() object of _javascript_ will use
    
    3
    - *               UTC timezone after fingerprinting resistance is enabled.
    
    3
    + *               Atlantic/Reykjavik timezone (GMT and "real" equivalent to UTC)
    
    4
    + *               after fingerprinting resistance is enabled.
    
    4 5
      */
    
    5 6
     
    
    6 7
     async function verifySpoofed() {
    
    ... ... @@ -16,13 +17,15 @@ async function verifySpoofed() {
    16 17
       // Running in content:
    
    17 18
       function test() {
    
    18 19
         let date = new Date();
    
    20
    +    const TZ_NAME = "Atlantic/Reykjavik";
    
    21
    +    const TZ_SUFFIX = "(Greenwich Mean Time)";
    
    19 22
         ok(
    
    20
    -      date.toString().endsWith("(Coordinated Universal Time)"),
    
    21
    -      "The date toString() is in UTC timezone."
    
    23
    +      date.toString().endsWith(TZ_SUFFIX),
    
    24
    +      `The date toString() is in ${TZ_NAME} timezone.`
    
    22 25
         );
    
    23 26
         ok(
    
    24
    -      date.toTimeString().endsWith("(Coordinated Universal Time)"),
    
    25
    -      "The date toTimeString() is in UTC timezone."
    
    27
    +      date.toTimeString().endsWith(TZ_SUFFIX),
    
    28
    +      `The date toTimeString() is in ${TZ_NAME} timezone.`
    
    26 29
         );
    
    27 30
         let dateTimeFormat = Intl.DateTimeFormat("en-US", {
    
    28 31
           dateStyle: "full",
    
    ... ... @@ -30,12 +33,12 @@ async function verifySpoofed() {
    30 33
         });
    
    31 34
         is(
    
    32 35
           dateTimeFormat.resolvedOptions().timeZone,
    
    33
    -      "UTC",
    
    34
    -      "The Intl.DateTimeFormat is in UTC timezone."
    
    36
    +      TZ_NAME,
    
    37
    +      `The Intl.DateTimeFormat is in ${TZ_NAME} timezone.`
    
    35 38
         );
    
    36 39
         ok(
    
    37
    -      dateTimeFormat.format(date).endsWith("Coordinated Universal Time"),
    
    38
    -      "The Intl.DateTimeFormat is formatting with the UTC timezone."
    
    40
    +      dateTimeFormat.format(date).endsWith(TZ_SUFFIX),
    
    41
    +      `The Intl.DateTimeFormat is formatting with the ${TZ_NAME} timezone.`
    
    39 42
         );
    
    40 43
         is(
    
    41 44
           date.getFullYear(),
    

  • js/src/jit-test/tests/resist-fingerprinting/timezone.js
    ... ... @@ -2,7 +2,10 @@
    2 2
     
    
    3 3
     let tzRE = /\(([^\)]+)\)/;
    
    4 4
     
    
    5
    -// Make sure we aren't already running with UTC
    
    5
    +const SPOOFED_TZ_NAME = "Atlantic/Reykjavik";
    
    6
    +const SPOOFED_TZ_GENERIC = "Greenwich Mean Time";
    
    7
    +
    
    8
    +// Make sure we aren't already running with spoofed TZ
    
    6 9
     let original = new Date(0);
    
    7 10
     assertEq(tzRE.exec(original.toString())[1], "Pacific Standard Time");
    
    8 11
     
    
    ... ... @@ -16,8 +19,8 @@ assertEq(originalDT.resolvedOptions().timeZone, "PST8PDT");
    16 19
     let global = newGlobal({shouldResistFingerprinting: true});
    
    17 20
     
    
    18 21
     let date = new global.Date();
    
    19
    -assertEq(tzRE.exec(date.toString())[1], "Coordinated Universal Time");
    
    20
    -assertEq(tzRE.exec(date.toTimeString())[1], "Coordinated Universal Time");
    
    22
    +assertEq(tzRE.exec(date.toString())[1], SPOOFED_TZ_GENERIC);
    
    23
    +assertEq(tzRE.exec(date.toTimeString())[1], SPOOFED_TZ_GENERIC);
    
    21 24
     assertEq(date.getFullYear(), date.getUTCFullYear());
    
    22 25
     assertEq(date.getMonth(), date.getUTCMonth());
    
    23 26
     assertEq(date.getDate(), date.getUTCDate());
    
    ... ... @@ -29,5 +32,5 @@ let dt = global.Intl.DateTimeFormat("en-US", {
    29 32
       dateStyle: "full",
    
    30 33
       timeStyle: "full",
    
    31 34
     });
    
    32
    -assertEq(dt.format(date).endsWith("Coordinated Universal Time"), true);
    
    33
    -assertEq(dt.resolvedOptions().timeZone, "UTC");
    35
    +assertEq(dt.format(date).endsWith(SPOOFED_TZ_GENERIC), true);
    
    36
    +assertEq(dt.resolvedOptions().timeZone, SPOOFED_TZ_NAME);

  • js/src/vm/DateTime.cpp
    ... ... @@ -484,10 +484,11 @@ bool js::DateTimeInfo::internalTimeZoneDisplayName(char16_t* buf, size_t buflen,
    484 484
     
    
    485 485
     mozilla::intl::TimeZone* js::DateTimeInfo::timeZone() {
    
    486 486
       if (!timeZone_) {
    
    487
    -    // For resist finger printing mode we always use the UTC time zone.
    
    487
    +    // For resist finger printing mode we always use the Atlantic/Reykjavik time zone
    
    488
    +    // as a "real world" UTC equivalent.
    
    488 489
         mozilla::Maybe<mozilla::Span<const char16_t>> timeZoneOverride;
    
    489 490
         if (shouldResistFingerprinting_) {
    
    490
    -      timeZoneOverride = mozilla::Some(mozilla::MakeStringSpan(u"UTC"));
    
    491
    +      timeZoneOverride = mozilla::Some(mozilla::MakeStringSpan(u"Atlantic/Reykjavik"));
    
    491 492
         }
    
    492 493
     
    
    493 494
         auto timeZone = mozilla::intl::TimeZone::TryCreate(timeZoneOverride);
    

  • toolkit/components/resistfingerprinting/nsRFPService.cpp
    ... ... @@ -227,7 +227,7 @@ void nsRFPService::UpdateRFPPref() {
    227 227
       }
    
    228 228
     
    
    229 229
       if (resistFingerprinting) {
    
    230
    -    PR_SetEnv("TZ=UTC");
    
    230
    +    PR_SetEnv("TZ=Atlantic/Reykjavik");
    
    231 231
       } else if (sInitialized) {
    
    232 232
         // We will not touch the TZ value if 'privacy.resistFingerprinting' is false
    
    233 233
         // during the time of initialization.
    

  • _______________________________________________
    tor-commits mailing list
    tor-commits@xxxxxxxxxxxxxxxxxxxx
    https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits