Commit 0724e945 authored by Lukasz Anforowicz's avatar Lukasz Anforowicz Committed by Commit Bot

|request_initiator_site_lock| enforcement - attempt #2.

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.  Therefore it is possible
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: If4fbdb6336703f53784c036ca5d9e408ff223d78
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2006113
Auto-Submit: Łukasz Anforowicz <lukasza@chromium.org>
Commit-Queue: Yutaka Hirano <yhirano@chromium.org>
Reviewed-by: default avatarYutaka Hirano <yhirano@chromium.org>
Cr-Commit-Position: refs/heads/master@{#739359}
parent e22fb4a8
...@@ -308,7 +308,12 @@ bool CorsURLLoaderFactory::IsSane(const NetworkContext* context, ...@@ -308,7 +308,12 @@ bool CorsURLLoaderFactory::IsSane(const NetworkContext* context,
// TODO(lukasza): https://crbug.com/920634: Report bad message and return // TODO(lukasza): https://crbug.com/920634: Report bad message and return
// false below. // false below.
NOTREACHED(); NOTREACHED();
break; debug::ScopedOriginCrashKey initiator_lock_crash_key(
debug::GetRequestInitiatorSiteLockCrashKey(),
request_initiator_site_lock_);
mojo::ReportBadMessage(
"CorsURLLoaderFactory: lock VS initiator mismatch");
return false;
} }
if (context) { if (context) {
......
...@@ -26,6 +26,12 @@ base::debug::CrashKeyString* GetRequestInitiatorCrashKey() { ...@@ -26,6 +26,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