Title: [246647] trunk/Source/WebCore
- Revision
- 246647
- Author
- [email protected]
- Date
- 2019-06-20 13:03:58 -0700 (Thu, 20 Jun 2019)
Log Message
Storage Access API: Cap the number of times an iframe document can request access
https://bugs.webkit.org/show_bug.cgi?id=199074
<rdar://problem/51857195>
Reviewed by Brent Fulgham.
Tested manually.
This change just adds a counter to the number of times the user explicitly
denies storage access and returns early if the counter has reached the limit
of 2.
We hoped that iframes that request storage access would count the number
of times the user has been asked and not repeat the request over and over.
However, we're seeing pretty aggressive use of the API and users are
complaining. Therefore, we need a cap on how many times an iframed
document can ask if it is explicitly denied access by the user.
This is a first measure. If we see continued aggressive use of the API,
we'll have to consider more drastic measures.
* dom/DocumentStorageAccess.cpp:
(WebCore::DocumentStorageAccess::requestStorageAccess):
* dom/DocumentStorageAccess.h:
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (246646 => 246647)
--- trunk/Source/WebCore/ChangeLog 2019-06-20 19:57:03 UTC (rev 246646)
+++ trunk/Source/WebCore/ChangeLog 2019-06-20 20:03:58 UTC (rev 246647)
@@ -1,3 +1,30 @@
+2019-06-20 John Wilander <[email protected]>
+
+ Storage Access API: Cap the number of times an iframe document can request access
+ https://bugs.webkit.org/show_bug.cgi?id=199074
+ <rdar://problem/51857195>
+
+ Reviewed by Brent Fulgham.
+
+ Tested manually.
+
+ This change just adds a counter to the number of times the user explicitly
+ denies storage access and returns early if the counter has reached the limit
+ of 2.
+
+ We hoped that iframes that request storage access would count the number
+ of times the user has been asked and not repeat the request over and over.
+ However, we're seeing pretty aggressive use of the API and users are
+ complaining. Therefore, we need a cap on how many times an iframed
+ document can ask if it is explicitly denied access by the user.
+
+ This is a first measure. If we see continued aggressive use of the API,
+ we'll have to consider more drastic measures.
+
+ * dom/DocumentStorageAccess.cpp:
+ (WebCore::DocumentStorageAccess::requestStorageAccess):
+ * dom/DocumentStorageAccess.h:
+
2019-06-20 Youenn Fablet <[email protected]>
Changing settings of a MediaStreamTrack clone should not alter the settings of the original track
Modified: trunk/Source/WebCore/dom/DocumentStorageAccess.cpp (246646 => 246647)
--- trunk/Source/WebCore/dom/DocumentStorageAccess.cpp 2019-06-20 19:57:03 UTC (rev 246646)
+++ trunk/Source/WebCore/dom/DocumentStorageAccess.cpp 2019-06-20 20:03:58 UTC (rev 246647)
@@ -128,7 +128,7 @@
return;
}
- if (!m_document.frame() || m_document.securityOrigin().isUnique()) {
+ if (!m_document.frame() || m_document.securityOrigin().isUnique() || !isAllowedToRequestFrameSpecificStorageAccess()) {
promise->reject();
return;
}
@@ -192,8 +192,11 @@
if (wasGranted == StorageAccessWasGranted::Yes) {
document->setHasFrameSpecificStorageAccess(true);
promise->resolve();
- } else
+ } else {
+ if (promptWasShown == StorageAccessPromptWasShown::Yes)
+ document->setWasExplicitlyDeniedFrameSpecificStorageAccess();
promise->reject();
+ }
if (shouldPreserveUserGesture) {
MicrotaskQueue::mainThreadQueue().append(std::make_unique<VoidMicrotask>([documentReference = WTFMove(documentReference)] () {
Modified: trunk/Source/WebCore/dom/DocumentStorageAccess.h (246646 => 246647)
--- trunk/Source/WebCore/dom/DocumentStorageAccess.h 2019-06-20 19:57:03 UTC (rev 246646)
+++ trunk/Source/WebCore/dom/DocumentStorageAccess.h 2019-06-20 20:03:58 UTC (rev 246647)
@@ -46,6 +46,8 @@
Yes
};
+const unsigned maxNumberOfTimesExplicitlyDeniedFrameSpecificStorageAccess = 2;
+
class DocumentStorageAccess final : public Supplement<Document>, public CanMakeWeakPtr<DocumentStorageAccess> {
WTF_MAKE_FAST_ALLOCATED;
public:
@@ -64,6 +66,8 @@
static const char* supplementName();
bool hasFrameSpecificStorageAccess() const;
void setHasFrameSpecificStorageAccess(bool);
+ void setWasExplicitlyDeniedFrameSpecificStorageAccess() { ++m_numberOfTimesExplicitlyDeniedFrameSpecificStorageAccess; };
+ bool isAllowedToRequestFrameSpecificStorageAccess() { return m_numberOfTimesExplicitlyDeniedFrameSpecificStorageAccess < maxNumberOfTimesExplicitlyDeniedFrameSpecificStorageAccess; };
void enableTemporaryTimeUserGesture();
void consumeTemporaryTimeUserGesture();
@@ -70,6 +74,8 @@
std::unique_ptr<UserGestureIndicator> m_temporaryUserGesture;
Document& m_document;
+
+ uint8_t m_numberOfTimesExplicitlyDeniedFrameSpecificStorageAccess = 0;
};
} // namespace WebCore
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes