2018年7月2日 星期一

reset password token leaking

reset password 的網址常常是

https://yourdomain/password/reset?token=xxxx

但這樣就會被第三方網站從 `HTTP Referer` 內找到並紀錄起來 reset password 的 token,例如 google analytics,就有安全疑慮

幾個做法:

1. 一進到這個頁面馬上 invalidate 這個 token 然後generate 一個新的塞到 form 裡面
2. 進到 passwords#edit 時就把 params 移除存到 session 裡面再 redirect 回 passwords#edit 頁面,這樣 referer 就沒有token 資訊

https://robots.thoughtbot.com/is-your-site-leaking-password-reset-links


沒有留言:

張貼留言