mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01:00
test: Update tests/wpt/mozilla/.../referrer-policy/
Only has changes to spec.src.json, generate.py etc., no actual tests generated yet.
This commit is contained in:
parent
eeccb75fc1
commit
fd50eb17fd
5 changed files with 128 additions and 41 deletions
|
@ -222,7 +222,7 @@ A **selection** is a single **test instance** (scenario) with explicit values, f
|
|||
|
||||
```javascript
|
||||
var scenario = {
|
||||
"referrer_policy": "origin-when-crossorigin",
|
||||
"referrer_policy": "origin-when-cross-origin",
|
||||
"delivery_method": "meta-referrer",
|
||||
"redirection": "no-redirect",
|
||||
"origin": "cross-origin",
|
||||
|
|
|
@ -22,7 +22,7 @@ function parseUrlQueryString(queryString) {
|
|||
function appendIframeToBody(url, attributes) {
|
||||
var iframe = document.createElement("iframe");
|
||||
iframe.src = url;
|
||||
// Extend element with attributes. (E.g. "referrer_policy" or "rel")
|
||||
// Extend element with attributes. (E.g. "referrerPolicy" or "rel")
|
||||
if (attributes) {
|
||||
for (var attr in attributes) {
|
||||
iframe[attr] = attributes[attr];
|
||||
|
@ -40,7 +40,7 @@ function loadImage(src, callback, attributes) {
|
|||
callback(image);
|
||||
}
|
||||
image.src = src;
|
||||
// Extend element with attributes. (E.g. "referrer_policy" or "rel")
|
||||
// Extend element with attributes. (E.g. "referrerPolicy" or "rel")
|
||||
if (attributes) {
|
||||
for (var attr in attributes) {
|
||||
image[attr] = attributes[attr];
|
||||
|
|
|
@ -76,7 +76,7 @@ function ReferrerPolicyTestCase(scenario, testDescription, sanityChecker) {
|
|||
// Depending on the delivery method, extend the subresource element with
|
||||
// these attributes.
|
||||
var elementAttributesForDeliveryMethod = {
|
||||
"attr-referrer": {referrerpolicy: t._scenario.referrer_policy},
|
||||
"attr-referrer": {referrerPolicy: t._scenario.referrer_policy},
|
||||
"rel-noreferrer": {rel: "noreferrer"}
|
||||
};
|
||||
|
||||
|
|
|
@ -93,13 +93,13 @@ def generate_selection(selection, spec, subresource_path,
|
|||
selection['meta_delivery_method'] = \
|
||||
'<meta http-equiv="Content-Security-Policy" ' + \
|
||||
'content="referrer %(referrer_policy)s">' % spec
|
||||
elif selection['delivery_method'] == 'http-csp':
|
||||
elif selection['delivery_method'] == 'http-rp':
|
||||
selection['meta_delivery_method'] = \
|
||||
"<!-- No meta: CSP delivered via HTTP headers. -->"
|
||||
"<!-- No meta: Referrer policy delivered via HTTP headers. -->"
|
||||
test_headers_filename = test_filename + ".headers"
|
||||
with open(test_headers_filename, "w") as f:
|
||||
f.write('Content-Security-Policy: ' + \
|
||||
'referrer %(referrer_policy)s\n' % spec)
|
||||
f.write('Referrer-Policy: ' + \
|
||||
'%(referrer_policy)s\n' % spec)
|
||||
# TODO(kristijanburnik): Limit to WPT origins.
|
||||
f.write('Access-Control-Allow-Origin: *\n')
|
||||
elif selection['delivery_method'] == 'attr-referrer':
|
||||
|
|
|
@ -3,16 +3,49 @@
|
|||
{
|
||||
"name": "unset-referrer-policy",
|
||||
"title": "Referrer Policy is not explicitly defined",
|
||||
"description": "Check that sub-resource gets the referrer URL when no explicit Referrer Policy is set.",
|
||||
"specification_url": "https://w3c.github.io/webappsec/specs/referrer-policy/#referrer-policy-states",
|
||||
"description": "Check that referrer URL follows no-referrer-when-downgrade policy when no explicit Referrer Policy is set.",
|
||||
"specification_url": "https://w3c.github.io/webappsec-referrer-policy/#referrer-policies",
|
||||
"referrer_policy": null,
|
||||
"test_expansion": [
|
||||
{
|
||||
"name": "generic",
|
||||
"name": "insecure-protocol",
|
||||
"expansion": "default",
|
||||
"source_protocol": "*",
|
||||
"target_protocol": "*",
|
||||
"delivery_method": ["http-csp", "meta-referrer", "meta-csp", "attr-referrer"],
|
||||
"source_protocol": "http",
|
||||
"target_protocol": "http",
|
||||
"delivery_method": ["http-rp", "meta-referrer", "meta-csp", "attr-referrer"],
|
||||
"redirection": "*",
|
||||
"origin": "*",
|
||||
"subresource": "*",
|
||||
"referrer_url": "stripped-referrer"
|
||||
},
|
||||
{
|
||||
"name": "upgrade-protocol",
|
||||
"expansion": "default",
|
||||
"source_protocol": "http",
|
||||
"target_protocol": "https",
|
||||
"delivery_method": ["http-rp", "meta-referrer", "meta-csp", "attr-referrer"],
|
||||
"redirection": "*",
|
||||
"origin": "*",
|
||||
"subresource": "*",
|
||||
"referrer_url": "stripped-referrer"
|
||||
},
|
||||
{
|
||||
"name": "downgrade-protocol",
|
||||
"expansion": "default",
|
||||
"source_protocol": "https",
|
||||
"target_protocol": "http",
|
||||
"delivery_method": ["http-rp", "meta-referrer", "meta-csp", "attr-referrer"],
|
||||
"redirection": "*",
|
||||
"origin": "*",
|
||||
"subresource": "*",
|
||||
"referrer_url": "omitted"
|
||||
},
|
||||
{
|
||||
"name": "secure-protocol",
|
||||
"expansion": "default",
|
||||
"source_protocol": "https",
|
||||
"target_protocol": "https",
|
||||
"delivery_method": ["http-rp", "meta-referrer", "meta-csp", "attr-referrer"],
|
||||
"redirection": "*",
|
||||
"origin": "*",
|
||||
"subresource": "*",
|
||||
|
@ -24,7 +57,7 @@
|
|||
"name": "no-referrer",
|
||||
"title": "Referrer Policy is set to 'no-referrer'",
|
||||
"description": "Check that sub-resource never gets the referrer URL.",
|
||||
"specification_url": "https://w3c.github.io/webappsec/specs/referrer-policy/#referrer-policy-state-no-referrer",
|
||||
"specification_url": "https://w3c.github.io/webappsec-referrer-policy/#referrer-policy-no-referrer",
|
||||
"referrer_policy": "no-referrer",
|
||||
"test_expansion": [
|
||||
{
|
||||
|
@ -32,7 +65,7 @@
|
|||
"expansion": "default",
|
||||
"source_protocol": "*",
|
||||
"target_protocol": "*",
|
||||
"delivery_method": ["http-csp", "meta-referrer", "meta-csp", "attr-referrer"],
|
||||
"delivery_method": ["http-rp", "meta-referrer", "meta-csp", "attr-referrer"],
|
||||
"redirection": "*",
|
||||
"origin": "*",
|
||||
"subresource": "*",
|
||||
|
@ -44,7 +77,7 @@
|
|||
"name": "no-referrer-when-downgrade",
|
||||
"title": "Referrer Policy is set to 'no-referrer-when-downgrade'",
|
||||
"description": "Check that non a priori insecure subresource gets the full Referrer URL. A priori insecure subresource gets no referrer information.",
|
||||
"specification_url": "https://w3c.github.io/webappsec/specs/referrer-policy/#referrer-policy-state-no-referrer-when-downgrade",
|
||||
"specification_url": "https://w3c.github.io/webappsec-referrer-policy/#referrer-policy-no-referrer-when-downgrade",
|
||||
"referrer_policy": "no-referrer-when-downgrade",
|
||||
"test_expansion": [
|
||||
{
|
||||
|
@ -52,7 +85,7 @@
|
|||
"expansion": "default",
|
||||
"source_protocol": "http",
|
||||
"target_protocol": "http",
|
||||
"delivery_method": ["http-csp", "meta-referrer", "meta-csp", "attr-referrer"],
|
||||
"delivery_method": ["http-rp", "meta-referrer", "meta-csp", "attr-referrer"],
|
||||
"redirection": "*",
|
||||
"origin": "*",
|
||||
"subresource": "*",
|
||||
|
@ -63,7 +96,7 @@
|
|||
"expansion": "default",
|
||||
"source_protocol": "http",
|
||||
"target_protocol": "https",
|
||||
"delivery_method": ["http-csp", "meta-referrer", "meta-csp", "attr-referrer"],
|
||||
"delivery_method": ["http-rp", "meta-referrer", "meta-csp", "attr-referrer"],
|
||||
"redirection": "*",
|
||||
"origin": "*",
|
||||
"subresource": "*",
|
||||
|
@ -74,18 +107,18 @@
|
|||
"expansion": "default",
|
||||
"source_protocol": "https",
|
||||
"target_protocol": "http",
|
||||
"delivery_method": ["http-csp", "meta-referrer", "meta-csp", "attr-referrer"],
|
||||
"delivery_method": ["http-rp", "meta-referrer", "meta-csp", "attr-referrer"],
|
||||
"redirection": "*",
|
||||
"origin": "*",
|
||||
"subresource": "*",
|
||||
"referrer_url": "origin"
|
||||
"referrer_url": "omitted"
|
||||
},
|
||||
{
|
||||
"name": "secure-protocol",
|
||||
"expansion": "default",
|
||||
"source_protocol": "https",
|
||||
"target_protocol": "https",
|
||||
"delivery_method": ["http-csp", "meta-referrer", "meta-csp", "attr-referrer"],
|
||||
"delivery_method": ["http-rp", "meta-referrer", "meta-csp", "attr-referrer"],
|
||||
"redirection": "*",
|
||||
"origin": "*",
|
||||
"subresource": "*",
|
||||
|
@ -94,10 +127,10 @@
|
|||
]
|
||||
},
|
||||
{
|
||||
"name": "origin-only",
|
||||
"title": "Referrer Policy is set to 'origin-only'",
|
||||
"name": "origin",
|
||||
"title": "Referrer Policy is set to 'origin'",
|
||||
"description": "Check that all subresources in all casses get only the origin portion of the referrer URL.",
|
||||
"specification_url": "https://w3c.github.io/webappsec/specs/referrer-policy/#referrer-policy-state-origin",
|
||||
"specification_url": "https://w3c.github.io/webappsec-referrer-policy/#referrer-policy-origin",
|
||||
"referrer_policy": "origin",
|
||||
"test_expansion": [
|
||||
{
|
||||
|
@ -105,7 +138,7 @@
|
|||
"expansion": "default",
|
||||
"source_protocol": "*",
|
||||
"target_protocol": "*",
|
||||
"delivery_method": ["http-csp", "meta-referrer", "meta-csp", "attr-referrer"],
|
||||
"delivery_method": ["http-rp", "meta-referrer", "meta-csp", "attr-referrer"],
|
||||
"redirection": "*",
|
||||
"origin": "*",
|
||||
"subresource": "*",
|
||||
|
@ -114,18 +147,18 @@
|
|||
]
|
||||
},
|
||||
{
|
||||
"name": "origin-when-cross-origin",
|
||||
"title": "Referrer Policy is set to 'origin-when-crossorigin'",
|
||||
"description": "Check that cross-origin subresources get the origin portion of the referrer URL and same-origin get the stripped referrer URL.",
|
||||
"specification_url": "https://w3c.github.io/webappsec/specs/referrer-policy/#referrer-policy-state-origin-when-cross-origin",
|
||||
"referrer_policy": "origin-when-crossorigin",
|
||||
"name": "same-origin",
|
||||
"title": "Referrer Policy is set to 'same-origin'",
|
||||
"description": "Check that cross-origin subresources get no referrer information and same-origin get the stripped referrer URL.",
|
||||
"specification_url": "https://w3c.github.io/webappsec-referrer-policy/#referrer-policy-same-origin",
|
||||
"referrer_policy": "same-origin",
|
||||
"test_expansion": [
|
||||
{
|
||||
"name": "same-origin-insecure",
|
||||
"expansion": "default",
|
||||
"source_protocol": "http",
|
||||
"target_protocol": "http",
|
||||
"delivery_method": ["http-csp", "meta-referrer", "meta-csp", "attr-referrer"],
|
||||
"delivery_method": ["http-rp", "meta-referrer", "meta-csp", "attr-referrer"],
|
||||
"redirection": "*",
|
||||
"origin": "same-origin",
|
||||
"subresource": "*",
|
||||
|
@ -136,7 +169,60 @@
|
|||
"expansion": "default",
|
||||
"source_protocol": "https",
|
||||
"target_protocol": "https",
|
||||
"delivery_method": ["http-csp", "meta-referrer", "meta-csp", "attr-referrer"],
|
||||
"delivery_method": ["http-rp", "meta-referrer", "meta-csp", "attr-referrer"],
|
||||
"redirection": "*",
|
||||
"origin": "same-origin",
|
||||
"subresource": "*",
|
||||
"referrer_url": "stripped-referrer"
|
||||
},
|
||||
{
|
||||
"name": "same-origin-insecure",
|
||||
"expansion": "override",
|
||||
"source_protocol": "*",
|
||||
"target_protocol": "*",
|
||||
"delivery_method": ["http-rp", "meta-referrer", "meta-csp", "attr-referrer"],
|
||||
"redirection": "swap-origin-redirect",
|
||||
"origin": "same-origin",
|
||||
"subresource": "*",
|
||||
"referrer_url": "omitted"
|
||||
},
|
||||
{
|
||||
"name": "cross-origin",
|
||||
"expansion": "default",
|
||||
"source_protocol": "*",
|
||||
"target_protocol": "*",
|
||||
"delivery_method": ["http-rp", "meta-referrer", "meta-csp", "attr-referrer"],
|
||||
"redirection": "*",
|
||||
"origin": "cross-origin",
|
||||
"subresource": "*",
|
||||
"referrer_url": "omitted"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "origin-when-cross-origin",
|
||||
"title": "Referrer Policy is set to 'origin-when-cross-origin'",
|
||||
"description": "Check that cross-origin subresources get the origin portion of the referrer URL and same-origin get the stripped referrer URL.",
|
||||
"specification_url": "https://w3c.github.io/webappsec-referrer-policy/#referrer-policy-origin-when-cross-origin",
|
||||
"referrer_policy": "origin-when-cross-origin",
|
||||
"test_expansion": [
|
||||
{
|
||||
"name": "same-origin-insecure",
|
||||
"expansion": "default",
|
||||
"source_protocol": "http",
|
||||
"target_protocol": "http",
|
||||
"delivery_method": ["http-rp", "meta-referrer", "meta-csp", "attr-referrer"],
|
||||
"redirection": "*",
|
||||
"origin": "same-origin",
|
||||
"subresource": "*",
|
||||
"referrer_url": "stripped-referrer"
|
||||
},
|
||||
{
|
||||
"name": "same-origin-secure-default",
|
||||
"expansion": "default",
|
||||
"source_protocol": "https",
|
||||
"target_protocol": "https",
|
||||
"delivery_method": ["http-rp", "meta-referrer", "meta-csp", "attr-referrer"],
|
||||
"redirection": "*",
|
||||
"origin": "same-origin",
|
||||
"subresource": "*",
|
||||
|
@ -147,7 +233,7 @@
|
|||
"expansion": "default",
|
||||
"source_protocol": "http",
|
||||
"target_protocol": "https",
|
||||
"delivery_method": ["http-csp", "meta-referrer", "meta-csp", "attr-referrer"],
|
||||
"delivery_method": ["http-rp", "meta-referrer", "meta-csp", "attr-referrer"],
|
||||
"redirection": "*",
|
||||
"origin": "same-origin",
|
||||
"subresource": "*",
|
||||
|
@ -158,7 +244,7 @@
|
|||
"expansion": "default",
|
||||
"source_protocol": "http",
|
||||
"target_protocol": "https",
|
||||
"delivery_method": ["http-csp", "meta-referrer", "meta-csp", "attr-referrer"],
|
||||
"delivery_method": ["http-rp", "meta-referrer", "meta-csp", "attr-referrer"],
|
||||
"redirection": "*",
|
||||
"origin": "same-origin",
|
||||
"subresource": "*",
|
||||
|
@ -169,7 +255,7 @@
|
|||
"expansion": "override",
|
||||
"source_protocol": "*",
|
||||
"target_protocol": "*",
|
||||
"delivery_method": ["http-csp", "meta-referrer", "meta-csp", "attr-referrer"],
|
||||
"delivery_method": ["http-rp", "meta-referrer", "meta-csp", "attr-referrer"],
|
||||
"redirection": "swap-origin-redirect",
|
||||
"origin": "same-origin",
|
||||
"subresource": "*",
|
||||
|
@ -180,7 +266,7 @@
|
|||
"expansion": "default",
|
||||
"source_protocol": "*",
|
||||
"target_protocol": "*",
|
||||
"delivery_method": ["http-csp", "meta-referrer", "meta-csp", "attr-referrer"],
|
||||
"delivery_method": ["http-rp", "meta-referrer", "meta-csp", "attr-referrer"],
|
||||
"redirection": "*",
|
||||
"origin": "cross-origin",
|
||||
"subresource": "*",
|
||||
|
@ -192,7 +278,7 @@
|
|||
"name": "unsafe-url",
|
||||
"title": "Referrer Policy is set to 'unsafe-url'",
|
||||
"description": "Check that all sub-resources get the stripped referrer URL.",
|
||||
"specification_url": "https://w3c.github.io/webappsec/specs/referrer-policy/#referrer-policy-state-unsafe-url",
|
||||
"specification_url": "https://w3c.github.io/webappsec-referrer-policy/#referrer-policy-unsafe-url",
|
||||
"referrer_policy": "unsafe-url",
|
||||
"test_expansion": [
|
||||
{
|
||||
|
@ -200,7 +286,7 @@
|
|||
"expansion": "default",
|
||||
"source_protocol": "*",
|
||||
"target_protocol": "*",
|
||||
"delivery_method": ["http-csp", "meta-referrer", "meta-csp", "attr-referrer"],
|
||||
"delivery_method": ["http-rp", "meta-referrer", "meta-csp", "attr-referrer"],
|
||||
"redirection": "*",
|
||||
"origin": "*",
|
||||
"subresource": "*",
|
||||
|
@ -329,8 +415,9 @@
|
|||
null,
|
||||
"no-referrer",
|
||||
"no-referrer-when-downgrade",
|
||||
"same-origin",
|
||||
"origin",
|
||||
"origin-when-crossorigin",
|
||||
"origin-when-cross-origin",
|
||||
"unsafe-url"
|
||||
],
|
||||
|
||||
|
@ -341,7 +428,7 @@
|
|||
],
|
||||
|
||||
"delivery_method": [
|
||||
"http-csp",
|
||||
"http-rp",
|
||||
"meta-referrer",
|
||||
"meta-csp",
|
||||
"attr-referrer",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue