-
Notifications
You must be signed in to change notification settings - Fork 6.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Report DevTools issues for invalid attribution source headers
For now, the issue only contains the generic InvalidHeader label and the invalid header value, but in the future we intend to provide richer information about what exactly was invalid. We use a single InvalidHeader label, rather than one per header, so that the issues can be collapsed in the UI more easily. Bug: 1302318 Change-Id: Ifd566dfa474f8cb7398a672f52a1a7e10ab593bd Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3629640 Reviewed-by: John Delaney <johnidel@chromium.org> Quick-Run: Andrew Paseltiner <apaseltiner@chromium.org> Reviewed-by: Nate Chapin <japhet@chromium.org> Commit-Queue: Andrew Paseltiner <apaseltiner@chromium.org> Reviewed-by: Andrey Kosyakov <caseq@chromium.org> Cr-Commit-Position: refs/heads/main@{#1001772}
- Loading branch information
Andrew Paseltiner
authored and
Chromium LUCI CQ
committed
May 10, 2022
1 parent
777ebde
commit 12e032c
Showing
11 changed files
with
119 additions
and
23 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
21 changes: 21 additions & 0 deletions
21
.../web_tests/http/tests/inspector-protocol/conversion/invalid-aggregatable-source-header.js
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// Copyright 2022 The Chromium Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
(async function(testRunner) { | ||
const {page, dp} = await testRunner.startBlank( | ||
`Test that an attributionsrc response with an invalid Attribution-Reporting-Register-Aggregatable-Source header triggers an issue.`); | ||
|
||
await dp.Audits.enable(); | ||
await page.navigate( | ||
'https://devtools.test:8443/inspector-protocol/conversion/resources/impression.html'); | ||
|
||
await page.loadHTML( | ||
`<img attributionsrc="https://devtools.test:8443/inspector-protocol/conversion/resources/register-invalid-aggregatable-source.php">`); | ||
|
||
const issuePromise = dp.Audits.onceIssueAdded(); | ||
const issue = await issuePromise; | ||
testRunner.log( | ||
issue.params.issue, 'Issue reported: ', ['frame', 'request']); | ||
testRunner.completeTest(); | ||
}) |
21 changes: 21 additions & 0 deletions
21
...d_party/blink/web_tests/http/tests/inspector-protocol/conversion/invalid-source-header.js
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// Copyright 2022 The Chromium Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
(async function(testRunner) { | ||
const {page, dp} = await testRunner.startBlank( | ||
`Test that an attributionsrc response with an invalid Attribution-Reporting-Register-Source header triggers an issue.`); | ||
|
||
await dp.Audits.enable(); | ||
await page.navigate( | ||
'https://devtools.test:8443/inspector-protocol/conversion/resources/impression.html'); | ||
|
||
await page.loadHTML( | ||
`<img attributionsrc="https://devtools.test:8443/inspector-protocol/conversion/resources/register-invalid-source.php">`); | ||
|
||
const issuePromise = dp.Audits.onceIssueAdded(); | ||
const issue = await issuePromise; | ||
testRunner.log( | ||
issue.params.issue, 'Issue reported: ', ['frame', 'request']); | ||
testRunner.completeTest(); | ||
}) |
5 changes: 5 additions & 0 deletions
5
...tp/tests/inspector-protocol/conversion/resources/register-invalid-aggregatable-source.php
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<?php | ||
// The event-level header must be valid for the aggregatable one to be parsed at all. | ||
header('Attribution-Reporting-Register-Source: {"source_event_id":"0","destination":"https://irrelevant.test"}'); | ||
header('Attribution-Reporting-Register-Aggregatable-Source: @'); | ||
?> |
3 changes: 3 additions & 0 deletions
3
.../web_tests/http/tests/inspector-protocol/conversion/resources/register-invalid-source.php
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<?php | ||
header('Attribution-Reporting-Register-Source: !'); | ||
?> |
13 changes: 13 additions & 0 deletions
13
.../http/tests/inspector-protocol/conversion/invalid-aggregatable-source-header-expected.txt
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
Test that an attributionsrc response with an invalid Attribution-Reporting-Register-Aggregatable-Source header triggers an issue. | ||
Issue reported: { | ||
code : AttributionReportingIssue | ||
details : { | ||
attributionReportingIssueDetails : { | ||
frame : <object> | ||
invalidParameter : @ | ||
request : <object> | ||
violationType : InvalidHeader | ||
} | ||
} | ||
} | ||
|
13 changes: 13 additions & 0 deletions
13
...tform/generic/http/tests/inspector-protocol/conversion/invalid-source-header-expected.txt
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
Test that an attributionsrc response with an invalid Attribution-Reporting-Register-Source header triggers an issue. | ||
Issue reported: { | ||
code : AttributionReportingIssue | ||
details : { | ||
attributionReportingIssueDetails : { | ||
frame : <object> | ||
invalidParameter : ! | ||
request : <object> | ||
violationType : InvalidHeader | ||
} | ||
} | ||
} | ||
|