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

[23073] Add Angular expression escaping #4536

Merged
merged 2 commits into from
Jun 15, 2016

Conversation

oliverguenther
Copy link
Member

This PR adds rails-angular-xss, our gem forked from angular_xssfor Rails 4.2.

The gem patches Rails XSS protection methods with a replacement of {{
strings with {{ DOUBLE_LEFT_CURLY_BRACE }}.

DOUBLE_LEFT_CURLY_BRACE is defined by Angular to return {{, so we
actually do execute the interpolation, but only to return the original
string.

More information:

https://github.com/opf/rails-angular-xss
angular/angular.js#5601

Them gem patches Rails XSS protection methods with a replacement of `{{`
strings with `{{ DOUBLE_LEFT_CURLY_BRACE }} `.

`DOUBLE_LEFT_CURLY_BRACE` is defined by Angular to return `{{`, so we
actually do execute the interpolation, but only to return the original
string.

More information:

https://github.com/opf/rails-angular-xss
angular/angular.js#5601
@TeatroIO
Copy link

I've prepared a stage to preview changes. Open stage or view logs.

@oliverguenther oliverguenther added this to the 5.0.x milestone Jun 14, 2016
@oliverguenther oliverguenther force-pushed the fix/23073/template-injection branch from e644177 to 4f67e1c Compare June 14, 2016 20:37
@@ -95,6 +95,9 @@ gem 'rack-protection', git: 'https://github.com/finnlabs/rack-protection.git', r
# https://github.com/kickstarter/rack-attack
gem 'rack-attack'

# Patch Rails HTML whitelisting for Angular curly braces
gem 'rails-angular-xss', github: 'opf/rails-angular-xss'
Copy link
Contributor

Choose a reason for hiding this comment

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

I seem to remember you saying that this can be removed once we have Angular 1.5 in place. If that is so, I'd like a commit in here so that we remove this gem once we no longer need it.

Copy link
Member Author

Choose a reason for hiding this comment

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

We'll still need the Rails part, since the escaping issue remains for all eternity

Copy link
Contributor

Choose a reason for hiding this comment

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

That sounds like a long time :(

@ulferts
Copy link
Contributor

ulferts commented Jun 15, 2016

There are some parts of the update to gemfile.lock that are not strictly necessary for this change but they probably can't hurt either.

@ulferts ulferts merged commit ba28fef into opf:release/5.0 Jun 15, 2016
@ulferts ulferts deleted the fix/23073/template-injection branch June 15, 2016 16:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants