Closed Bug 1292655 Opened 3 years ago Closed 3 years ago

Limit BatteryManager chargingTime/dischargingTime precision

Categories

(Core :: DOM: Core & HTML, defect)

defect
Not set

Tracking

()

RESOLVED FIXED
mozilla51
Tracking Status
firefox51 --- fixed

People

(Reporter: evilpie, Assigned: evilpie)

Details

(Keywords: dev-doc-complete, privacy)

Attachments

(1 file, 1 obsolete file)

These properties seem to be exact to a second and are potential tracking vectors (https://www.theguardian.com/technology/2016/aug/02/battery-status-indicators-tracking-online). We should reduce the precision of those properties similar to what we have done for level. (Bug 1191918)

I think something in the range of 15-30 minutes should still be enough precision to do something useful with that information.
However,  we  emphasize  that  the  dischargeTime  levels  can  be  subject  to  frequent  changes,
in  response  to  change  in  the  users'  computer  use  patterns.  This  means  that,  in  practice,  the
risk of long-term tracking with this information may be negligible
- https://eprint.iacr.org/2015/616.pdf

So we might not actually need to this? I still think exposing sub-minute information is probably too much. I prepared a patch that rounds to 15 minutes.
Assignee: nobody → evilpies
Status: NEW → ASSIGNED
Attachment #8778789 - Flags: review?(bzbarsky)
This could really use some more wide-ranging discussion and review from whoever owns this feature (probably not me).

There's a big difference between "15 minutes remaining" and "1 minute remaining", imo, so maybe it makes sense to round to nearest 15 unless smaller than 15 and then round to nearest 1 or 5 or something.  But it really depends on the intended use cases and attack scenarios....  We really need someone in this discussion who is at least aware of the former.  :(
Comment on attachment 8778789 [details] [diff] [review]
Round the remainingTime in the BatteryManager to 15 minutes

Going to punt this to Andrea, who may know something about the goals here....
Attachment #8778789 - Flags: review?(bzbarsky) → review?(amarchesini)
Summary: Limit BatterManager chargingTime/discharingTime precision → Limit BatterManager chargingTime/dischargingTime precision
Summary: Limit BatterManager chargingTime/dischargingTime precision → Limit BatteryManager chargingTime/dischargingTime precision
Comment on attachment 8778789 [details] [diff] [review]
Round the remainingTime in the BatteryManager to 15 minutes

Review of attachment 8778789 [details] [diff] [review]:
-----------------------------------------------------------------

T

::: dom/battery/BatteryManager.cpp
@@ +151,5 @@
>        mRemainingTime = mCharging ? kDefaultRemainingTime : kUnknownRemainingTime;
> +    } else if (mRemainingTime != kUnknownRemainingTime) {
> +      // Round the remaining time to a multiple of 15 minutes
> +      const double MINUTES_15 = 15.0 * 60.0;
> +      mRemainingTime = lround(mRemainingTime / MINUTES_15) * MINUTES_15;

The only thing I don't like here is that if mRemainingTime < 15.0*60.0 we return 0.
I would like to see a 15.0*60.0 in this case.
Attachment #8778789 - Flags: review?(amarchesini) → review-
Thanks for reviewing. Are you sure about 15 minutes?
Attachment #8778789 - Attachment is obsolete: true
Attachment #8781275 - Flags: review?(amarchesini)
Comment on attachment 8781275 [details] [diff] [review]
v2 - Round the remainingTime in the BatteryManager to 15 minutes

Review of attachment 8781275 [details] [diff] [review]:
-----------------------------------------------------------------

Ok. This looks good to me. About 15 minutes, maybe it's a bit too much, but this depends of the quality of the battery and so on.
I'm OK with this value.
Attachment #8781275 - Flags: review?(amarchesini) → review+
Pushed by evilpies@gmail.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/a0a05115cfe8
Limit BatteryManager chargingTime/dischargingTime precision. r=baku
https://hg.mozilla.org/mozilla-central/rev/a0a05115cfe8
Status: ASSIGNED → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla51
You need to log in before you can comment on or make changes to this bug.