Repository navigation
Refresh expiration dates for empty-valued cookies during replay - #8520
Merged
mhils merged 5 commits intoOct 25, 2026
Merged
Conversation
Co-authored-by: generaltony007 <[email protected]>
Co-authored-by: generaltony007 <[email protected]>
Co-authored-by: generaltony007 <[email protected]>
Co-authored-by: generaltony007 <[email protected]>
This was referenced Oct 25, 2026
lups2000
pushed a commit
to lups2000/mitmproxy
that referenced
this pull request
Oct 31, 2026
…proxy#8520) * Fix cookie validation check for None values Co-authored-by: generaltony007 <[email protected]> * test(http): cover refreshing empty and valueless cookies Co-authored-by: generaltony007 <[email protected]> * test(http): refresh empty cookie expiration through responses Co-authored-by: generaltony007 <[email protected]> * docs: note empty cookie expiration refresh fix Co-authored-by: generaltony007 <[email protected]> * [autofix.ci] apply automated fixes --------- Co-authored-by: generaltony007 <[email protected]> Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
zchee
added a commit
to zchee/mitmproxy-go
that referenced
this pull request
Nov 3, 2026
Only consume an Expires comma after a weekday. Keep present empty cookie values valid for replay while rejecting missing names or values. Match mitmproxy/mitmproxy#8489 and mitmproxy/mitmproxy#8520. Co-Authored-By: Codex <[email protected]> Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01JzMvb3jz3dRT93GMjXUfQQ
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
refresh_set_cookie_header()rejects any falsey cookie value. An empty string is valid, however: RFC 6265 section 4.1.1 definescookie-valueas zero or more cookie octets, optionally quoted.For example,
session=; Expires=Wed, 21 Oct 2015 07:28:00 GMT; Path=/raisesValueErrorinstead of shifting its expiration.Response.refresh()catches that error and silently retains the stale header, so replayed empty-valued cookies do not receive the same date adjustment as nonempty cookies.Reject a missing value (
None) rather than an empty string. This keeps genuinely valueless cookie rejection and the existing handling of malformed expiration dates unchanged.Tests exercise both
session=andsession=""through the cookie helper and a realResponse.refresh(), plus a valueless-cookie control. Four new cases fail on unchanged base9125647; all five pass with the fix. This is separate from #8415's Max-Age precedence changes and does not change expiration precedence or parsing.Validation in a separate current-base tree, without the XML changes from #8518:
No live-browser replay or Windows/macOS test was run.
Checklist