Giter Club home page Giter Club logo

cowboy2_session's People

Contributors

rlipscombe avatar

Watchers

 avatar

cowboy2_session's Issues

Use a CSPRNG for session IDs

rand:bytes/1 (PRNG) is probably hard to predict. It would be better to use a CSPRNG to be sure, though. Use crypto:strong_rand_bytes/1 instead.

Consider hashing session IDs

If an attacker gets a copy of the session ID database, they'll be able to use one of the stolen session IDs to impersonate an authenticated user.

I think that this is only really relevant if using a persistent session store, so this depends on #8.

Mitigations are:

  1. short session lifetimes.
  2. periodic ID refresh; maybe that goes with #6. What I mean by that is: the session could be relatively long-lived ("remember me"), but if the ID is rotated frequently, the stolen database becomes useless.

See https://security.stackexchange.com/questions/221841/hashing-session-id

Provide a way to renew the session ID

Avoids session fixation. For example:

  1. Attacker visits the site; gets a session ID that refers to an anonymous user.
  2. Attacker somehow puts that cookie on the victim's computer.
  3. Victim logs in (or otherwise escalates their privileges).
  4. If the session ID is reused, it now refers to the escalated session.
  5. Attacker now has an escalated session on their own browser.

See, for example, https://cheatsheetseries.owasp.org/cheatsheets/Session_Management_Cheat_Sheet.html#renew-the-session-id-after-any-privilege-level-change

Allow alternative session storage

ETS storage is great, but it can't be shared across nodes behind a load-balancer, and it's not persistent in case of server restart. Make it pluggable and provide, e.g., a redis backend.

Cookie path should be set explicitly (was: Sessions not working over 302 redirect)

Hacking on something at work; uses Github OAuth, and it stopped working. As far as I can tell, it's because session cookies don't work reliably over a 302 redirect (some SameSite shenanigans).

So: look carefully at how sessions are done over redirects. This probably means that #13 needs to be WONTFIXED, and that #6 needs looking at -- if you're doing it and then redirecting, stuff might break.

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.