Repository navigation
Fix empty cookie domain/path sent as empty string (partial fix for #1794) - #1955
Open
Allen (Allen5288) wants to merge 19 commits into
Open
Allen (Allen5288) wants to merge 19 commits into
Allen (Allen5288) wants to merge 19 commits into
Conversation
Added regression test for handling cookies without a Domain attribute to ensure proper value retention.
Added a regression test for handling cookies without a Domain attribute, ensuring the value remains intact and domain is set to None.
Allen (Allen5288)
requested review from
Gavin Aguiar (gavin-aguiar),
hallvictoria and
Varad Meru (vrdmr)
as code owners
November 22, 2026 00:50
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
Author
|
@microsoft-github-policy-service agree |
This branch has not been deployed
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
Partially fixes #1794
This is a partial fix for #1794. It fixes the spurious empty
domain=(andpath=) half of the issue: when a cookie has no Domain (or Path) attribute, the worker was sending an empty string to the Functions Host, which rendered it as an emptydomain=attribute on theSet-Cookieheader. Unset domain/path are now sent as null instead of an empty string, so the Host leaves the attribute off.This does not fix the
%2FURL-encoding of the cookie value reported in #1794 (for example,test=hello//worldarriving astest=hello%2F%2Fworld). That encoding happens in the Functions Host: ASP.NET CoreResponse.Cookies.AppendappliesUri.EscapeDataStringto the value. That half needs a follow-up change inAzure/azure-functions-host(stop routing worker cookies throughResponse.Cookies.Append, or write theSet-Cookieheader directly).Changes
workers/azure_functions_worker/bindings/datumdef.py,runtimes/v1/azure_functions_runtime_v1/bindings/datumdef.pyandruntimes/v2/azure_functions_runtime/bindings/datumdef.py:parse_to_rpc_http_cookie_listnow sendscookie_entity['domain'] or None/cookie_entity['path'] or None, matching the existingto_nullable_doubleprecedent (empty string →None).workers/r2p2/bridge/bridge.py:_flatten_cookiesnow emits'domain': morsel['domain'] or None/'path': morsel['path'] or None(wasor ''), with the docstring updated.workers/r2p2/src/convert.rs: newoptional_nullable_string()helper (None/empty →None, otherwiseSome(NullableString));http_cookies_from_listuses it for domain/path, and the existing test now asserts domain/path areNone.test_parse_to_rpc_http_cookie_list_no_domainin the worker, v1 and v2 test suites; newtest_flatten_cookies_issue_1794_value_preserved_and_domain_absentin the r2p2 bridge tests; and a new Rust testhttp_output_cookie_value_with_slashes_is_preserved_and_domain_absent. All useSimpleCookie('test="hello//world"; Path=/; SameSite=lax')and assert the value is preserved and domain is absent/None.Testing
test_datumdef.py+test_nullable_converters.py), 32 v2 tests (same).cargo testbefore merge.Pull Request Checklist
Host-Worker Contract
RpcHttpCookie.domain/pathchange from an empty string to null when the attribute is unset. The proxy worker change is inruntimes/v1andruntimes/v2.Worker Execution Logic
If yes, please answer the following:
Python Version Coverage
Programming Model Compatibility (proxy_worker and r2p2)