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

Security related fixes #135

Merged
merged 1 commit into from
Jan 13, 2016
Merged

Security related fixes #135

merged 1 commit into from
Jan 13, 2016

Conversation

lingyan
Copy link
Member

@lingyan lingyan commented Jan 13, 2016

@Vijar @redonkulus

  • escape resource name in error output

Based on this owasp guideline,

Ensure returned Content-Type header is application/json and not text/html.
This shall instruct the browser not misunderstand the context and execute injected script.

Escaping is not needed for JSON data output, as long as the content-type header is set correctly to Content-Type: application/json; charset=utf-8, which fetchr already does with res.json().

But there could be legacy browsers with security bugs that do not respect this, such as Opera browser prior to Opera 11.65 (Latest Opera is at 34.0 as of now.): https://www.cvedetails.com/cve/CVE-2012-3557/

This PR escapes only the message strings fetchr library generates that can be part of the JSON response for addressing legacy browser concerns. If application is concerned about legacy browser in general, the suggestion is to escape output app generates in the app before sending to fetchr.

@lingyan lingyan force-pushed the securityFix branch 3 times, most recently from 82c2b51 to 9cbb401 Compare January 13, 2016 16:39
@redonkulus
Copy link
Contributor

👍

1 similar comment
@Vijar
Copy link
Contributor

Vijar commented Jan 13, 2016

👍

lingyan added a commit that referenced this pull request Jan 13, 2016
@lingyan lingyan merged commit ebc4fda into master Jan 13, 2016
@lingyan lingyan deleted the securityFix branch January 13, 2016 20:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants