| 
Commits:
59d59b87
 by Pier Angelo Vendrame   at 2024-04-08T12:48:52+02:00 
 fixup! Firefox preference overrides.
Bug 41676: Set privacy.resistFingerprinting.testing.setTZtoUTC as a
defense-in-depth.
We will have to revert this during the ESR-transition.
e29b76ff
 by Pier Angelo Vendrame   at 2024-04-08T12:50:50+02:00 
 Bug 42428: Make RFP spoof the timezone of document.lastModified.
4b70c6b0
 by Pier Angelo Vendrame   at 2024-04-08T12:51:14+02:00 
 Bug 42472: Spoof timezone in XSLT.
 
3 changed files:
Changes:
browser/app/profile/001-base-profile.js
 
| ... | ... | @@ -397,6 +397,9 @@ pref("browser.display.use_system_colors", false); |  
| 397 | 397 |  // Enforce non-native widget theme (true by default, defense in depth).
 |  
| 398 | 398 |  // Provides a uniform look and feel across platforms. Added with tor-browser#41496.
 |  
| 399 | 399 |  pref("widget.non-native-theme.enabled", true);
 |  
|  | 400 | +// tor-browser#41676: Set the TZ environment variable as a defense-in-depth.
 |  
|  | 401 | +// TODO: Remove this in ESR-128, as it has been removed in 116 with Bug 1837582.
 |  
|  | 402 | +pref("privacy.resistFingerprinting.testing.setTZtoUTC", true);
 |  
| 400 | 403 |  
 |  
| 401 | 404 |  // tor-browser#41943: lock and revisit after it gets flipped to true in stable Firefox
 |  
| 402 | 405 |  pref("_javascript_.options.spectre.disable_for_isolated_content", false, locked);
 |  dom/base/Document.cpp
 
 
| ... | ... | @@ -4104,10 +4104,11 @@ void Document::SetDocumentURI(nsIURI* aURI) { |  
| 4104 | 4104 |    }
 |  
| 4105 | 4105 |  }
 |  
| 4106 | 4106 |  
 |  
| 4107 |  | -static void GetFormattedTimeString(PRTime aTime,
 |  
|  | 4107 | +static void GetFormattedTimeString(PRTime aTime, bool aUniversal,
 |  
| 4108 | 4108 |                                     nsAString& aFormattedTimeString) {
 |  
| 4109 | 4109 |    PRExplodedTime prtime;
 |  
| 4110 |  | -  PR_ExplodeTime(aTime, PR_LocalTimeParameters, &prtime);
 |  
|  | 4110 | +  PR_ExplodeTime(aTime, aUniversal ? PR_GMTParameters : PR_LocalTimeParameters,
 |  
|  | 4111 | +                 &prtime);
 |  
| 4111 | 4112 |    // "MM/DD/YYYY hh:mm:ss"
 |  
| 4112 | 4113 |    char formatedTime[24];
 |  
| 4113 | 4114 |    if (SprintfLiteral(formatedTime, "%02d/%02d/%04d %02d:%02d:%02d",
 |  
| ... | ... | @@ -4125,7 +4126,9 @@ void Document::GetLastModified(nsAString& aLastModified) const { |  
| 4125 | 4126 |    if (!mLastModified.IsEmpty()) {
 |  
| 4126 | 4127 |      aLastModified.Assign(mLastModified);
 |  
| 4127 | 4128 |    } else {
 |  
| 4128 |  | -    GetFormattedTimeString(PR_Now(), aLastModified);
 |  
|  | 4129 | +    GetFormattedTimeString(PR_Now(),
 |  
|  | 4130 | +                           ShouldResistFingerprinting(RFPTarget::Unknown),
 |  
|  | 4131 | +                           aLastModified);
 |  
| 4129 | 4132 |    }
 |  
| 4130 | 4133 |  }
 |  
| 4131 | 4134 |  
 |  
| ... | ... | @@ -11113,7 +11116,8 @@ void Document::RetrieveRelevantHeaders(nsIChannel* aChannel) { |  
| 11113 | 11116 |  
 |  
| 11114 | 11117 |    mLastModified.Truncate();
 |  
| 11115 | 11118 |    if (modDate != 0) {
 |  
| 11116 |  | -    GetFormattedTimeString(modDate, mLastModified);
 |  
|  | 11119 | +    GetFormattedTimeString(
 |  
|  | 11120 | +        modDate, ShouldResistFingerprinting(RFPTarget::Unknown), mLastModified);
 |  
| 11117 | 11121 |    }
 |  
| 11118 | 11122 |  }
 |  
| 11119 | 11123 |  
 |  dom/xslt/xslt/txEXSLTFunctions.cpp
 
 
| ... | ... | @@ -591,7 +591,14 @@ nsresult txEXSLTFunctionCall::evaluate(txIEvalContext* aContext, |  
| 591 | 591 |        // http://exslt.org/date/functions/date-time/
 |  
| 592 | 592 |  
 |  
| 593 | 593 |        PRExplodedTime prtime;
 |  
| 594 |  | -      PR_ExplodeTime(PR_Now(), PR_LocalTimeParameters, &prtime);
 |  
|  | 594 | +      PR_ExplodeTime(
 |  
|  | 595 | +          PR_Now(),
 |  
|  | 596 | +          // We are not allowed to access the Document when evaluating this, so
 |  
|  | 597 | +          // fall back to the general function.
 |  
|  | 598 | +          nsContentUtils::ShouldResistFingerprinting(RFPTarget::Unknown)
 |  
|  | 599 | +              ? PR_GMTParameters
 |  
|  | 600 | +              : PR_LocalTimeParameters,
 |  
|  | 601 | +          &prtime);
 |  
| 595 | 602 |  
 |  
| 596 | 603 |        int32_t offset =
 |  
| 597 | 604 |            (prtime.tm_params.tp_gmt_offset + prtime.tm_params.tp_dst_offset) /
 |  
 |