-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Expose functionality underlying private cookies. #477
Comments
This feature would be great to have. I'm implementing some OAuth API, and the access token should contain some information without requiring to re-check the database. This information should be encrypted in the token with a secret key, so this feature would be really useful. It can be as simple as passing a |
I would like to use such a feature to embed a link into a confirmation email I send to the user, so that when the user clicks that link, I can verify that the payload has not been tampered with. Right now, I have to ask admins to generate and configure two secret keys (one for Rocket and one specifically for my app for the email links), which seems rather unnecessary. |
Feature request: Expose the secret key so that we can use argon2 password hashing in a more secure mode. |
I would also like this feature added, as it would allow me to decrypt private cookies I recieved in a LocalResponse while testing, to check, if it contains the right value. |
@morbatex You can already do that today by asking the |
I don't think that's currently true of |
As of 5232002, reality has reached my previous statement. |
I've also run into this on 0.5. I want to generate an URL with an encrypted query parameter for which the existing cookie secret would be the perfect fit. I tried to work around it, but so far I did not find a solution that does not involved my own copy of a secret key and encryption routine:
|
Would there be interest for a PR that adds a API as proposed here? |
Absolutely. I'd love that. To make things easier, please propose a concrete api and implementation idea. That way we can get the hard parts out of the way first. Given this is security critical, we need to make sure this is correct. |
Feature Requests
Expose new API:
encrypt_private(&str) -> String
anddecrypt_private(&str) -> Result<String>
or something like it, that would use the same scheme as private cookies do.Why you believe this feature is necessary.
It's not necessary, but it would be useful to be able to use the same encryption that private cookies use on arbitrary data/strings. This way encrypted values can be embedded eg. in rendered forms to pass authenticated, unforgeable data.
A convincing use-case for this feature.
I'd like to embed an URL and some control data in one of my forms, to control some flow after form submission, and not have to worry about all the possible attack vectors. It would greatly simplify everything if I could trust that data was not tampered with. I can't put it in cookies since it's page, and not session, related.
Why this feature can't or shouldn't exist outside of Rocket.
Obviously, it can be done manually / through another library, but since Rocket already takes care of managing the encryption key, it would be much easier to just reuse it.
The text was updated successfully, but these errors were encountered: