What are “signed” cookies in connect/expressjs?

前端 未结 4 1628
自闭症患者
自闭症患者 2020-11-29 16:01

I am trying to figure out what \"signed cookies\" actually are. There isn\'t much on the net, and if I try this:

app.use(express.cookieParser(\'A secret\'));         


        
4条回答
  •  旧时难觅i
    2020-11-29 16:44

    Yup like emostar mentions it's simply to ensure that a value has not been tampered with. It's placed in a different object (req.signedCookies) to differentiate between the two, allowing the developer to show intent. If they were stored in req.cookies along with the others someone could simply craft an unsigned cookie of the same name, defeating the whole purpose of them.

提交回复
热议问题