Skip to content

set cookie origin in RequestAddCookies when a Cookie header is present - #924

Open
Hsnmohd wants to merge 1 commit into
apache:masterfrom
Hsnmohd:cookie-origin-stale-context
Open

Hsnmohd wants to merge 1 commit into
apache:masterfrom
Hsnmohd:cookie-origin-stale-context

Conversation

@Hsnmohd

@Hsnmohd Hsnmohd commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

store the cookie spec and origin before RequestAddCookies short-circuits on a caller-set Cookie header, otherwise ResponseProcessCookies validates the response's Set-Cookie against the origin left in the context by the previous exchange and a cookie set by one host is stored and replayed under another host's domain.

@ok2c ok2c self-assigned this Nov 3, 2026
// against the origin of another request
clientContext.setCookieSpec(null);
clientContext.setCookieOrigin(null);

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.

@Hsnmohd Very good catch.

However, I would rather keep the cookie spec and cookie origin null in case the Cookie header has manually added and not generated by RequestAddCookies, and let ResponseProcessCookies take no action. Would you agree to that?

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.

2 participants