Skip to content

Commit 1aec529

Browse files
Include eval hashes in CSP reports if the hashes in v1 flag is enabled
Bug: 428158604 Change-Id: I354ad3f72476b81648641ab0d842e7f6bd2aa52a Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6663042 Reviewed-by: Mason Freed <masonf@chromium.org> Auto-Submit: Carlos IL <carlosil@chromium.org> Commit-Queue: Carlos IL <carlosil@chromium.org> Cr-Commit-Position: refs/heads/main@{#1483999}
1 parent d1937c3 commit 1aec529

2 files changed

Lines changed: 29 additions & 0 deletions

File tree

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<title>eval-blocked-and-sends-report</title>
5+
<script src="/resources/testharness.js"></script>
6+
<script src="/resources/testharnessreport.js"></script>
7+
<script src='../../support/logTest.sub.js?logs=["PASS: eval() blocked"]'></script>
8+
<script src="../../support/alertAssert.sub.js?alerts=[]"></script>
9+
</head>
10+
11+
<body>
12+
<script>
13+
try {
14+
eval("alert_assert('FAIL')");
15+
} catch (e) {
16+
log('PASS: eval() blocked');
17+
}
18+
</script>
19+
<script async defer src='../../support/checkReport.sub.js?reportField=eval-hash&reportValue=eval-sha256-59RYbtpsgpNknZwNEVJ55z9MzqclgnRZLLIunfpEiL4='></script>
20+
<div id="log"></div>
21+
</body>
22+
23+
</html>
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Expires: Mon, 26 Jul 1997 05:00:00 GMT
2+
Cache-Control: no-store, no-cache, must-revalidate
3+
Cache-Control: post-check=0, pre-check=0, false
4+
Pragma: no-cache
5+
Set-Cookie: eval-blocked-report-contains-hash={{$id:uuid()}};
6+
Content-Security-Policy: script-src 'self' 'unsafe-inline'; report-uri /reporting/resources/report.py?op=put&reportID={{$id}}

0 commit comments

Comments
 (0)