summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMoonchild <moonchild@palemoon.org>2020-08-28 06:46:12 +0000
committerMoonchild <moonchild@palemoon.org>2020-08-28 06:46:12 +0000
commit4358ff62a563938549c79684044cd423e94737c1 (patch)
treef50b26e17c2ee544decae21f5e6fde58c9eefcfe
parent6eb0dd86111cc2a7c55dfdc3eeb29a34c52e8035 (diff)
downloaduxp-4358ff62a563938549c79684044cd423e94737c1.tar.gz
[media] Only include source error details in debugging scenarios.
Unless a user is debugging media errors, this detail is unnecessary to report and could include sensitive data which could be abused by third-party requesters. This aligns it with the standard success/error paradigms in normal browsing situations.
-rw-r--r--dom/html/HTMLMediaElement.cpp14
-rw-r--r--modules/libpref/init/all.js8
2 files changed, 21 insertions, 1 deletions
diff --git a/dom/html/HTMLMediaElement.cpp b/dom/html/HTMLMediaElement.cpp
index cbb86edace..c7306b98ec 100644
--- a/dom/html/HTMLMediaElement.cpp
+++ b/dom/html/HTMLMediaElement.cpp
@@ -9,6 +9,7 @@
#include "mozilla/dom/HTMLSourceElement.h"
#include "mozilla/dom/ElementInlines.h"
#include "mozilla/dom/Promise.h"
+#include "mozilla/Preferences.h"
#include "mozilla/ArrayUtils.h"
#include "mozilla/MathAlgorithms.h"
#include "mozilla/AsyncEventDispatcher.h"
@@ -1245,7 +1246,18 @@ void HTMLMediaElement::NoSupportedMediaSourceError(const nsACString& aErrorDetai
if (mDecoder) {
ShutdownDecoder();
}
- mErrorSink->SetError(MEDIA_ERR_SRC_NOT_SUPPORTED, aErrorDetails);
+
+ // aErrorDetails can include sensitive details like MimeType or HTTP Status
+ // Code. We should not leak this and pass a Generic Error Message unless the
+ // user has explicitly enabled error reporting for debugging purposes.
+ bool reportDetails = Preferences::GetBool("media.sourceErrorDetails.enabled", false);
+ if (reportDetails) {
+ mErrorSink->SetError(MEDIA_ERR_SRC_NOT_SUPPORTED, aErrorDetails);
+ } else {
+ mErrorSink->SetError(MEDIA_ERR_SRC_NOT_SUPPORTED,
+ NS_LITERAL_CSTRING("Failed to open media"));
+ }
+
ChangeDelayLoadStatus(false);
UpdateAudioChannelPlayingState();
RejectPromises(TakePendingPlayPromises(), NS_ERROR_DOM_MEDIA_NOT_SUPPORTED_ERR);
diff --git a/modules/libpref/init/all.js b/modules/libpref/init/all.js
index 2a50d3704c..5eed08f865 100644
--- a/modules/libpref/init/all.js
+++ b/modules/libpref/init/all.js
@@ -5440,3 +5440,11 @@ pref("prompts.authentication_dialog_abuse_limit", 0);
// Whether module scripts (<script type="module">) are enabled for content.
pref("dom.moduleScripts.enabled", true);
+// Report details when a media source error occurs?
+// Enabled by default in debug builds, otherwise should be explicitly enabled
+// by the user to prevent XO leaking of the response status (CVE-2020-15666)
+#ifdef DEBUG
+pref("media.sourceErrorDetails.enabled", true);
+#else
+pref("media.sourceErrorDetails.enabled", false);
+#endif