跳到主要内容
CNode

nodeclub 安全问题

社区
Pphilsong发布于 14 年前最后回复 14 年前
559070

// private function gen_session(user,res) { var auth_token = encrypt(user._id + '\t'+user.name + '\t' + user.pass +'\t' + user.email, config.session_secret); res.cookie(config.auth_cookie_name, auth_token, {path: '/',maxAge: 10006060247}); //cookie 有效期1周 }

用户密码存在cookie中,如果用户知道session_secret,很容易搞到密钥

查看回复

回复 (5)

J
jsonshen#514 年前

目前的情况应该不会有什么大问题

H
hellowhat#114 年前
  1. session_secret是很保密的。
  2. 我认为只用把user.name加密下就可以用作token了,加不加密码都一样……

参与回复

登录后即可参与回复。登录