This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 23642 - [security] Please require the relative-to-system-mixer sound volume model
Summary: [security] Please require the relative-to-system-mixer sound volume model
Status: RESOLVED DUPLICATE of bug 26828
Alias: None
Product: HTML WG
Classification: Unclassified
Component: HTML5 spec (show other bugs)
Version: unspecified
Hardware: PC Linux
: P2 normal
Target Milestone: ---
Assignee: This bug has no owner yet - up for the taking
QA Contact: HTML WG Bugzilla archive list
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-10-26 13:28 UTC by Alexander E. Patrakov
Modified: 2014-09-17 04:29 UTC (History)
5 users (show)

See Also:


Attachments

Description Alexander E. Patrakov 2013-10-26 13:28:01 UTC
The HTML5 spec says the following about the element's effective media volume:

"An element's effective media volume is determined as follows:

[...]

The element's effective media volume is volume, interpreted relative to the range 0.0 to 1.0, with 0.0 being silent, and 1.0 being the loudest setting, values in between increasing in loudness. The range need not be linear. The loudest setting may be lower than the system's loudest possible setting; for example the user could have set a maximum volume."

I think that the text needs to be clarified to rule out what I think is the deliberate misinterpretation currently done in Webkit-GTK on Linux, especially when the system runs PulseAudio in its default configuration with flat volumes. In fact, Xabier Rodríguez Calvar (a WebKit-GTK developer) has explicitly asked me to raise the issue with W3C during LinuxCon Europe 2013.

The misinterpretation done by WebKit-GTK + PulseAudio is that the volume is interpreted as relative to the sound card's maximum hardware volume. I.e., if the web page requests 100%, the master volume control of the system mixer will be bumped, resulting in a sound much louder than intended - potentially up to hardware or hearing damage. I think that it is a security issue to allow this behaviour, and thus want the wording to be changed in the standard.

Another reason to change the wording is this annoyance-class bug: if a browser implements the volume through any means that correspond to a slider in the system mixer, any application that sets the volume using a timer will result in that slider disobeying the user. This is indeed the case with Epiphany, Midori or any other browser based on WebKit-GTK under Linux with PulseAudio. It would be nice to disallow implementations that implement this annoyance.

In fact, all other browsers that I have tested (IE, Firefox, Chrome/Chromium, Opera) implement the volume as relative to the one set by the user in the system mixer, and I think that this behaviour is what was intended. There are web pages in the wild relying on this (e.g. by setting volume to 1.0 explicitly and assuming that it is just the safe default), e.g. http://www.mikanse.com/FunWithDynamite/fun-with-dynamite.html (search for "this.volume=1" in http://www.mikanse.com/FunWithDynamite/funwithdynamite.js)

Here are some relevant links:

https://bugzilla.gnome.org/show_bug.cgi?id=675217 (initial bug report)
http://jsfiddle.net/bteam/FbkGD/ (security-relevant reproducer - just repeatedly changes the volume to 99% or 100% using a timer)
The end of https://bugs.webkit.org/show_bug.cgi?id=118974 (the root cause)
http://www.openwall.com/lists/oss-security/2013/10/22/6 (attempted CVE request, not answered yet)

Here is the wanted clarification:

"The element's effective media volume is volume, interpreted relative to the range 0.0 to 1.0, with 0.0 being silent, and 1.0 being the loudest setting, values in between increasing in loudness. The range need not be linear. The loudest setting must be equal to or lower than the volume set for the browser in the system's mixer application, if the system has one. There may be other methods for the user to set the inviolable maximum volume, and there must be at least one such method. Volume changes done through the DOM or through the browser UI must not result in any changes to the user-controllable elements of the system mixer."

As I said, all major browsers already comply with the new requirements: the inviolable maximum volume is set in the system mixer, and javascript doesn't have access to it.

Of course, you are welcome to suggest a better wording that covers the issue. There may be other ways to produce audio from HTML5, they may need a similar clarification (requirement of a system-mixer-relative volume model) too.
Comment 1 Xabier Rodríguez Calvar 2013-11-05 11:33:27 UTC
(In reply to Alexander E. Patrakov from comment #0)
> The element's effective media volume is volume, interpreted relative to the
> range 0.0 to 1.0, with 0.0 being silent, and 1.0 being the loudest setting,
> values in between increasing in loudness. The range need not be linear. The
> loudest setting may be lower than the system's loudest possible setting; for
> example the user could have set a maximum volume."

> I think that the text needs to be clarified to rule out what I think is the
> deliberate misinterpretation currently done in Webkit-GTK on Linux,
> especially when the system runs PulseAudio in its default configuration with
> flat volumes. In fact, Xabier Rodríguez Calvar (a WebKit-GTK developer) has
> explicitly asked me to raise the issue with W3C during LinuxCon Europe 2013.

> The misinterpretation done by WebKit-GTK + PulseAudio is that the volume is
> interpreted as relative to the sound card's maximum hardware volume. I.e.,
> if the web page requests 100%, the master volume control of the system mixer
> will be bumped, resulting in a sound much louder than intended - potentially
> up to hardware or hearing damage. I think that it is a security issue to
> allow this behaviour, and thus want the wording to be changed in the
> standard.

> Of course, you are welcome to suggest a better wording that covers the
> issue. There may be other ways to produce audio from HTML5, they may need a
> similar clarification (requirement of a system-mixer-relative volume model)
> too.

Hi Alenxander, as we discussed at LinuxCon, I am happy that you made it here. However I disagree with your interpretation as it lacks some POVs because you give for granted certain concepts that are not granted like for example the existance of a 'system volume' and if doesn't exist you want a method to set a inviolable volume.

As I already told you a solution like this has many problems that you disregard and that can't be just applied as you'd like. From my POV, WebKitGtk+ is ok as it is now and complies with the standard, though I agree with you that there's a  security issue with the volume and I think the problem is with the standard.

As it happens with for example when going to fullscreen, the browser should raise a dialog before commiting the change when a webpage tries to set the volume of an element through javascript.
Comment 2 Alexander E. Patrakov 2014-07-17 09:17:28 UTC
FWIW, this is now CVE-2013-7324, and Webkit folks take the existing standard as an excuse not to fix it.
Comment 3 Ian 'Hixie' Hickson 2014-09-17 00:40:37 UTC
The text you quote explicitly says "The loudest setting may be lower than the system's loudest possible setting; for example the user could have set a maximum volume". The spec explicitly doesn't define "loudest setting".

Note that this bug is on the W3C version, which is unlikely to be updated soon. If you would like this examined more quickly, I recommend filing a bug with the upstream WHATWG HTML standard: http://whatwg.org/newbug (same bug system, but different document and different editorial priorities)
Comment 4 Alexander E. Patrakov 2014-09-17 04:29:13 UTC
Done, https://www.w3.org/Bugs/Public/show_bug.cgi?id=26828

*** This bug has been marked as a duplicate of bug 26828 ***