yegor256 / glogin

Login/logout via GitHub OAuth for your Ruby web app
https://www.yegor256.com/2018/06/19/glogin.html
MIT License
12 stars 1 forks source link

Prevent replay attacks #13

Open ro31337 opened 6 years ago

ro31337 commented 6 years ago

Gem is nice, but this code doesn't look very secure:

get '/logout' do
  cookies.delete(:glogin)
  redirect to('/')
end

You delete a cookie from the client, but if it has been compromised already (cookie was stolen), attacker can replay this cookie and use it forever.

There are few ways to avoid that:

I think gem should have some storage callbacks or accept storage object, so cookies can be secure enough. With current implementation cookies are valid forever and it's not good.

yegor256 commented 5 years ago

@ro31337 definitely a bug and a request for improvement, thanks!