716cb28430
* chore: bump chromium in DEPS to 1e9f9a24aa12bea9cf194a82a7e249bd1242ec4f * chore: update patches * Make WebContents' theme color a base::Optional<SkColor> https://chromium-review.googlesource.com/c/chromium/src/+/1540022 * update autofill patch for incorrect header includes * Move Shell messages to web_test and rename to BlinkTest. https://chromium-review.googlesource.com/c/chromium/src/+/1525181 * Make PlatformNotificationServiceImpl a KeyedService. https://chromium-review.googlesource.com/c/chromium/src/+/1336150 * Move MediaPlayerId to its own file. https://chromium-review.googlesource.com/c/chromium/src/+/1547057 * Remove net/base/completion_callback.h, which is no longer used https://chromium-review.googlesource.com/c/chromium/src/+/1552821 * AW NS: support file scheme cookies https://chromium-review.googlesource.com/c/chromium/src/+/1533486 * Remove SecurityInfo and adapt remaining consumers https://chromium-review.googlesource.com/c/chromium/src/+/1509455 * Remove deprecated type-specific number to string conversion functions https://chromium-review.googlesource.com/c/chromium/src/+/1545881 * DevTools: Adding new performance histograms for launch of top 4 tools https://chromium-review.googlesource.com/c/chromium/src/+/1506388 * Update include paths for //base/hash/hash.h https://chromium-review.googlesource.com/c/chromium/src/+/1544630 * build: Disable ensure_gn_version gclient hook for mac CI checkout * update patches * use maybe version of v8::String::NewFromTwoByte * bump appveyor image version * fix mac ci hopefully * Convert enum to enum class for MenuAnchorPosition https://chromium-review.googlesource.com/c/chromium/src/+/1530508 * use maybe version of ToObject * RenderViewHost::GetProcess is no longer const * Unrefcount AuthChallengeInfo https://chromium-review.googlesource.com/c/chromium/src/+/1550631 * MenuButtonController takes Button rather than MenuButton https://chromium-review.googlesource.com/c/chromium/src/+/1500935 * add //ui/views_bridge_mac to deps to fix link error * forward declare views::Button in atom::MenuDelegate * more v8 patches * base/{=> hash}/md5.h https://chromium-review.googlesource.com/c/chromium/src/+/1535124 * gfx::{PlatformFontWin => win}::* https://chromium-review.googlesource.com/c/chromium/src/+/1534178 * fix v8 patches * [base] Rename TaskScheduler to ThreadPool https://chromium-review.googlesource.com/c/chromium/src/+/1561552 * use internal_config_base for bytecode_builtins_list_generator avoids windows link errors * FIXME: temporarily disable v8/breakpad integration * FIXME: temporarily disable prevent-will-redirect test * FIXME: disable neon on aarch64 pending crbug.com/953815 * update to account for WebCursor refactor https://chromium-review.googlesource.com/c/chromium/src/+/1562755 * enable stack dumping on appveyor * Revert "FIXME: disable neon on aarch64 pending crbug.com/953815" This reverts commit 57f082026be3d83069f2a2814684abf4dc9e7b53. * fix: remove const qualifiers to match upstream * fix: remove const qualifiers to match upstream in cc files as well * don't throw an error when testing if an object is an object * use non-deprecated Buffer constructor * Remove net::CookieSameSite::DEFAULT_MODE enum value https://chromium-review.googlesource.com/c/chromium/src/+/1567955 * depend on modded dbus-native to work around buffer deprecation https://github.com/sidorares/dbus-native/pull/262 * revert clang roll to fix arm build on linux * fixup! depend on modded dbus-native to work around buffer deprecation need more coffee * update coffee-script * robustify verify-mksnapshot w.r.t. command-line parameters * Revert "robustify verify-mksnapshot w.r.t. command-line parameters" This reverts commit a49af01411f684f6025528d604895c3696e0bc57. * fix mksnapshot by matching args * update patches * TMP: enable rdp on appveyor * Changed ContentBrowserClient::CreateQuotaPermissionContext() to return scoped_refptr. https://chromium-review.googlesource.com/c/chromium/src/+/1569376 * Make content::ResourceType an enum class. https://chromium-review.googlesource.com/c/chromium/src/+/1569345 * fixup! Make content::ResourceType an enum class. * turn off rdp * use net::CompletionRepeatingCallback instead of base::Callback<void(int)> * remove disable_ensure_gn_version_gclient_hook.patch * copy repeating callback instead of std::move * fix lint * add completion_repeating_callback.h include
133 lines
6.8 KiB
Diff
133 lines
6.8 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Jacob Quant <jacobq@gmail.com>
|
|
Date: Tue, 6 Nov 2018 15:26:00 -0600
|
|
Subject: dom_storage_limits.patch
|
|
|
|
This patch circumvents the restriction on DOM storage objects,
|
|
namely `localStorage` and `sessionStorage`, which chromium otherwise
|
|
limits to approximately 10MiB.
|
|
|
|
That restriction originates from a recommendation
|
|
[in the Web Storage API specification](https://html.spec.whatwg.org/multipage/webstorage.html#disk-space-2)
|
|
that is motivated by the concern that hostile code could abuse this
|
|
feature to exhaust available storage capacity.
|
|
However, in the case of Electron, where the application developers
|
|
have control over all of the code being executed,
|
|
this safety precaution becomes a hindrance that does not add much value.
|
|
For example, if a malicious developer wanted to consume disk space
|
|
on a victim's machine they could do so via Node's native file system API.
|
|
|
|
By disabling this restriction or increasing the quota,
|
|
electron application developers can use `localStorage`
|
|
as their application's "back end", without being having
|
|
to limit the amount of data stored to 10MiB.
|
|
|
|
There may still be some benefit to keeping this restriction for applications that load remote content.
|
|
Although all remote data should be from a trusted source and transferred using
|
|
a secure channel, it is nevertheless advisable to include additional layers of protection
|
|
to mitigate risks associated with potential compromise of those other technologies.
|
|
With that in mind, an acceptable alternative to disabling the limit at compile-time
|
|
(as this patch currently does) would be to instead allow it to be disabled at run-time
|
|
for a given `BrowserWindow` via a `webPreferences` option,
|
|
similar to [`nodeIntegration`](https://electronjs.org/docs/tutorial/security#2-disable-nodejs-integration-for-remote-content).
|
|
|
|
diff --git a/content/common/dom_storage/dom_storage_map.cc b/content/common/dom_storage/dom_storage_map.cc
|
|
index fd088fb170bead6452ded14016f21f0c29659e03..b90b6cf9132d16bc3b2076c3fa313916e2b5ea7d 100644
|
|
--- a/content/common/dom_storage/dom_storage_map.cc
|
|
+++ b/content/common/dom_storage/dom_storage_map.cc
|
|
@@ -185,10 +185,12 @@ bool DOMStorageMap::SetItemInternal(MapType* map_type,
|
|
size_t new_item_size = size_in_storage(key, value);
|
|
size_t new_storage_used = storage_used_ - old_item_size + new_item_size;
|
|
|
|
+#if 0
|
|
// Only check quota if the size is increasing, this allows
|
|
// shrinking changes to pre-existing files that are over budget.
|
|
if (new_item_size > old_item_size && new_storage_used > quota_)
|
|
return false;
|
|
+#endif
|
|
|
|
(*map_type)[key] = value;
|
|
ResetKeyIterator();
|
|
diff --git a/content/common/dom_storage/dom_storage_types.h b/content/common/dom_storage/dom_storage_types.h
|
|
index e87afe5b8ee07f7038a7cc9c40832b6cd27884da..61c9a0dfff60f79c7b36ff5c7d741c06dca03ada 100644
|
|
--- a/content/common/dom_storage/dom_storage_types.h
|
|
+++ b/content/common/dom_storage/dom_storage_types.h
|
|
@@ -21,6 +21,7 @@ typedef std::map<base::string16, base::NullableString16> DOMStorageValuesMap;
|
|
|
|
// The quota for each storage area.
|
|
// This value is enforced in renderer processes and the browser process.
|
|
+// However, Electron's dom_storage_limits.patch removes the code that checks this limit.
|
|
const size_t kPerStorageAreaQuota = 10 * 1024 * 1024;
|
|
|
|
// In the browser process we allow some overage to
|
|
diff --git a/content/renderer/dom_storage/dom_storage_cached_area.cc b/content/renderer/dom_storage/dom_storage_cached_area.cc
|
|
index 13bcf8e3f2882999e073d0c7ac6d8f1627f0bfa2..6d330cd1de358b477df4c1fed4d814c206a3643d 100644
|
|
--- a/content/renderer/dom_storage/dom_storage_cached_area.cc
|
|
+++ b/content/renderer/dom_storage/dom_storage_cached_area.cc
|
|
@@ -54,11 +54,13 @@ bool DOMStorageCachedArea::SetItem(int connection_id,
|
|
const base::string16& key,
|
|
const base::string16& value,
|
|
const GURL& page_url) {
|
|
+#if 0
|
|
// A quick check to reject obviously overbudget items to avoid
|
|
// the priming the cache.
|
|
if ((key.length() + value.length()) * sizeof(base::char16) >
|
|
kPerStorageAreaQuota)
|
|
return false;
|
|
+#endif
|
|
|
|
PrimeIfNeeded(connection_id);
|
|
base::NullableString16 old_value;
|
|
diff --git a/content/renderer/dom_storage/local_storage_cached_area.cc b/content/renderer/dom_storage/local_storage_cached_area.cc
|
|
index c04e0e8bff1a7a41a1e18aca5403aed16a80aead..d63cec971f0a98f7b8ff30c1f6a0fa843efbecfa 100644
|
|
--- a/content/renderer/dom_storage/local_storage_cached_area.cc
|
|
+++ b/content/renderer/dom_storage/local_storage_cached_area.cc
|
|
@@ -142,11 +142,13 @@ bool LocalStorageCachedArea::SetItem(const base::string16& key,
|
|
const base::string16& value,
|
|
const GURL& page_url,
|
|
const std::string& storage_area_id) {
|
|
+#if 0
|
|
// A quick check to reject obviously overbudget items to avoid priming the
|
|
// cache.
|
|
if ((key.length() + value.length()) * sizeof(base::char16) >
|
|
kPerStorageAreaQuota)
|
|
return false;
|
|
+#endif
|
|
|
|
EnsureLoaded();
|
|
bool result = false;
|
|
diff --git a/third_party/blink/renderer/modules/storage/cached_storage_area.cc b/third_party/blink/renderer/modules/storage/cached_storage_area.cc
|
|
index 9430717450759c77e8164bc1c496c4a8e4e9ddb6..8a8ff0816d8c015ea8a0456ba66b702b765a128a 100644
|
|
--- a/third_party/blink/renderer/modules/storage/cached_storage_area.cc
|
|
+++ b/third_party/blink/renderer/modules/storage/cached_storage_area.cc
|
|
@@ -106,11 +106,13 @@ bool CachedStorageArea::SetItem(const String& key,
|
|
Source* source) {
|
|
DCHECK(areas_->Contains(source));
|
|
|
|
+#if 0
|
|
// A quick check to reject obviously overbudget items to avoid priming the
|
|
// cache.
|
|
if ((key.length() + value.length()) * 2 >
|
|
mojom::blink::StorageArea::kPerStorageAreaQuota)
|
|
return false;
|
|
+#endif
|
|
|
|
EnsureLoaded();
|
|
String old_value;
|
|
diff --git a/third_party/blink/renderer/modules/storage/storage_area_map.cc b/third_party/blink/renderer/modules/storage/storage_area_map.cc
|
|
index 62ab01c2864baa2ef1945031faf42cbeefbfc72b..e7edaff1778c66812ab9f7058e89f84bfba94339 100644
|
|
--- a/third_party/blink/renderer/modules/storage/storage_area_map.cc
|
|
+++ b/third_party/blink/renderer/modules/storage/storage_area_map.cc
|
|
@@ -104,10 +104,12 @@ bool StorageAreaMap::SetItemInternal(const String& key,
|
|
size_t new_item_size = QuotaForString(key) + QuotaForString(value);
|
|
size_t new_quota_used = quota_used_ - old_item_size + new_item_size;
|
|
|
|
+#if 0
|
|
// Only check quota if the size is increasing, this allows
|
|
// shrinking changes to pre-existing files that are over budget.
|
|
if (check_quota && new_item_size > old_item_size && new_quota_used > quota_)
|
|
return false;
|
|
+#endif
|
|
|
|
keys_values_.Set(key, value);
|
|
ResetKeyIterator();
|