Issue metadata
Sign in to add a comment
|
Improve privacy properties of the Battery Status API |
||||||||||||||||||||||||
Issue description* The Battery Status API is available to non-Secure contexts. It shouldn't be. * The `battery.dischargingTime` is ~15 bits on a laptop that is unplugged. I'm not sure we even need this measurement to support any use cases...? * The battery power measurement is on a scale from 1..100, but could be just as useful with 1..10 or 1..5. See also: https://blog.lukaszolejnik.com/battery-status-readout-as-a-privacy-risk/ Adapted from MDN (https://developer.mozilla.org/en-US/docs/Web/API/Battery_Status_API): ==== <h1>Battery</h1> <script> navigator.getBattery().then(function(battery) { function updateAllBatteryInfo(){ updateChargeInfo(); updateLevelInfo(); updateChargingInfo(); updateDischargingInfo(); } updateAllBatteryInfo(); battery.addEventListener('chargingchange', function(){ updateChargeInfo(); }); function updateChargeInfo(){ console.log("Battery charging? " + (battery.charging ? "Yes" : "No")); } battery.addEventListener('levelchange', function(){ updateLevelInfo(); }); function updateLevelInfo(){ console.log("Battery level: " + battery.level); } battery.addEventListener('chargingtimechange', function(){ updateChargingInfo(); }); function updateChargingInfo(){ console.log("Battery charging time: " + battery.chargingTime + " seconds"); } battery.addEventListener('dischargingtimechange', function(){ updateDischargingInfo(); }); function updateDischargingInfo(){ console.log("Battery discharging time: " + battery.dischargingTime + " seconds"); } }); </script> ====
,
Jul 28 2017
Thiemo, do you want to start looking into this? Note that we'll have to get Blink owners approvals before landing a fix.
,
Aug 1 2017
I'm adding this to my list of fingerprintable features. Work on these is still to be prioritized.
,
Aug 9 2017
Note there are 2 TODOs here: (1) reduce resolution; (2) expose it only to secure contexts. These 2 tasks could be prioritized differently. Given that other browsers don't implement this, there should be low compatibility risk to either of these 2 changes.
,
Aug 9 2017
In any case, let me set Pri=2, since this is a "want", not "it would be nice if" bug.
,
Oct 24 2017
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/40b9767c09612064d25a3470caf175d093f3c94a commit 40b9767c09612064d25a3470caf175d093f3c94a Author: Ian Clelland <iclelland@google.com> Date: Tue Oct 24 20:10:21 2017 Count uses of navigator.getBattery which would be blocked by spec The most recent Battery Status API specification says that calls to getBattery from secure contexts, or from frames which are cross-origin with the top-level document, should return a promise which rejects. This doesn't match Chrome's implementation, so this CL adds use counters to evaluate the real-world effects that aligning with the spec would have. Bug: 747610 Change-Id: I2b0a387b1e61510700191946e345d9cef9a10e69 Reviewed-on: https://chromium-review.googlesource.com/733865 Commit-Queue: Ian Clelland <iclelland@chromium.org> Reviewed-by: Daniel Cheng <dcheng@chromium.org> Reviewed-by: Mounir Lamouri <mlamouri@chromium.org> Cr-Commit-Position: refs/heads/master@{#511243} [modify] https://crrev.com/40b9767c09612064d25a3470caf175d093f3c94a/third_party/WebKit/Source/core/frame/UseCounter.cpp [modify] https://crrev.com/40b9767c09612064d25a3470caf175d093f3c94a/third_party/WebKit/Source/core/frame/UseCounter.h [modify] https://crrev.com/40b9767c09612064d25a3470caf175d093f3c94a/third_party/WebKit/Source/modules/battery/NavigatorBattery.cpp [modify] https://crrev.com/40b9767c09612064d25a3470caf175d093f3c94a/third_party/WebKit/Source/modules/battery/NavigatorBattery.idl [modify] https://crrev.com/40b9767c09612064d25a3470caf175d093f3c94a/third_party/WebKit/public/platform/web_feature.mojom [modify] https://crrev.com/40b9767c09612064d25a3470caf175d093f3c94a/tools/metrics/histograms/enums.xml
,
Oct 26 2017
I'd like to merge these usecounters into M63 so that we can get some data before the end of the year on the impact of changing the API to match the spec. (This CL involves no behavior change, just counters)
,
Oct 26 2017
This bug requires manual review: M63 has already been promoted to the beta branch, so this requires manual review Please contact the milestone owner if you have questions. Owners: cmasso@(Android), cmasso@(iOS), gkihumba@(ChromeOS), govind@(Desktop) For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
,
Oct 26 2017
,
Oct 26 2017
Thank you iclelland@ for comment #7. Is this change baked/verified in Canary and safe to merge to M63?
,
Oct 26 2017
+ iclelland@, PTAL comment #10.
,
Oct 26 2017
Re: #10: Yes, this has been in Canary for ~48 hours now, and I've verified all of the code paths manually, to see that the counters are operating as expected.
,
Oct 26 2017
(Slight correction: It's been on ToT for ~48 hours; It's been in the 64.0.3249.0 and 64.0.3250 canaries, since whenever those were released)
,
Oct 26 2017
Approving merge to M63 branch 3239 based on comments #7, #12 and #13. Please merge ASAP. Thank you.
,
Oct 26 2017
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/04244f9ab6a2099968ccebe989d889943ecb4823 commit 04244f9ab6a2099968ccebe989d889943ecb4823 Author: Ian Clelland <iclelland@google.com> Date: Thu Oct 26 21:30:41 2017 Count uses of navigator.getBattery which would be blocked by spec The most recent Battery Status API specification says that calls to getBattery from secure contexts, or from frames which are cross-origin with the top-level document, should return a promise which rejects. This doesn't match Chrome's implementation, so this CL adds use counters to evaluate the real-world effects that aligning with the spec would have. TBR=iclelland@google.com (cherry picked from commit 40b9767c09612064d25a3470caf175d093f3c94a) Bug: 747610 Change-Id: I2b0a387b1e61510700191946e345d9cef9a10e69 Reviewed-on: https://chromium-review.googlesource.com/733865 Commit-Queue: Ian Clelland <iclelland@chromium.org> Reviewed-by: Daniel Cheng <dcheng@chromium.org> Reviewed-by: Mounir Lamouri <mlamouri@chromium.org> Cr-Original-Commit-Position: refs/heads/master@{#511243} Reviewed-on: https://chromium-review.googlesource.com/740601 Reviewed-by: Ian Clelland <iclelland@chromium.org> Cr-Commit-Position: refs/branch-heads/3239@{#251} Cr-Branched-From: adb61db19020ed8ecee5e91b1a0ea4c924ae2988-refs/heads/master@{#508578} [modify] https://crrev.com/04244f9ab6a2099968ccebe989d889943ecb4823/third_party/WebKit/Source/core/frame/UseCounter.cpp [modify] https://crrev.com/04244f9ab6a2099968ccebe989d889943ecb4823/third_party/WebKit/Source/core/frame/UseCounter.h [modify] https://crrev.com/04244f9ab6a2099968ccebe989d889943ecb4823/third_party/WebKit/Source/modules/battery/NavigatorBattery.cpp [modify] https://crrev.com/04244f9ab6a2099968ccebe989d889943ecb4823/third_party/WebKit/Source/modules/battery/NavigatorBattery.idl [modify] https://crrev.com/04244f9ab6a2099968ccebe989d889943ecb4823/third_party/WebKit/public/platform/web_feature.mojom [modify] https://crrev.com/04244f9ab6a2099968ccebe989d889943ecb4823/tools/metrics/histograms/enums.xml |
|||||||||||||||||||||||||
►
Sign in to add a comment |
|||||||||||||||||||||||||
Comment 1 by kojii@chromium.org
, Jul 24 2017