Skip to content

Added some same-origin-domain checks - #15478

Closed
asajeffrey wants to merge 5 commits into
servo:masterfrom
asajeffrey:script-same-origin-domain
Closed

asajeffrey wants to merge 5 commits into
servo:masterfrom
asajeffrey:script-same-origin-domain

Conversation

@asajeffrey

@asajeffrey asajeffrey commented Feb 9, 2017 •

Copy link
Copy Markdown
Contributor

This PR adds some same-origin-domain checks, replacing some same-origin checks. This will make a difference once we support setting document.domain.

This PR builds on #15438, only the last commit is part of this PR.


  • ./mach build -d does not report any errors
  • ./mach test-tidy does not report any errors
  • These changes do not require tests because we don't support setting document.domain yet

This change is Reviewable

@highfive

highfive commented Feb 9, 2017

Copy link
Copy Markdown

Heads up! This PR modifies the following files:

  • @fitzgen: components/script/dom/servoparser/mod.rs, components/script/dom/window.rs, components/script/dom/location.rs, components/script/dom/document.rs, components/script/dom/xmlhttprequest.rs, components/script/devtools.rs, components/script/dom/history.rs, components/script/webdriver_handlers.rs, components/script/lib.rs, components/script/dom/domparser.rs, components/script/script_thread.rs, components/script/dom/domimplementation.rs, components/script/dom/htmliframeelement.rs, components/script/dom/webidls/Location.webidl, components/script/dom/node.rs, components/script/dom/xmldocument.rs, components/script/dom/bindings/trace.rs, components/script/origin.rs
  • @KiChjang: components/script/dom/servoparser/mod.rs, components/script/dom/window.rs, components/script/dom/location.rs, components/script/dom/document.rs, components/net/http_loader.rs, components/script/dom/xmlhttprequest.rs, components/script/devtools.rs, components/script/dom/history.rs, components/script/webdriver_handlers.rs, components/script/lib.rs, components/script/dom/domparser.rs, components/script/script_thread.rs, components/script/dom/domimplementation.rs, components/script/dom/htmliframeelement.rs, components/script/dom/webidls/Location.webidl, components/script/dom/node.rs, components/script/dom/xmldocument.rs, components/script/dom/bindings/trace.rs, components/script/origin.rs, components/net_traits/request.rs, components/net_traits/request.rs

@highfive

highfive commented Feb 9, 2017

Copy link
Copy Markdown

warning Warning warning

  • These commits modify unsafe code. Please review it carefully!

@highfive highfive added the S-awaiting-review There is new code that needs to be reviewed. label Feb 9, 2017
@asajeffrey asajeffrey added A-content/script Related to the script thread and removed S-awaiting-review There is new code that needs to be reviewed. labels Feb 9, 2017
@asajeffrey

Copy link
Copy Markdown
Contributor Author

cc @jdm @cbrewster

@asajeffrey asajeffrey changed the title Script same origin domain Added some same-origin-domain checks Feb 9, 2017

@Ms2ger Ms2ger left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'm not convinced it's a good idea to land this until we actually have document.domain, and I can tell you to write tests for each and every change here.

fn GetContentDocument(&self) -> Option<Root<Document>> {
self.get_content_window().map(|window| window.Document())
// Step 1.
if let Some(pipeline_id) = self.pipeline_id.get() {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Early returns would be better here.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done.

@highfive highfive added the S-awaiting-review There is new code that needs to be reviewed. label Feb 10, 2017
@asajeffrey

Copy link
Copy Markdown
Contributor Author

I updated the test expectations (d6e2792). Summary:

  • Some tests now PASS, hooray!
/html/browsers/history/the-location-interface/security_location_0.htm
/html/browsers/the-window-object/security-window/window-security.html
/html/semantics/embedded-content/the-iframe-element/iframe-load-event.html
/navigation-timing/test_unique_performance_objects.html 
/html/semantics/scripting-1/the-template-element/...
/html/syntax/parsing/template/...
  • Some tests which were FAIL are now TIMEOUT. The timeouts are caused by postMessage, in particular event.source being undefined.
  • I bugfixed tests/wpt/mozilla/tests/mozilla/referrer-policy/generic/common.js, which was stringifying iframe.contentWindow.location even for cross-origin windows, which now generates a security error.

@Ms2ger: with these updates to the test expectations, are you okay with this PR going ahead without document.domain?

@asajeffrey asajeffrey added the S-needs-squash Some (or all) of the commits in the PR should be combined. label Feb 10, 2017
@asajeffrey
asajeffrey force-pushed the script-same-origin-domain branch from d7d00a2 to 583a7dd Compare February 13, 2017 17:04
@asajeffrey

Copy link
Copy Markdown
Contributor Author

Updated #15438.

@asajeffrey asajeffrey mentioned this pull request Feb 13, 2017
4 tasks done
@asajeffrey

Copy link
Copy Markdown
Contributor Author

@Ms2ger I added the setter for document.domain over in #15536, which includes a test for same-origin-domain security checks.

@asajeffrey

Copy link
Copy Markdown
Contributor Author

@Ms2ger ping?

@asajeffrey
asajeffrey force-pushed the script-same-origin-domain branch from 583a7dd to 92d220b Compare February 15, 2017 22:25
@asajeffrey

Copy link
Copy Markdown
Contributor Author

Rebased.

@bors-servo

Copy link
Copy Markdown
Contributor

☔ The latest upstream changes (presumably #15588) made this pull request unmergeable. Please resolve the merge conflicts.

@highfive highfive added the S-needs-rebase There are merge conflict errors. label Feb 18, 2017
@asajeffrey
asajeffrey force-pushed the script-same-origin-domain branch from 92d220b to b07d2dc Compare February 21, 2017 20:43
@asajeffrey

Copy link
Copy Markdown
Contributor Author

Fixed a bug which was causing blob://http://foo.com/ to be considered dissimilar-origin to http://foo.com/. Also rebased.

@asajeffrey asajeffrey removed the S-needs-rebase There are merge conflict errors. label Feb 21, 2017
@asajeffrey asajeffrey mentioned this pull request Feb 21, 2017
3 tasks done
@bors-servo

Copy link
Copy Markdown
Contributor

☔ The latest upstream changes (presumably #15438) made this pull request unmergeable. Please resolve the merge conflicts.

@highfive highfive added the S-needs-rebase There are merge conflict errors. label Feb 22, 2017
@asajeffrey
asajeffrey force-pushed the script-same-origin-domain branch 2 times, most recently from d91b63a to 26ea806 Compare February 22, 2017 19:00
@asajeffrey asajeffrey removed the S-needs-rebase There are merge conflict errors. label Feb 22, 2017
@asajeffrey

Copy link
Copy Markdown
Contributor Author

#15438 landed, so this can now land.

@Ms2ger: are you still wanting more tests? If so, we probably need to merge this with #15536.

@bors-servo

Copy link
Copy Markdown
Contributor

☔ The latest upstream changes (presumably #14962) made this pull request unmergeable. Please resolve the merge conflicts.

@highfive highfive added the S-needs-rebase There are merge conflict errors. label Feb 23, 2017
@asajeffrey
asajeffrey force-pushed the script-same-origin-domain branch from 26ea806 to 1d8d6ac Compare February 23, 2017 14:31
@asajeffrey asajeffrey removed the S-needs-rebase There are merge conflict errors. label Feb 23, 2017
@asajeffrey

Copy link
Copy Markdown
Contributor Author

@asajeffrey asajeffrey closed this Feb 27, 2017
bors-servo pushed a commit that referenced this pull request Mar 15, 2017
Implement setter for document.domain

<!-- Please describe your changes on the following line: -->

This PR implements the setter for `document.domain`.

It builds on #15438 and #15478, only the last commit is part of this PR.

It includes tests for similar-origin security checks.

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes fix #934.
- [X] There are tests for these changes.

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/15536)
<!-- Reviewable:end -->
bors-servo pushed a commit that referenced this pull request Mar 15, 2017
Implement setter for document.domain

<!-- Please describe your changes on the following line: -->

This PR implements the setter for `document.domain`.

It builds on #15438 and #15478, only the last commit is part of this PR.

It includes tests for similar-origin security checks.

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes fix #934.
- [X] There are tests for these changes.

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/15536)
<!-- Reviewable:end -->
bors-servo pushed a commit that referenced this pull request Mar 15, 2017
Implement cross-thread postMessage

<!-- Please describe your changes on the following line: -->

This PR implements cross-thread postMessage,

It builds on #15438 and #15478, only the last commit is part of this PR.

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] There are tests for these changes

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/15679)
<!-- Reviewable:end -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-content/script Related to the script thread S-awaiting-review There is new code that needs to be reviewed. S-needs-squash Some (or all) of the commits in the PR should be combined.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants