Coder Social home page Coder Social logo

Comments (5)

houming818 avatar houming818 commented on June 13, 2024
     """ 
     将登录票据设置为不合法 
     """ 
     bk_token = request.COOKIES.get(settings.BK_COOKIE_NAME, None) 
     if bk_token: 
         bk_token = urllib.parse.unquote(bk_token)
         BkToken.objects.filter(token=bk_token).update(is_logout=True) 

from bk-user.

nannan00 avatar nannan00 commented on June 13, 2024

已确认,该问题确实存在,但是提交的PR方案可能我们还需要讨论一下
方案1:加密上确保不存在可被转义的特殊字符
方案2:对bk_token从cookie获取后进行unquote

from bk-user.

nannan00 avatar nannan00 commented on June 13, 2024

从目前django的源码来看,是有对cookie进行unquote的,还需要进一步排查
image

from bk-user.

nannan00 avatar nannan00 commented on June 13, 2024

从目前django的源码来看,是有对cookie进行unquote的,还需要进一步排查 image

已确认,这里的cookie._unquote与urllib.parse.unquote并非相同作用,所以PR https://github.com/TencentBlueKing/bk-user/pull/951/files 是�OK的

from bk-user.

houming818 avatar houming818 commented on June 13, 2024

@nannan00 这里是要讨论下,因为从Cookies里面拿数据是经常的行为,每个地方都unquote是不太方便。建议先这样处理,其他地方如果有问题了,再统一搞一个合适的方案。

from bk-user.

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.