-
Notifications
You must be signed in to change notification settings - Fork 1.2k
feat(extract): prefixed signed&private cookies #3251
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
base: main
Are you sure you want to change the base?
Conversation
@jplatte do you know if there is a reason why the inner jars are not exposed as public API? seems like that would simplify the implementation quite a bit 🤔 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code is looking good to me.
Nitpick: I don't know if we want some println
in the code through.
I don't know enough the API + our consensus about exposing the cookie API to make a decision here.
Are you suggesting we expose the inner jars alongside the current convenience methods, or replace the current API entirely with direct access to the underlying cookie crate jars? |
maybe :D I don't know the history of this extractor, so before I can form an opinion it would be better to know why this wasn't done in the first place 😅 |
I don't know the historical reasoning either, and I'm not really proficient enough to predict what users might need. What do you think? |
I think the historical reason was that the cookie stuff used to be in axum and David didn't want the cookie crate as part of the public API, to be able to upgrade it across major versions within a minor version of axum. However now the cookie crate is already part of the public API anyways, so I think we might as well.. Maybe? It's been a while that I've actually looked at the details here. If you want, I can take a closer look before time is spent on refactoring stuff here that may be reversed again at some point. |
closes #3246
Cookie Prefixes Support
Motivation
Cookie prefixes (__Host- and __Secure-) are a web security feature that help protect against cookie manipulation and session fixation attacks. This PR enhances Axum's cookie handling by adding proper support for cookie prefixes across all cookie jar types (
CookieJar
,SignedCookieJar
, andPrivateCookieJar
).Solution
This PR implements:
add_prefixed
,get_prefixed
,remove_prefixed
) for all cookie jar typesIntegration of prefix support with signed and private cookies, ensuring the encryption/signing is maintained