Repository navigation
fix(browser): drop --disable-web-security from default Chrome flags - #649
Merged
Merged
Conversation
The flag turned off the same-origin policy for every page, so tools loading untrusted pages (screenshots, scraping) let them read other origins. Test suites that rely on it move the flag to Cuprite. Frame#frame_element now returns nil for a cross-origin frame. Closes #472.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #472.
--disable-web-securitywas one of Ferrum's default Chrome flags, so every page ran without the same-origin policy. That's fine for test suites, but tools that load untrusted pages (screenshots, scraping) let those pages read other origins. Chrome 155 already blocks thefile://iframe from the issue,about:blank#blocked, even with the flag set, but cross-origin reads still go through.The flag is no longer a default. Cuprite adds it itself, so Capybara suites keep their current behavior (companion change in rubycdp/cuprite, release both together). Anyone who needs the old behavior can pass
browser_options: { "disable-web-security" => nil }.Behavior change:
Frame#frame_elementreadswindow.frameElement, which the same-origin policy hides from a cross-origin frame, so it returnsnilfor one now. The YARD comment anddocs/15-frames.mdsay so.Specs:
fetchfrom127.0.0.1tolocalhostis blocked by default. It fails with the old defaults.#frame_elementexample moves to the same-origin/frame_parentfixture, since/framesloads its iframes fromlocalhostwhile the page is on127.0.0.1. A new example checks that/framesreturnsnilfor a cross-origin frame.supports :ignore_default_browser_options argumentused to removedisable-web-securityby name and never checked anything. It now leaves outmute-audioand checks the launch command: the dropped default is gone, the passed flag and the required--remote-debugging-port/--user-data-dirflags are there.Full suite: 629 examples, 0 failures. Cuprite against this branch with the flag added: 1855 examples, 0 failures.