Skip to content

Ensuring deleted cookies are recognized by the browser by ensuring the MaxAge within CookieOptions is set to null. #55169

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

Merged
merged 9 commits into from
Apr 19, 2024

Conversation

MattyLeslie
Copy link
Contributor

@MattyLeslie MattyLeslie commented Apr 16, 2024

Reset MaxAge to Null on Cookie Deletion

Summary:
This PR aims to ensure reliable cookie deletion by setting MaxAge to null in the CookieOptions used by ResponseCookies.Delete, addressing inconsistencies identified in issue #52159.

Description:
To resolve inconsistencies in cookie deletion across browsers, this update modifies the ResponseCookies.Delete method to reset MaxAge to null. Previously, retained MaxAge values could prevent browsers from recognizing that cookies were meant to be deleted.

Technical Changes:

Enforced MaxAge = null in CookieOptions during cookie deletion..

Fixes
#52159 by standardizing cookie deletion behavior across all browsers.

@ghost ghost added the area-networking Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions label Apr 16, 2024
@dotnet-policy-service dotnet-policy-service bot added the community-contribution Indicates that the PR has been added by a community member label Apr 16, 2024
@MattyLeslie MattyLeslie marked this pull request as draft April 17, 2024 08:05
@amcasey
Copy link
Member

amcasey commented Apr 17, 2024

CI failure looks like network flakiness. Re-running.

@MattyLeslie MattyLeslie marked this pull request as ready for review April 18, 2024 06:49
@MattyLeslie
Copy link
Contributor Author

Thanks @amcasey, I have submitted the PR.

@amcasey
Copy link
Member

amcasey commented Apr 18, 2024

I like it! Do we need to update here and here as well?

@MattyLeslie
Copy link
Contributor Author

Thanks for the review @amcasey, I believe the ChunkingCookieManager.cs will need to make use of the same logic when deleting chunks, I have updated the relevant areas and added the recommended comments.

Copy link
Member

@amcasey amcasey left a comment

Choose a reason for hiding this comment

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

Thanks!

@amcasey amcasey merged commit e2e689a into dotnet:main Apr 19, 2024
26 checks passed
@dotnet-policy-service dotnet-policy-service bot added this to the 9.0-preview4 milestone Apr 19, 2024
@MattyLeslie MattyLeslie deleted the #52159 branch April 21, 2024 07:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-networking Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions community-contribution Indicates that the PR has been added by a community member
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants