Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CookieStore doc says data is signed but it doesn't seem to be #55

Open
tekul opened this issue Jan 3, 2023 · 2 comments
Open

CookieStore doc says data is signed but it doesn't seem to be #55

tekul opened this issue Jan 3, 2023 · 2 comments

Comments

@tekul
Copy link

tekul commented Jan 3, 2023

This was already mentioned in #40 but I think it still applies. From looking at the code, it seems that the cookie is just the serialized Session instance and as such could easily be modified. Any signing has to be done externally, by middleware.

This means that the middleware has to be aware of the SessionStore implementation and whether the data needs to be protected or not. In the case of axum-sessions they always HMAC the cookie value, which is unnecessary given that the cookie value is just random data for most store implementations.

The docs should probably make it clear that there is no signing of the value in this crate. It would be possible for CookieStore to handle signing (and possibly encryption) of the cookie value though, which would (optionally) remove the responsibility from the various middleware implementations. I could try and put together a PR if this makes sense?

@maxcountryman
Copy link
Contributor

This would be really neat.

@NVedsted
Copy link

I just stumbled onto this as well. It should be made a priority to correct the documentation as it is highly misleading to claim cookies are being signed when that is not the case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants