Skip to content

Commit

Permalink
Experimentally block/deprecate resource requests whose URLs contain r…
Browse files Browse the repository at this point in the history
…aw newlines.

Intent to Deprecate: https://groups.google.com/a/chromium.org/d/msg/blink-dev/AqSrOMzwrlk/wUglQnTJCgAJ

BUG=680970

Review-Url: https://codereview.chromium.org/2794303002
Cr-Commit-Position: refs/heads/master@{#462933}
  • Loading branch information
mikewest authored and Commit bot committed Apr 7, 2017
1 parent fbb84a3 commit 58eb768
Show file tree
Hide file tree
Showing 63 changed files with 125 additions and 32 deletions.
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
CONSOLE WARNING: Resource requests whose URLs contain raw newline characters are deprecated, and may be blocked in M60, around August 2017. Please remove newlines from places like element attribute values in order to continue loading those resources. See https://www.chromestatus.com/features/5735596811091968 for more details.
Test passes if it does not crash on ASan builds.
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
CONSOLE WARNING: Resource requests whose URLs contain raw newline characters are deprecated, and may be blocked in M60, around August 2017. Please remove newlines from places like element attribute values in order to continue loading those resources. See https://www.chromestatus.com/features/5735596811091968 for more details.
layer at (0,0) size 800x600
LayoutView at (0,0) size 800x600
layer at (0,0) size 800x600
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
CONSOLE WARNING: Resource requests whose URLs contain raw newline characters are deprecated, and may be blocked in M60, around August 2017. Please remove newlines from places like element attribute values in order to continue loading those resources. See https://www.chromestatus.com/features/5735596811091968 for more details.
Simple test that the dragstart event contains the default data in the event.

Select some text in this box and drag it.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
CONSOLE WARNING: Resource requests whose URLs contain raw newline characters are deprecated, and may be blocked in M60, around August 2017. Please remove newlines from places like element attribute values in order to continue loading those resources. See https://www.chromestatus.com/features/5735596811091968 for more details.
Test Results
solid on solid alpha on solid solid on alpha alpha on alpha
source-over
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
CONSOLE WARNING: Resource requests whose URLs contain raw newline characters are deprecated, and may be blocked in M60, around August 2017. Please remove newlines from places like element attribute values in order to continue loading those resources. See https://www.chromestatus.com/features/5735596811091968 for more details.
Test Results
solid on solid alpha on solid solid on alpha alpha on alpha
source-over
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
CONSOLE WARNING: Resource requests whose URLs contain raw newline characters are deprecated, and may be blocked in M60, around August 2017. Please remove newlines from places like element attribute values in order to continue loading those resources. See https://www.chromestatus.com/features/5735596811091968 for more details.
This tests that we don't crash when using the CSS counters feature.
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
CONSOLE WARNING: Resource requests whose URLs contain raw newline characters are deprecated, and may be blocked in M60, around August 2017. Please remove newlines from places like element attribute values in order to continue loading those resources. See https://www.chromestatus.com/features/5735596811091968 for more details.
static: body: (0, 0) child: (27, 27)
relative: body: (0, 0) child: (17, 17)
fixed: body: (0, 0) child: (17, 17)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
CONSOLE WARNING: Resource requests whose URLs contain raw newline characters are deprecated, and may be blocked in M60, around August 2017. Please remove newlines from places like element attribute values in order to continue loading those resources. See https://www.chromestatus.com/features/5735596811091968 for more details.
control: (0, 0)
static: (10, 10)
absolute: (20, 10)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
CONSOLE WARNING: Resource requests whose URLs contain raw newline characters are deprecated, and may be blocked in M60, around August 2017. Please remove newlines from places like element attribute values in order to continue loading those resources. See https://www.chromestatus.com/features/5735596811091968 for more details.
This tests the constructor for the TrackEvent DOM class.

On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
CONSOLE WARNING: Resource requests whose URLs contain raw newline characters are deprecated, and may be blocked in M60, around August 2017. Please remove newlines from places like element attribute values in order to continue loading those resources. See https://www.chromestatus.com/features/5735596811091968 for more details.
Check autoscroll within an inner frame by drag-and-drop

On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
CONSOLE WARNING: Resource requests whose URLs contain raw newline characters are deprecated, and may be blocked in M60, around August 2017. Please remove newlines from places like element attribute values in order to continue loading those resources. See https://www.chromestatus.com/features/5735596811091968 for more details.
ALERT: PASS

Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
CONSOLE WARNING: Resource requests whose URLs contain raw newline characters are deprecated, and may be blocked in M60, around August 2017. Please remove newlines from places like element attribute values in order to continue loading those resources. See https://www.chromestatus.com/features/5735596811091968 for more details.
PASS successfullyParsed is true

TEST COMPLETE
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
CONSOLE WARNING: line 30: Resource requests whose URLs contain raw newline characters are deprecated, and may be blocked in M60, around August 2017. Please remove newlines from places like element attribute values in order to continue loading those resources. See https://www.chromestatus.com/features/5735596811091968 for more details.
CONSOLE MESSAGE: line 1: Started reading...
PASS if no crash.
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
CONSOLE WARNING: Resource requests whose URLs contain raw newline characters are deprecated, and may be blocked in M60, around August 2017. Please remove newlines from places like element attribute values in order to continue loading those resources. See https://www.chromestatus.com/features/5735596811091968 for more details.
layer at (0,0) size 800x600
LayoutView at (0,0) size 800x600
layer at (0,0) size 800x600
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
CONSOLE WARNING: Resource requests whose URLs contain raw newline characters are deprecated, and may be blocked in M60, around August 2017. Please remove newlines from places like element attribute values in order to continue loading those resources. See https://www.chromestatus.com/features/5735596811091968 for more details.

Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
ALERT: If you do not hit an assertion failure when running this test with a debug build and you get a SUCCESS message, then you pass the test.
CONSOLE WARNING: Resource requests whose URLs contain raw newline characters are deprecated, and may be blocked in M60, around August 2017. Please remove newlines from places like element attribute values in order to continue loading those resources. See https://www.chromestatus.com/features/5735596811091968 for more details.
ALERT: SUCCESS

Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
CONSOLE WARNING: Resource requests whose URLs contain raw newline characters are deprecated, and may be blocked in M60, around August 2017. Please remove newlines from places like element attribute values in order to continue loading those resources. See https://www.chromestatus.com/features/5735596811091968 for more details.
ALERT: PASS: data URLs cannot be manipulated via pushState.

Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
CONSOLE WARNING: Resource requests whose URLs contain raw newline characters are deprecated, and may be blocked in M60, around August 2017. Please remove newlines from places like element attribute values in order to continue loading those resources. See https://www.chromestatus.com/features/5735596811091968 for more details.
This is link_1.


Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
CONSOLE WARNING: Resource requests whose URLs contain raw newline characters are deprecated, and may be blocked in M60, around August 2017. Please remove newlines from places like element attribute values in order to continue loading those resources. See https://www.chromestatus.com/features/5735596811091968 for more details.
This is link_1.


Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
CONSOLE WARNING: Resource requests whose URLs contain raw newline characters are deprecated, and may be blocked in M60, around August 2017. Please remove newlines from places like element attribute values in order to continue loading those resources. See https://www.chromestatus.com/features/5735596811091968 for more details.
Link

Link
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
CONSOLE WARNING: Resource requests whose URLs contain raw newline characters are deprecated, and may be blocked in M60, around August 2017. Please remove newlines from places like element attribute values in order to continue loading those resources. See https://www.chromestatus.com/features/5735596811091968 for more details.
a


Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
CONSOLE WARNING: Resource requests whose URLs contain raw newline characters are deprecated, and may be blocked in M60, around August 2017. Please remove newlines from places like element attribute values in order to continue loading those resources. See https://www.chromestatus.com/features/5735596811091968 for more details.
a


Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
CONSOLE WARNING: Resource requests whose URLs contain raw newline characters are deprecated, and may be blocked in M60, around August 2017. Please remove newlines from places like element attribute values in order to continue loading those resources. See https://www.chromestatus.com/features/5735596811091968 for more details.
Link

PASS successfullyParsed is true
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
CONSOLE WARNING: Resource requests whose URLs contain raw newline characters are deprecated, and may be blocked in M60, around August 2017. Please remove newlines from places like element attribute values in order to continue loading those resources. See https://www.chromestatus.com/features/5735596811091968 for more details.


PASS successfullyParsed is true
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
CONSOLE WARNING: Resource requests whose URLs contain raw newline characters are deprecated, and may be blocked in M60, around August 2017. Please remove newlines from places like element attribute values in order to continue loading those resources. See https://www.chromestatus.com/features/5735596811091968 for more details.
Test entering full screen security restrictions. An iframe without an allow attribute is still permitted to fullscreen if the request comes from the containing document.

To test manually, press any key - the page should enter full screen mode.
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
PASS
CONSOLE WARNING: Resource requests whose URLs contain raw newline characters are deprecated, and may be blocked in M60, around August 2017. Please remove newlines from places like element attribute values in order to continue loading those resources. See https://www.chromestatus.com/features/5735596811091968 for more details.
FAIL, script did not run.
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
CONSOLE WARNING: Resource requests whose URLs contain raw newline characters are deprecated, and may be blocked in M60, around August 2017. Please remove newlines from places like element attribute values in order to continue loading those resources. See https://www.chromestatus.com/features/5735596811091968 for more details.
This is a testharness.js-based test.
PASS <img id="dangling" src="http://127.0.0.1:8000/security/resources/abe.png?data=1&#10;b">
PASS <img id="dangling" src="http://127.0.0.1:8000/security/resources/abe.png?img=2&#10;b&lt;c">
PASS <img id="dangling" src="http://127.0.0.1:8000/security/resources/abe.png?img=3 b&lt;c ">
FAIL <img id="dangling" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEwAAABnAQMAAACQMjadAAAAA1BMVEX///+nxBvIAAAAEUlEQVQ4y2MYBaNgFIwCegAABG0AAd5G4RkAAAAASUVORK5CYII="> assert_equals: Height expected 0 but got 103
PASS <img id="dangling" src="http://127.0.0.1:8000/security/resources/abe.png?4&img=&lt;b">
PASS <img id="dangling" src="http://127.0.0.1:8000/security/resources/abe.png?5&data=&amp;#10;b">
PASS <img id="dangling" src="http://127.0.0.1:8000/security/resources/abe.png?6&img=&amp;lt;b">
PASS <img id="dangling" src="http://127.0.0.1:8000/security/resources/abe.png?7&img=&amp;#10;b&amp;lt;c">
PASS <img id="dangling" src=" http://127.0.0.1:8000/security/resources/abe.png?8 "> <input type=hidden name=csrf value=sekrit>
PASS <img id="dangling" src=" http://127.0.0.1:8000/security/resources/abe.png?9&img=&amp;lt; "> <input type=hidden name=csrf value=sekrit>
PASS <img id="dangling" src=" http://127.0.0.1:8000/security/resources/abe.png?10&img=&amp;#10; "> <input type=hidden name=csrf value=sekrit>
Harness: the test ran to completion.

Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,14 @@
var abeSizedPngWithNewline = abeSizedPng.replace("i", "i\n");

var should_block = [
`<img id="dangling" src="http://127.0.0.1:8000/security/resources/abe.png?img=a${rawNewline}b${rawBrace}c">`,
`<img id="dangling" src="http://127.0.0.1:8000/security/resources/abe.png?data=1${rawNewline}b">`,
`<img id="dangling" src="http://127.0.0.1:8000/security/resources/abe.png?img=2${rawNewline}b${rawBrace}c">`,
`
<img id="dangling" src="http://127.0.0.1:8000/security/resources/abe.png?img=a
<img id="dangling" src="http://127.0.0.1:8000/security/resources/abe.png?img=3
b${rawBrace}c
">
`,
`<img id="dangling" src="${abeSizedPngWithNewline}">`,
];

should_block.forEach(markup => {
Expand All @@ -32,35 +34,30 @@
});

var should_load = [

// `data:` and `javascript:` URLs don't check the content:
`<img id="dangling" src="${abeSizedPngWithNewline}">`,

// Just one or the other isn't enough:
`<img id="dangling" src="http://127.0.0.1:8000/security/resources/abe.png?data=a${rawNewline}b">`,
`<img id="dangling" src="http://127.0.0.1:8000/security/resources/abe.png?img=a${rawBrace}b">`,
// Brace alone doesn't block:
`<img id="dangling" src="http://127.0.0.1:8000/security/resources/abe.png?4&img=${rawBrace}b">`,

// Entity-escaped characters don't trigger blocking:
`<img id="dangling" src="http://127.0.0.1:8000/security/resources/abe.png?data=a${escapedNewline}b">`,
`<img id="dangling" src="http://127.0.0.1:8000/security/resources/abe.png?img=a${escapedBrace}b">`,
`<img id="dangling" src="http://127.0.0.1:8000/security/resources/abe.png?img=a${escapedNewline}b${escapedBrace}c">`,
`<img id="dangling" src="http://127.0.0.1:8000/security/resources/abe.png?5&data=${escapedNewline}b">`,
`<img id="dangling" src="http://127.0.0.1:8000/security/resources/abe.png?6&img=${escapedBrace}b">`,
`<img id="dangling" src="http://127.0.0.1:8000/security/resources/abe.png?7&img=${escapedNewline}b${escapedBrace}c">`,

// Leading and trailing whitespace is stripped:
`
<img id="dangling" src="
http://127.0.0.1:8000/security/resources/abe.png
http://127.0.0.1:8000/security/resources/abe.png?8
">
<input type=hidden name=csrf value=sekrit>
`,
`
<img id="dangling" src="
http://127.0.0.1:8000/security/resources/abe.png?img=${escapedBrace}
http://127.0.0.1:8000/security/resources/abe.png?9&img=${escapedBrace}
">
<input type=hidden name=csrf value=sekrit>
`,
`
<img id="dangling" src="
http://127.0.0.1:8000/security/resources/abe.png?img=${escapedNewline}
http://127.0.0.1:8000/security/resources/abe.png?10&img=${escapedNewline}
">
<input type=hidden name=csrf value=sekrit>
`,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
CONSOLE WARNING: Resource requests whose URLs contain raw newline characters are deprecated, and may be blocked in M60, around August 2017. Please remove newlines from places like element attribute values in order to continue loading those resources. See https://www.chromestatus.com/features/5735596811091968 for more details.
ALERT: true

Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
CONSOLE WARNING: Resource requests whose URLs contain raw newline characters are deprecated, and may be blocked in M60, around August 2017. Please remove newlines from places like element attribute values in order to continue loading those resources. See https://www.chromestatus.com/features/5735596811091968 for more details.
CONSOLE MESSAGE: line 1: PASS: indexedDB.open() threw a SECURITY_ERR!

Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
CONSOLE WARNING: Resource requests whose URLs contain raw newline characters are deprecated, and may be blocked in M60, around August 2017. Please remove newlines from places like element attribute values in order to continue loading those resources. See https://www.chromestatus.com/features/5735596811091968 for more details.
CONSOLE ERROR: line 1: Blocked opening 'about:blank' in a new window because the request was made in a sandboxed frame whose 'allow-popups' permission is not set.
CONSOLE MESSAGE: line 1: PASS
To run this test outside of DumpRenderTree, please disable your popup blocker!
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
CONSOLE WARNING: Resource requests whose URLs contain raw newline characters are deprecated, and may be blocked in M60, around August 2017. Please remove newlines from places like element attribute values in order to continue loading those resources. See https://www.chromestatus.com/features/5735596811091968 for more details.
CONSOLE ERROR: line 1: Unsafe JavaScript attempt to initiate navigation for frame with URL 'http://127.0.0.1:8000/security/no-popup-from-sandbox-top.html' from frame with URL 'data:text/html, <script> var win = window.open('about:blank', '_top'); console.log(win ? 'FAIL' : 'PASS'); </script>'. The frame attempting navigation of the top-level window is sandboxed, but the flag of 'allow-top-navigation' or 'allow-top-navigation-by-user-activation' is not set.

CONSOLE MESSAGE: line 1: PASS
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
CONSOLE WARNING: Resource requests whose URLs contain raw newline characters are deprecated, and may be blocked in M60, around August 2017. Please remove newlines from places like element attribute values in order to continue loading those resources. See https://www.chromestatus.com/features/5735596811091968 for more details.
To run this test outside of DumpRenderTree, please disable your popup blocker!

This test passes if it doesn't hang.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
CONSOLE WARNING: Resource requests whose URLs contain raw newline characters are deprecated, and may be blocked in M60, around August 2017. Please remove newlines from places like element attribute values in order to continue loading those resources. See https://www.chromestatus.com/features/5735596811091968 for more details.
CONSOLE MESSAGE: line 1: /PASS/
To run this test outside of DumpRenderTree, please disable your popup blocker!

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
CONSOLE WARNING: Resource requests whose URLs contain raw newline characters are deprecated, and may be blocked in M60, around August 2017. Please remove newlines from places like element attribute values in order to continue loading those resources. See https://www.chromestatus.com/features/5735596811091968 for more details.
CONSOLE ERROR: line 1: Blocked form submission to 'javascript:alert(/FAIL/)' because the form's frame is sandboxed and the 'allow-forms' permission is not set.
To run this test outside of DumpRenderTree, please disable your popup blocker!

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
CONSOLE WARNING: Resource requests whose URLs contain raw newline characters are deprecated, and may be blocked in M60, around August 2017. Please remove newlines from places like element attribute values in order to continue loading those resources. See https://www.chromestatus.com/features/5735596811091968 for more details.
CONSOLE MESSAGE: line 1: PASS
To run this test outside of DumpRenderTree, please disable your popup blocker!

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
CONSOLE WARNING: Resource requests whose URLs contain raw newline characters are deprecated, and may be blocked in M60, around August 2017. Please remove newlines from places like element attribute values in order to continue loading those resources. See https://www.chromestatus.com/features/5735596811091968 for more details.
To run this test outside of DumpRenderTree, please disable your popup blocker!

This test passes if it doesn't hang.
Expand Down
Loading

0 comments on commit 58eb768

Please sign in to comment.