New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 701371 link

Starred by 2 users

Issue metadata

Status: Assigned
Owner:
Buried. Ping if important.
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux , Android , Windows , Chrome , Mac
Pri: 3
Type: Feature



Sign in to add a comment

"Script error." message in window.onerror makes bad DevExp trade off

Project Member Reported by malteubl@google.com, Mar 14 2017

Issue description

When a script that isn't served from the same origin as the document throws an error, then the error message exposed to window.onerror is "Script error." and the stack trace is empty.

This is to spec and it can be worked around by
- serving the script with CORS headers
- requesting the script as CORS.

While the behavior is understandable, it leads to bad developer experience in practice and is overzealous with respect to the threat model.

My understanding of the threat model is that it is worried about attackers circumventing CORS restrictions by e.g. script srcing a privileged file from a cross origin and then gaining insights from the error message that happens because the file is not valid JavaScript.

I think Chrome could successfully prevent the threat while maintaining most of the developer experience:

- The "Script error." rewriting should be limited to initial execution of a script, because all other stack entry points can be wrapped in try-catch and hence aren't subject to the limitation anyway.
- Potentially the rewriting of the error message could be limited to SyntaxError only.

Since SyntaxErrors are essentially irrelevant in JavaScript production monitoring, these changes would reinstate the ideal developer experience while maintaining the desired protection against data leaks.

As an additional data point: Safari implements the same behavior as Chrome, but Edge doesn't handle cross origin error specifically at all.
 

Comment 1 by mkwst@chromium.org, Mar 15 2017

Cc: jochen@chromium.org
Components: Blink>SecurityFeature>SameOriginPolicy
Labels: -Type-Bug -OS-All OS-Android OS-Chrome OS-Linux OS-Mac OS-Windows Type-Feature
Owner: mkwst@chromium.org
Status: Assigned (was: Untriaged)
Sounds like a reasonable thing to look into, and I think the kinds of boundaries you're outlining might be a good compromise.

Would you mind filing a spec bug against HTML to discuss changes to the "muted errors" behavior? We should loop interested folks in from Mozilla, et al.
Project Member

Comment 3 by sheriffbot@chromium.org, Jul 25 2017

Labels: Hotlist-Google
Components: -Platform>DevTools>JavaScript

Comment 5 by est...@chromium.org, Nov 10 2017

Labels: Hotlist-EnamelAndFriendsFixIt

Comment 6 by est...@chromium.org, Feb 18 2018

Labels: -Hotlist-EnamelAndFriendsFixIt

Sign in to add a comment