Coder Social home page Coder Social logo

Comments (2)

greyli avatar greyli commented on August 20, 2024
  1. 防止被篡改的对象其实主要是当前用户,比如你登录了A站,A站在你的浏览器cookie中(session)存储了用户id为你的id,如果不签名,那么你可以随意篡改这个值,比如改成其他人的id,这样你就可以随意登录别人的账户了。

  2. 别人窃取session和存不存敏感数据是两码事。如果别人窃取到session,的确可以代表你来访问网站,你可以通过设置httponly和secure等选项来加强session的安全性(前者禁止JS读取,后者禁止HTTP传输)。不在session中存储敏感数据是为了防止敏感数据泄露,不仅仅是为了保护登录权限。比如,某个赌博网站把开奖号码存在session里,那用户可以直接解析session查看开奖号码……再比如说,某网站把评论验证码的字符串值放到了session里,那么垃圾评论脚本就可以很容易的获取这个值,然后绕过验证。

from helloflask.

ivicel avatar ivicel commented on August 20, 2024

@shuizaiku7
我的理解:
session 是用来追踪同一用户请求的, 我们不用每次去验证帐号和密码. 在 server 端, 常以直接保存在内存中的实现, 好像有以数据库实现的. 在 client 端, 常以 cookie 实现.
假设 cookie 值没有 hash 过, 并且�网页程序写的很烂的话, 没做什么验证的话, 如果有一个请求是以当前登录的帐号来转出钱, 那么我坐在你电脑前修改下 uid 不就转出钱了么
所谓敏感数据其实应该来说是, 按等级的敏感数据, 比如你要登录, 就要有密码或者 token, 但泄漏明文密码和泄漏 token 危险等级不一样吧. cookie 里面存的也是敏感数据. 还有 @greyli 举例的一些业务上相关�功能

from helloflask.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.