Fix WebSerializedScriptValueVersion logic for IDB to account for serializer rewrite |
||
Issue descriptionIf I understand correctly, the logic today works like this: - when opening a database, read a metadata entry that stores the format version - if it is greater than the current one (as seen in WebSerializedScriptValueVersion.h), reject it - else, update to that version number This is less trivial now, because part of the serialization logic lives in V8, which is versioned separately from Blink. This means that V8 might introduce incompatible changes to the serialization of basic objects, or Blink might introduce incompatible changes to the serialization of web DOM objects. In the short term, I think I can bump WebSerializedScriptValueVersion.h to match the Blink-side version. The proper natural equivalent would seem to be a (V8Version, BlinkVersion) tuple, which is "in the future" if either version is greater than the known current one. But this logic currently happens in the browser process, from which we probably ought not to be including v8 headers or referencing v8 symbols (even referencing Blink is suspect, though it's fine in this case because it's just a constant). One thing that seems conceptually clean is that the IndexedDB client ought to be telling the service what version logic it supports, rather than the service magically sharing this information via a header. It doesn't seem trivial to plumb this through the IndexedDB infrastucture, though. WDYT, jsbell?
,
Mar 23 2017
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/6f58d02c2c69db09f474ac879795e6a97b5fa01f commit 6f58d02c2c69db09f474ac879795e6a97b5fa01f Author: jbroman <jbroman@chromium.org> Date: Thu Mar 23 16:44:29 2017 Sync SerializedScriptValue::wireFormatVersion with V8ScriptValueSerializer. This updates the version seen by IndexedDB to match what V8ScriptValueSerializer believes. This doesn't capture the V8-side versioning, but is a step toward making things consistent. BUG= 704293 Review-Url: https://codereview.chromium.org/2767243002 Cr-Commit-Position: refs/heads/master@{#459118} [modify] https://crrev.com/6f58d02c2c69db09f474ac879795e6a97b5fa01f/third_party/WebKit/Source/bindings/core/v8/SerializedScriptValue.h [modify] https://crrev.com/6f58d02c2c69db09f474ac879795e6a97b5fa01f/third_party/WebKit/Source/bindings/core/v8/serialization/V8ScriptValueSerializer.cpp [modify] https://crrev.com/6f58d02c2c69db09f474ac879795e6a97b5fa01f/third_party/WebKit/Source/bindings/core/v8/serialization/V8ScriptValueSerializer.h [modify] https://crrev.com/6f58d02c2c69db09f474ac879795e6a97b5fa01f/third_party/WebKit/Source/web/AssertMatchingEnums.cpp [modify] https://crrev.com/6f58d02c2c69db09f474ac879795e6a97b5fa01f/third_party/WebKit/public/web/WebSerializedScriptValueVersion.h
,
Mar 23 2017
2 quick questions: Because the backing store can be opened for any of the indexed_db::mojom::Factory methods, it seems that I'd either need a parameter on each, or a "configure" method call that happens when the service is connected to, to cache the value on the IndexedDBDispatcherHost. I'm slightly inclined to prefer the latter. In either case, do you have an opinion on what should happen if the declared version differs from one provided when the backing store was previously opened? (This should never happen, unless a compromised renderer is playing games.) We could make it fail in some way, but I'm kind of inclined to log a message (we shouldn't crash the browser, though, IIUC) and continue.
,
Mar 23 2017
Yeah, the configure approach seems forward looking. Log and continue is fine. mojo::ReportBadMessage() is also an option - I believe that terminates a corrupt/compromised renderer. Thank you *so* much for taking this on - it's awesome that you're following up on this. Ping pwnall@ and dmurph@ as necessary for help!
,
Apr 4 2017
The following revision refers to this bug: https://chromium.googlesource.com/v8/v8.git/+/e46f841849ef541e31c2cc4891c1ce44e57285b1 commit e46f841849ef541e31c2cc4891c1ce44e57285b1 Author: jbroman <jbroman@chromium.org> Date: Tue Apr 04 19:26:32 2017 Export the current data format version used by ValueSerializer. This enables clients like IndexedDB to know when the data format version has decreased (i.e. the user has switched to an earlier version) and deal with the resulting incompatibility up front. BUG= chromium:704293 Review-Url: https://codereview.chromium.org/2772723005 Cr-Commit-Position: refs/heads/master@{#44391} [modify] https://crrev.com/e46f841849ef541e31c2cc4891c1ce44e57285b1/include/v8.h [modify] https://crrev.com/e46f841849ef541e31c2cc4891c1ce44e57285b1/src/api.cc [modify] https://crrev.com/e46f841849ef541e31c2cc4891c1ce44e57285b1/src/value-serializer.cc [modify] https://crrev.com/e46f841849ef541e31c2cc4891c1ce44e57285b1/src/value-serializer.h
,
Apr 20 2017
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/3ee0c8ab5180fb87ce012b784bb47a3da507c1a0 commit 3ee0c8ab5180fb87ce012b784bb47a3da507c1a0 Author: jbroman <jbroman@chromium.org> Date: Thu Apr 20 14:25:03 2017 Use a two-part data format version in IndexedDB metadata. This breaks the 64-bit data format version stored in the database metadata into two 32-bit parts (V8 and Blink format versions), and allows them to be compared by checking that the database uses supported versions of both. If either component has reverted, the database is deemed to be from the future (i.e. corrupt). BUG= 704293 Review-Url: https://codereview.chromium.org/2773823002 Cr-Commit-Position: refs/heads/master@{#466002} [modify] https://crrev.com/3ee0c8ab5180fb87ce012b784bb47a3da507c1a0/content/browser/BUILD.gn [modify] https://crrev.com/3ee0c8ab5180fb87ce012b784bb47a3da507c1a0/content/browser/indexed_db/indexed_db_backing_store.cc [add] https://crrev.com/3ee0c8ab5180fb87ce012b784bb47a3da507c1a0/content/browser/indexed_db/indexed_db_data_format_version.cc [add] https://crrev.com/3ee0c8ab5180fb87ce012b784bb47a3da507c1a0/content/browser/indexed_db/indexed_db_data_format_version.h [modify] https://crrev.com/3ee0c8ab5180fb87ce012b784bb47a3da507c1a0/content/browser/indexed_db/indexed_db_factory_unittest.cc [modify] https://crrev.com/3ee0c8ab5180fb87ce012b784bb47a3da507c1a0/content/browser/indexed_db/leveldb_coding_scheme.md
,
Apr 26 2017
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/cd28a17e10afc0914d2784718df63e9ce3626076 commit cd28a17e10afc0914d2784718df63e9ce3626076 Author: jbroman <jbroman@chromium.org> Date: Wed Apr 26 19:48:50 2017 Comment out the single use of v8::ValueSerializer::GetCurrentDataFormatVersion while it changes. This is becoming a compile-time constant, and its name is changing in that process. I'll restore this (non-critical) assertion once that change has stuck. R=pwnall@chromium.org BUG= 704293 Review-Url: https://codereview.chromium.org/2847463002 Cr-Commit-Position: refs/heads/master@{#467418} [modify] https://crrev.com/cd28a17e10afc0914d2784718df63e9ce3626076/third_party/WebKit/Source/bindings/modules/v8/V8BindingForModulesTest.cpp
,
Apr 27 2017
The following revision refers to this bug: https://chromium.googlesource.com/v8/v8.git/+/a16c3c910548e37eb62bb467fea706a21f6a2d46 commit a16c3c910548e37eb62bb467fea706a21f6a2d46 Author: jbroman <jbroman@chromium.org> Date: Thu Apr 27 15:14:41 2017 Expose the ValueSerializer data format version as a compile-time constant. BUG= chromium:704293 Review-Url: https://codereview.chromium.org/2804643006 Cr-Commit-Position: refs/heads/master@{#44945} [modify] https://crrev.com/a16c3c910548e37eb62bb467fea706a21f6a2d46/BUILD.gn [add] https://crrev.com/a16c3c910548e37eb62bb467fea706a21f6a2d46/include/v8-value-serializer-version.h [modify] https://crrev.com/a16c3c910548e37eb62bb467fea706a21f6a2d46/include/v8.h [modify] https://crrev.com/a16c3c910548e37eb62bb467fea706a21f6a2d46/src/api.cc [modify] https://crrev.com/a16c3c910548e37eb62bb467fea706a21f6a2d46/src/v8.gyp [modify] https://crrev.com/a16c3c910548e37eb62bb467fea706a21f6a2d46/src/value-serializer.cc [modify] https://crrev.com/a16c3c910548e37eb62bb467fea706a21f6a2d46/src/value-serializer.h
,
May 4 2017
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/41a331f01308223da331ecbdf5d73f4fb03fe42e commit 41a331f01308223da331ecbdf5d73f4fb03fe42e Author: jbroman <jbroman@chromium.org> Date: Thu May 04 19:54:34 2017 Use the compile-time constant for v8::ValueSerializer format version. BUG= 704293 TBR=jochen@chromium.org Review-Url: https://codereview.chromium.org/2801053003 Cr-Commit-Position: refs/heads/master@{#469437} [modify] https://crrev.com/41a331f01308223da331ecbdf5d73f4fb03fe42e/content/browser/indexed_db/DEPS [modify] https://crrev.com/41a331f01308223da331ecbdf5d73f4fb03fe42e/content/browser/indexed_db/indexed_db_data_format_version.cc
,
May 9 2017
|
||
►
Sign in to add a comment |
||
Comment 1 by jsb...@chromium.org
, Mar 22 2017