Skip to content

Commit

Permalink
Stringify api_key
Browse files Browse the repository at this point in the history
By default there is no api key generated. I just managed to break into api on test installation using `?token[]`, one of my favourite CVEs
@radar, please take a look at Mr. Outsider's PR

Fixes #2492
  • Loading branch information
homakov authored and radar committed Jan 26, 2013
1 parent 9005432 commit 3c2015e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion api/app/controllers/spree/api/base_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def check_for_api_key

def authenticate_user
if requires_authentication? || api_key.present?
unless @current_api_user = Spree.user_class.find_by_spree_api_key(api_key)
unless @current_api_user = Spree.user_class.find_by_spree_api_key(api_key.to_s)
render "spree/api/errors/invalid_api_key", :status => 401 and return
end
else
Expand Down

1 comment on commit 3c2015e

@runlevel5
Copy link
Member

Choose a reason for hiding this comment

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

@homakov 👍

Please sign in to comment.