Why not use session ID as XSRF token?

后端 未结 3 1100
执笔经年
执笔经年 2020-12-30 02:39

Why does Play Framework use [a signed version of the session id] as Cross Site Request Forgery (XSRF/CSRF) prevention token, rather than the session ID itself?

(With

3条回答
  •  再見小時候
    2020-12-30 03:21

    Perhaps Play Framework doesn't want the SID in the HTML. An end user, Bob, might download a Web page, and if there's a

    in that Web page, the SID would be included in the downloaded HTML (if the SID itself is used as XSRF token). If Bob then emails his downloaded page to Mallory, then Mallory would find the SID and could impersonate Bob!?

    (Another minor reason not to use the SID: As I mentioned in my update, the SID might simply not be available. Perhaps it's generated as late as possible, to save CPU resources.)

提交回复
热议问题