Why store sessions on the server instead of inside a cookie?

前端 未结 4 479
闹比i
闹比i 2021-02-05 17:58

I have been using Flask for some time now and I am really enjoying the framework. One thing that I fail to understand is that in almost all other places they talk about storing

4条回答
  •  耶瑟儿~
    2021-02-05 18:21

    Even if your data is encrypted, the user could still roll back their cookie to a previous state (unless you start encoding one-time IDs etc)

    e.g. cookie says the user has 100 credits, user spends 100 credits, they get a new cookie saying they have 0 credits. They could then restore their previous cookie (with 100 credits).

    Depending how you encrypt the cookie, the user may also be able to delete keys, insert bogus data etc too.

提交回复
热议问题