Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cross-Origin-Resource-Policy tests #11171

Merged

Conversation

youennf
Copy link
Contributor

@youennf youennf commented May 25, 2018

These are initial tests targeting whatwg/fetch#733
These are based on https://bugs.webkit.org/show_bug.cgi?id=185840.

Copy link
Member

@annevk annevk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general this looks great, but I found a couple issues. (I annotated them in one file, but they apply to most tests.)

loadScript(remoteBaseURL + "resources/script.py?corp=same&acao=*", ko);

title = "Cross-origin no-cors script load with a 'Cross-Origin-Resource-Policy: same-site' response header.";
loadScript(remoteBaseURL + "resources/script.py?corp=same-site&acao=*", ko);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since remote host will be 'www1.' + ORIGINAL_HOST, wouldn't this be ok as it's same site?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This concern applies more generally it seems.

}, title);
}

title = "Same-origin script load with a 'Cross-Origin-Resource-Policy: same' response header.";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you change this to pass the title in as an argument? This seems like a rather strange style.

@annevk
Copy link
Member

annevk commented Jun 7, 2018

The other thing that'd be nice to test is ensuring the header is properly parsed. E.g., same-ORIGIN does not match, same-origin, same-site does not match, etc.

Copy link
Member

@annevk annevk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for addressing the nits and writing all these. I created two more small PRs that cover some remaining aspects.

Let's wait with landing this until next week so we can land all the various pieces together.

@annevk
Copy link
Member

annevk commented Jun 8, 2018

The reason this is timing out is because it changes common/get-host-info.sub.js so we'll need an admin to land this next week.

annevk added a commit to whatwg/fetch that referenced this pull request Jun 8, 2018
This header makes it easier for sites to block unwanted "no-cors"
cross-origin requests.

Tests:

* web-platform-tests/wpt#11171
* web-platform-tests/wpt#11427
* web-platform-tests/wpt#11428

Follow-up: #760.

Fixes #687.
@annevk annevk force-pushed the wpt-export-for-webkit-185840 branch from d591b6a to eab3b0e Compare June 18, 2018 09:31
@foolip foolip merged commit 53f7340 into web-platform-tests:master Jun 18, 2018
@foolip
Copy link
Member

foolip commented Jun 18, 2018

Rebase+merge button pressed as requested by @annevk on IRC.

annevk added a commit to whatwg/fetch that referenced this pull request Jun 18, 2018
This header makes it easier for sites to block unwanted "no-cors"
cross-origin requests.

Tests:

* web-platform-tests/wpt#11171
* web-platform-tests/wpt#11427
* web-platform-tests/wpt#11428

Follow-up: #760 & #767.

Fixes #687.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants