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

[Security] Remove tokens from response body if httpOnly Cookie and Rotate Refresh token is being Used #580

Merged
merged 4 commits into from
Mar 24, 2024

Conversation

Aniket-Singla
Copy link
Contributor

@Aniket-Singla Aniket-Singla commented Jan 9, 2024

The reason for using cookies over Bearer token in headers is because the javascript code can't access http only cookies.

Currently I see, even if we are using cookies for authentication, we are not removing the tokens from response body.
For now, I have only made this change for refresh token and not changed anything related to access token to be consistent with LoginView. But I believe we should remove the access token as well if we are using http only cookies.

@Aniket-Singla Aniket-Singla changed the title [Security] Remove tokens from response body if Cookie is being Used [Security] Remove tokens from response body if httpOnly Cookie is being Used Jan 9, 2024
@Aniket-Singla Aniket-Singla changed the title [Security] Remove tokens from response body if httpOnly Cookie is being Used [Security] Remove tokens from response body if httpOnly Cookie and Rotate Refresh token is being Used Jan 11, 2024
@L0PiTaL
Copy link

L0PiTaL commented Feb 3, 2024

Although I am new to the project, I agree that tokens should be hidden.

Note that expiration dates are controlled by JWT_AUTH_RETURN_EXPIRATION, so your PR should test for that setting for the expiration date, entirely independently of JWT_AUTH_HTTPONLY.

I agree that the auth tokens should also be hidden in a similar way, although maybe using separate settings.

Copy link
Owner

@iMerica iMerica left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this

@iMerica iMerica merged commit 4416ee1 into iMerica:master Mar 24, 2024
3 checks passed
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

Successfully merging this pull request may close these issues.

3 participants