Skip to content

feat(http): add cookie config options to control unencrypted cookie discarding#2132

Merged
innocenzi merged 7 commits into
tempestphp:3.xfrom
rexpl:fix/discard-unencrypted-cookies
Jun 9, 2026
Merged

feat(http): add cookie config options to control unencrypted cookie discarding#2132
innocenzi merged 7 commits into
tempestphp:3.xfrom
rexpl:fix/discard-unencrypted-cookies

Conversation

@rexpl

@rexpl rexpl commented May 21, 2026

Copy link
Copy Markdown
Contributor

I was surprised by the default Tempest behaviour of discarding any cookie it did not encrypt itself. Cookies from other legitimate services (ex: reverse proxy) would silently get discarded. Two new CookieConfig options allow developers to handle this: discardUnencryptedCookies to disable discarding entirely, and plaintextCookies to allowlist specific cookies by name.

Original behaviour is preserved, but can now be opted out (fully or partially).

@rexpl rexpl requested review from aidan-casey and brendt as code owners May 21, 2026 06:45

@innocenzi innocenzi left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks good, just a few minor changes

Comment thread packages/http/src/Cookie/CookieConfig.php
Comment thread tests/Integration/Http/CookieHandlingTest.php Outdated
Comment thread tests/Integration/Http/CookieHandlingTest.php Outdated
@github-actions

github-actions Bot commented May 21, 2026

Copy link
Copy Markdown

Benchmark Results

Comparison of fix/discard-unencrypted-cookies against 3.x (b147cd36d5e492a6d8fd332915720a7ca573293b).

Open to see the benchmark results

No benchmark changes above ±5%.

Generated by phpbench against commit bd6089f

@brendt

brendt commented May 22, 2026

Copy link
Copy Markdown
Member

Also feel free to add an entry to the docs mentioning this new config: https://github.com/tempestphp/tempest-framework/blob/3.x/docs/1-essentials/01-routing.md

I just noticed we don't mention cookies at all there. For now, you can add a section before "Session management"

## Cookie management

### Configuration

I'll add the rest of the docs for cookies after this is merged

@brendt

brendt commented Jun 1, 2026

Copy link
Copy Markdown
Member

Can you take a look at the failing tests?

@rexpl

rexpl commented Jun 9, 2026

Copy link
Copy Markdown
Contributor Author

I'm sorry, I am not super familiar with this process. Do I need to do something else to complete this?

@innocenzi innocenzi merged commit 89e9456 into tempestphp:3.x Jun 9, 2026
76 checks passed
@innocenzi

Copy link
Copy Markdown
Member

@rexpl just forgot to merge after my small changes. Thanks for the PR!

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