added get_cookie() and get_cookie_i() template functions to rustformation#14385
Merged
davidjumani merged 3 commits intoJul 11, 2026
Merged
Conversation
…tion Signed-off-by: Andy Fong <[email protected]>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR extends the Rust-based transformation (rustformation/minijinja) pipeline to support reading cookie values from the incoming request via new template functions, and updates the underlying header representation to preserve multi-value headers.
Changes:
- Added
get_cookie()(case-sensitive) andget_cookie_i()(case-insensitive) template functions, with per-transform feature flags to pre-parse cookies once per request. - Switched Envoy header materialization from
HashMap<String, String>toHashMap<String, Vec<String>>to preserve repeated headers, and added cookie parsing helpers inenvoy-helpers. - Added new E2E transformation manifests and suite test cases covering cookie extraction behavior.
Reviewed changes
Copilot reviewed 8 out of 9 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| test/e2e/features/transformation/testdata/transform-for-get-cookie.yaml | Adds E2E manifest exercising get_cookie() with case-sensitive cookie lookups and missing-cookie behavior. |
| test/e2e/features/transformation/testdata/transform-for-get-cookie-i.yaml | Adds E2E manifest exercising get_cookie_i() case-insensitive cookie lookups and missing-cookie behavior. |
| test/e2e/features/transformation/suite.go | Registers new manifests and adds E2E assertions for cookie-derived headers. |
| internal/envoy_modules/lib/transformation/src/jinja.rs | Implements get_cookie() / get_cookie_i(), adds transform-level flags, and wires cookie maps into the minijinja state. |
| internal/envoy_modules/lib/transformation/Cargo.toml | Adds envoy-helpers dependency for shared HTTP/header/cookie utilities. |
| internal/envoy_modules/lib/envoy-helpers/src/http.rs | Preserves multi-value headers, adds get_header, and introduces cookie parsing helpers. |
| internal/envoy_modules/lib/envoy-helpers/src/http/tests.rs | Adds unit tests for cookie parsing and multi-value header collection. |
| internal/envoy_modules/filters/rustformation/src/lib.rs | Threads the new header map type and transform flags through the Envoy filter. |
| internal/envoy_modules/Cargo.lock | Updates lockfile for the new crate dependency. |
Comment on lines
+101
to
+110
| for cookie_str in cookie_values { | ||
| for (name, value) in parse_cookie_string(cookie_str) { | ||
| if let Some(ref mut m) = insensitive_m { | ||
| m.entry(name.to_lowercase()).or_insert_with(|| value.clone()); | ||
| } | ||
| if let Some(ref mut m) = exact_m { | ||
| m.entry(name).or_insert(value); | ||
| } | ||
| } | ||
| } |
Comment on lines
+188
to
+190
|
|
||
| #[test] | ||
| fn test_parse_cookie_maps_both_none_when_neither_needed() { |
Signed-off-by: Andy Fong <[email protected]>
davidjumani
approved these changes
Jul 10, 2026
github-merge-queue
Bot
removed this pull request from the merge queue due to failed status checks
Jul 10, 2026
github-merge-queue
Bot
removed this pull request from the merge queue due to failed status checks
Jul 10, 2026
github-merge-queue
Bot
removed this pull request from the merge queue due to failed status checks
Jul 10, 2026
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
Added first class support to get cookie values from client requests for transformation
Change Type
/kind feature
Changelog