Skip to content

Conversation

alexander-alderman-webb
Copy link
Contributor

Description

Prevent mutating cookies on incoming HTTP requests if the cookie name is in the scrubbers denylist.

Cookies like token=... were replaced with AnnotatedValue because a shallow reference of the request information was held by the client. A deep copy is introduced so scrubbing does not interfere with Litestar, and in particular does not break JWTCookieAuth. Other HTTP integrations already create a deep copy. For instance,

event["request"] = deepcopy(request_info)

Issues

Closes #4882

Reminders

@alexander-alderman-webb alexander-alderman-webb requested a review from a team as a code owner October 3, 2025 11:57
@alexander-alderman-webb alexander-alderman-webb changed the title fix(litestar): Copy request body to prevent cookies mutation fix(litestar): Copy request info to prevent cookies mutation Oct 3, 2025
@alexander-alderman-webb alexander-alderman-webb merged commit bf77a86 into master Oct 6, 2025
113 checks passed
@alexander-alderman-webb alexander-alderman-webb deleted the webb/copy-request-info-litestar branch October 6, 2025 11:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants