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

Add xml content-types to valid html_types for Rack::Protection #1413

Merged
merged 1 commit into from
Mar 30, 2018

Conversation

naneer
Copy link

@naneer naneer commented Mar 28, 2018

Javascript can run in XML by defining an HTML namespace. Example: <script xmlns="http://www.w3.org/1999/xhtml">alert(1)</script>. Request is adding text/xml and application/xml to :html_types to include protection for these content types.

Example

Payload:
http://localhost:4567?example_rxss_param=]]%3E%3Cscript%20xmlns=%22http://www.w3.org/1999/xhtml%22%3Ealert(1)%3C/script%3E%3C![CDATA[

Response:
<![CDATA[]]>
<script xmlns="http://www.w3.org/1999/xhtml">alert(1)</script>
<![CDATA[]>

@namusyaka
Copy link
Member

Looks good to me. I prefer application/xml over text/xml.
text/xml is old, in modern times we should use application/xml.
However, it should have a coexistence period based on the historical background of RFC.

@naneer Could you squash your commits?

…s for Rack::Protection

create additional unit test

add application/xml content-type
@naneer naneer force-pushed the add-xml-content-type-csp branch from 95d8e0d to 99897fa Compare March 30, 2018 20:15
@naneer
Copy link
Author

naneer commented Mar 30, 2018

Thanks @namusyaka, I squashed the commits.

@namusyaka namusyaka self-requested a review March 30, 2018 21:23
Copy link
Member

@namusyaka namusyaka left a comment

Choose a reason for hiding this comment

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

Looks good to me. Thanks.

@namusyaka namusyaka merged commit b18f325 into sinatra:master Mar 30, 2018
@namusyaka namusyaka modified the milestones: Beyond, v2.0.2 Mar 30, 2018
netbsd-srcmastr pushed a commit to NetBSD/pkgsrc that referenced this pull request Sep 23, 2018
## 2.0.4 / 2018-09-15

* Don't blow up when passing frozen string to `send_file` disposition [#1137](sinatra/sinatra#1137) by Andrew Selder

* Fix ubygems LoadError [#1436](sinatra/sinatra#1436) by Pavel Rosick�«ò

* Unescape regex captures [#1446](sinatra/sinatra#1446) by Jordan Owens

* Slight performance improvements for IndifferentHash [#1427](sinatra/sinatra#1427) by Mike Pastore

* Improve development support and documentation and source code by Will Yang, Jake Craige, Grey Baker and Guilherme Goettems Schneider

## 2.0.3 / 2018-06-09

* Fix the backports gem regression [#1442](sinatra/sinatra#1442) by Marc-Andr�«± Lafortune

## 2.0.2 / 2018-06-05

* Escape invalid query parameters [#1432](sinatra/sinatra#1432) by Kunpei Sakai
  * The patch fixes [CVE-2018-11627](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2018-11627).

* Fix undefined method error for `Sinatra::RequiredParams` with hash key [#1431](sinatra/sinatra#1431) by Arpit Chauhan

* Add xml content-types to valid html_types for Rack::Protection [#1413](sinatra/sinatra#1413) by Reenan Arbitrario

* Encode route parameters using :default_encoding setting [#1412](sinatra/sinatra#1412) by Brian m. Carlson

* Fix unpredictable behaviour from Sinatra::ConfigFile [#1244](sinatra/sinatra#1244) by John Hope

* Add Sinatra::IndifferentHash#slice [#1405](sinatra/sinatra#1405) by Shota Iguchi

* Remove status code 205 from drop body response [#1398](sinatra/sinatra#1398) by Shota Iguchi

* Ignore empty captures from params [#1390](sinatra/sinatra#1390) by Shota Iguchi

* Improve development support and documentation and source code by Zp Yuan, Andreas Finger, Olle Jonsson, Shota Iguchi, Nikita Bulai and Joshua O'Brien
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.

2 participants