Commit 1afe5d58 authored by Lukasz Anforowicz's avatar Lukasz Anforowicz Committed by Commit Bot

mojo::ReportBadMessage after mismatched |request_initiator_site_lock|.

This CL is a step toward |request_initiator_site_lock| enforcement.
This CL adds a call to mojo::ReportBadMessage when
|request_initiator_site_lock| doesn't match |request_initiator|.
OTOH, for now such request is not rejected as |!IsSane|.

Hopefully the extra DwoC reports will help us make progress on
https://crbug.com/1056949 (especially in presence of other
mojo::ReportBadMessage fixes like https://crbug.com/987986).

Bug: 920634
Change-Id: I454b67f2ad486c7cf65f4df1c9fa18bb3e5376eb
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2112751Reviewed-by: default avatarTom Sepez <tsepez@chromium.org>
Commit-Queue: Łukasz Anforowicz <lukasza@chromium.org>
Cr-Commit-Position: refs/heads/master@{#756417}
parent 53cd9dff
......@@ -315,10 +315,13 @@ bool CorsURLLoaderFactory::IsSane(const NetworkContext* context,
case InitiatorLockCompatibility::kIncorrectLock:
// Requests from the renderer need to always specify a correct initiator.
//
// TODO(lukasza): https://crbug.com/920634: Report bad message and return
// false below.
NOTREACHED();
url::debug::ScopedOriginCrashKey initiator_lock_crash_key(
debug::GetRequestInitiatorSiteLockCrashKey(),
base::OptionalOrNullptr(request_initiator_site_lock_));
mojo::ReportBadMessage(
"CorsURLLoaderFactory: lock VS initiator mismatch");
// TODO(lukasza): https://crbug.com/920634: Return false below.
break;
}
......
......@@ -27,6 +27,12 @@ base::debug::CrashKeyString* GetRequestInitiatorCrashKey() {
} // namespace
base::debug::CrashKeyString* GetRequestInitiatorSiteLockCrashKey() {
static auto* crash_key = base::debug::AllocateCrashKeyString(
"request_initiator_site_lock", base::debug::CrashKeySize::Size64);
return crash_key;
}
ScopedRequestCrashKeys::ScopedRequestCrashKeys(
const network::ResourceRequest& request)
: url_(GetRequestUrlCrashKey(), request.url.possibly_invalid_spec()),
......
......@@ -15,6 +15,8 @@ struct ResourceRequest;
namespace debug {
base::debug::CrashKeyString* GetRequestInitiatorSiteLockCrashKey();
class ScopedRequestCrashKeys {
public:
ScopedRequestCrashKeys(const network::ResourceRequest& request);
......
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