Skip to content

runtime/core: encode cookies #1944

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

Closed
wants to merge 1 commit into from
Closed

runtime/core: encode cookies #1944

wants to merge 1 commit into from

Conversation

fredr
Copy link
Member

@fredr fredr commented May 28, 2025

This adds percent encoding/decoding to cookies. With out it we cant use a lot of characters, like ;. It seems to be common practice to encode cookies in cookie libs, e.g in universal-cookie etc.

@fredr fredr requested review from eandre and Copilot May 28, 2025 08:09
@fredr fredr self-assigned this May 28, 2025
@encore-cla
Copy link

encore-cla bot commented May 28, 2025

All committers have signed the CLA.

Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds percent encoding/decoding support for cookies to allow reserved characters (e.g., ;) in cookie values.

  • Replaced split_parse/parse with their encoded variants to handle percent-encoded cookies
  • Updated Display implementation to emit encoded cookie strings
  • Enabled the percent-encode feature on the cookie crate and bumped related dependencies

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

File Description
runtimes/core/src/api/schema/cookie.rs Switched cookie parsing methods to encoded variants
runtimes/core/src/api/pvalue.rs Changed Display to use c.encoded() for output
runtimes/core/src/api/auth/mod.rs Applied encoded parsing in authentication cookie intake
runtimes/core/Cargo.toml Added percent-encode feature and updated dependency versions
Comments suppressed due to low confidence (1)

runtimes/core/src/api/schema/cookie.rs:24

  • Add unit tests covering percent-encoded cookie parsing to verify that reserved characters like ; and % round-trip correctly.
for c in cookie::Cookie::split_parse_encoded(raw).flatten() {

@fredr
Copy link
Member Author

fredr commented May 28, 2025

Lets not build in encoding into core. If a user want to encode/decode cookies they'll have to manage it themselves

@fredr fredr closed this May 28, 2025
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.

1 participant