Commit f0f00c0c authored by Lukasz Anforowicz's avatar Lukasz Anforowicz Committed by Commit Bot

|request_initiator_site_lock| enforcement - attempt #1.

This CL starts treating |request_initiator| that doesn't match
|request_initiator_site_lock| as a bad IPC message and ignoring such
malformed resource requests.

NetworkService.URLLoader.RequestInitiatorOriginLockCompatibility UMA is
non-zero in recent Canary releases.  We expect that this CL will get
reverted after gathering sufficient number of DumpWithoutCrashing
reports to understand why the lock doesn't match the initiator in some
real world scenarios.

Bug: 920634
Change-Id: I509ebade1d64e5c5243150df8c3f5184273cf8ac
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1661114
Commit-Queue: Łukasz Anforowicz <lukasza@chromium.org>
Reviewed-by: default avatarYutaka Hirano <yhirano@chromium.org>
Cr-Commit-Position: refs/heads/master@{#717031}
parent fdc3ad9d
...@@ -235,9 +235,12 @@ bool CorsURLLoaderFactory::IsSane(const NetworkContext* context, ...@@ -235,9 +235,12 @@ bool CorsURLLoaderFactory::IsSane(const NetworkContext* context,
case InitiatorLockCompatibility::kIncorrectLock: case InitiatorLockCompatibility::kIncorrectLock:
// Requests from the renderer need to always specify a correct initiator. // Requests from the renderer need to always specify a correct initiator.
NOTREACHED(); NOTREACHED();
// TODO(lukasza): https://crbug.com/920634: Report bad message and return debug::ScopedOriginCrashKey initiator_lock_crash_key(
// false below. debug::GetRequestInitiatorSiteLockCrashKey(),
break; request_initiator_site_lock_);
mojo::ReportBadMessage(
"CorsURLLoaderFactory: lock VS initiator mismatch");
return false;
} }
if (context) { if (context) {
......
...@@ -28,6 +28,12 @@ base::debug::CrashKeyString* GetRequestInitiatorCrashKey() { ...@@ -28,6 +28,12 @@ base::debug::CrashKeyString* GetRequestInitiatorCrashKey() {
} // namespace } // namespace
base::debug::CrashKeyString* GetRequestInitiatorSiteLockCrashKey() {
static auto* crash_key = base::debug::AllocateCrashKeyString(
"request_initiator_site_lock", base::debug::CrashKeySize::Size64);
return crash_key;
}
ScopedOriginCrashKey::ScopedOriginCrashKey( ScopedOriginCrashKey::ScopedOriginCrashKey(
base::debug::CrashKeyString* crash_key, base::debug::CrashKeyString* crash_key,
const base::Optional<url::Origin>& value) const base::Optional<url::Origin>& value)
......
...@@ -15,6 +15,8 @@ struct ResourceRequest; ...@@ -15,6 +15,8 @@ struct ResourceRequest;
namespace debug { namespace debug {
base::debug::CrashKeyString* GetRequestInitiatorSiteLockCrashKey();
class ScopedOriginCrashKey : public base::debug::ScopedCrashKeyString { class ScopedOriginCrashKey : public base::debug::ScopedCrashKeyString {
public: public:
ScopedOriginCrashKey(base::debug::CrashKeyString* crash_key, ScopedOriginCrashKey(base::debug::CrashKeyString* crash_key,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment