Giter Club home page Giter Club logo

Comments (2)

rlipscombe avatar rlipscombe commented on June 28, 2024

It's like this:

  1. I had some older code that was doing set-cookie from /auth/github, which Firefox remembered as path=/auth/github
  2. Because of the better match, it would send that cookie first, and we'd successfully update that session.
  3. Back on the home page, it would send the original cookie (implicitly path=/), which didn't match the session.

"But Roger", you say, "you've been restarting the app frequently, surely you'd create a new session, to avoid session fixation attacks with the permissive mode? See https://cheatsheetseries.owasp.org/cheatsheets/Session_Management_Cheat_Sheet.html#session-id-generation-and-verification-permissive-and-strict-session-management if you don't know what I'm referring to."

"You're correct", I say, "I am doing that, but each time we issue a new session, it implicitly gets reissued with the broken path, and we see the same behaviour again".

tl;dr: the browser defaults the cookie path to the current location; set path=/ if you want it to work for the entire site.

from cowboy2_session.

rlipscombe avatar rlipscombe commented on June 28, 2024

Further information:

  • You can't see this in the server; the client sends both session cookies to /auth/github, but it doesn't include the path, so you can't easily see which is which. It sends them ordered by best-match (i.e. longest path prefix match).
  • You have to look in the browser; in Firefox, this is in dev tools / storage / cookies. That shows the path, and makes it more obvious.

I don't know whether this is Firefox-specific behaviour.

from cowboy2_session.

Related Issues (16)

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.