Comments (2)
It's like this:
- I had some older code that was doing set-cookie from /auth/github, which Firefox remembered as path=/auth/github
- Because of the better match, it would send that cookie first, and we'd successfully update that session.
- 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.
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 (17)
- Use a CSPRNG for session IDs
- Consider hashing session IDs
- Session hijacking mitigations
- Allow put_session/renew_session_id in a single call
- Consider not sending the session cookie until there is a session HOT 1
- Add a filter function that controls whether a session is automatically created HOT 1
- rebar3 dialyzer fails because it can't find cowboy_stream
- After delete session from Req, how to check if the session is deleted HOT 1
- Allow configuration of cookie options
- Allow configuration of cookie name
- Allow configuration of ETS table name
- Allow configuration of empty session value HOT 1
- Provide a way to renew the session ID HOT 1
- Expire sessions from the ETS table
- Allow alternative session storage
- Allow changes to cookie options on the fly
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cowboy2_session.