Skip to content

Commit

Permalink
Add WPT for CSP with trailing dot in hostname
Browse files Browse the repository at this point in the history
This CL adds a generic WPT test to make sure hosts with trailing dots
can be defined in CSP.
The CL targets connect-src directive as a proof of concept. More
tests can be added for other directives later on.

Bug: 1512075
Change-Id: Ia3d8ec4c4b6594d46ff6c65ff8275bfd6bdd70fb
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5185382
Reviewed-by: Antonio Sartori <antoniosartori@chromium.org>
Commit-Queue: Saeid Eid <saeideid@chromium.org>
Reviewed-by: Jonathan Hao <phao@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1246451}
  • Loading branch information
Saeid Eid authored and chromium-wpt-export-bot committed Jan 12, 2024
1 parent 1299813 commit c48d657
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
6 changes: 6 additions & 0 deletions content-security-policy/generic/src-trailing-dot.sub.any.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// META: global=window,worker

promise_test(t => {
return fetch("{{location[scheme]}}://{{host}}.:{{location[port]}}"
+ "/content-security-policy/support/resource.py");
}, "Fetch from host with trailing dot should be allowed by CSP.");
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Content-Security-Policy: connect-src {{location[scheme]}}://{{host}}.:{{location[port]}}

0 comments on commit c48d657

Please sign in to comment.