forked from WebKit/WebKit
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CrossThreadRecord allows you to control uint64_t responseBodySize
rdar://124960263 https://bugs.webkit.org/show_bug.cgi?id=278357 Reviewed by Sihui Liu. There are two problems in this bug that we fix: (1) In the function CacheStorageCache::putRecords, uint64_t responseBodySize is added and subtracted from int64_t spaceRequested. We fix this mismatch by changing the type of spaceRequested to CheckedUint64 and then checking for overflow. Some of the records being added already exist in the cache. We keep track of whether the new version of that record needs more or less space than the existing record and request additional space only if needed. (2) When the client sends the records over IPC, they also send the record's size--and this size is used to calculate and then allocate space. But because the client is sending the size, it's possible an attacker sends a false value for the size. This size is calculated on the client side in CacheStorageConnection::computeRecordBodySize. It does not return the exact size of the body, but rather a size that has a random padding added. We do this for security concerns: whatwg/storage#31. Since this size is random, we cannot check the size by re-calculating it. What we can do is ensure that the size is greater than the actual size because a smaller size would be a clear indication that the size has been tampered with. So we add a check to at least ensure that the size is greater since all the randomly padded sizes are indeed greater than the true sizes. This check is done in NetworkStorageManager::cacheStoragePutRecords using MESSAGE_CHECK so the WebContent process can be killed if the size is invalid, indicating that the process is compromised. * Source/WebKit/NetworkProcess/storage/CacheStorageCache.cpp: (WebKit::CacheStorageCache::putRecords): * Source/WebKit/NetworkProcess/storage/CacheStorageDiskStore.cpp: (WebKit::encodeRecordBody): (WebKit::CacheStorageDiskStore::computeRealBodySizeForStorage): (WebKit::CacheStorageDiskStore::writeRecords): * Source/WebKit/NetworkProcess/storage/CacheStorageDiskStore.h: * Source/WebKit/NetworkProcess/storage/NetworkStorageManager.cpp: (WebKit::NetworkStorageManager::cacheStoragePutRecords): * Source/WebKit/NetworkProcess/storage/NetworkStorageManager.h: Originally-landed-as: 280938.255@safari-7619-branch (8150063). rdar://138929915
- Loading branch information
1 parent
f687b57
commit 5a65b47
Showing
5 changed files
with
43 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters