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

XSS (javascript execution vulnerability) #916

Closed
dobryakov opened this issue Jun 28, 2017 · 2 comments
Closed

XSS (javascript execution vulnerability) #916

dobryakov opened this issue Jun 28, 2017 · 2 comments

Comments

@dobryakov
Copy link

Steps to reproduce:

  1. Setup this gem for oauth through social network (vk.com in my case).
  2. Change your username to <script>alert('Hi!');</script>
  3. Logout and try to login through social network.
  4. See the "Hi!" alert :)

Reason:

app/views/devise_token_auth/omniauth_external_window.html.erb

Workaround:

# app/models/user.rb
def username
  CGI::escapeHTML( read_attribute(:username) )
end
@dobryakov
Copy link
Author

Right solution:

var data = JSON.parse(decodeURIComponent(' <%= URI::escape( @data.to_json ) %> '));

@booleanbetrayal
Copy link
Collaborator

booleanbetrayal commented Jun 30, 2017

thanks for this catch @dobryakov ! Fixed in 9fdf831

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

No branches or pull requests

2 participants