Intent to Implement and Ship: Http cookie prefix

454 views
Skip to first unread message

Yoav Weiss (@Shopify)

unread,
Jun 19, 2025, 9:48:37 AMJun 19
to blink-dev

Contact emails

yoav...@chromium.org

Explainer


This will add the cookie name prefix `__Http-`.
Cookies that would start with that prefix would only be able to be set using the `Set-Cookie` HTTP header and will have to have an `httpOnly` attribute.

Adding that prefix to the cookie name will give site operators the guarantee that any such cookie they see was set by their server, and not be a malicious/compromised script.

There are still ongoing discussions about the exact spelling of a combination of this prefix with the `__Host-` prefix. I'd like this intent to cover both, but I'm not planning to ship the `__HostHttp` variant until the dust settles on the desired spelling.

Specification

https://github.com/httpwg/http-extensions/pull/3110

Summary

There are cases where it's important to distinguish on the server side between cookies that were set by the server and ones that were set by the client. One such case is cookies that are normally always set by the server, unless some unexpected code (an XSS exploit, a malicious extension, a commit from a confused developer, etc.) happens to set them on the client. This proposal adds a signal that would enable servers to make such a distinction. More specifically, it defines the __Http and __HostHttp prefixes, that make sure that a cookie is not set on the client side using script.



Blink component

Internals>Network>Cookies

TAG review

None, as the TAG doesn't typically review HTTP features.

TAG review status

Not applicable

Risks



Interoperability and Compatibility

No particular compat issues, as we don't expect this prefix to already exist in the wild.

In terms of interop, Mozilla and Apple folks are heavily involved in the discussions and haven't raised any concerns.



Gecko: No signal (https://github.com/mozilla/standards-positions/issues/1256)

WebKit: No signal (https://github.com/WebKit/standards-positions/issues/518)

Web developers: Positive (https://lists.w3.org/Archives/Public/ietf-http-wg/2025JanMar/0146.html)

Other signals:

WebView application risks

Does this intent deprecate or change behavior of existing APIs, such that it has potentially high risk for Android WebView-based applications?

None



Debuggability

None



Will this feature be supported on all six Blink platforms (Windows, Mac, Linux, ChromeOS, Android, and Android WebView)?

Yes

Is this feature fully tested by web-platform-tests?

Yes
https://chromium-review.googlesource.com/c/chromium/src/+/6638647/15/third_party/blink/web_tests/external/wpt/cookies/prefix/__Http.https.html
https://chromium-review.googlesource.com/c/chromium/src/+/6650996/2/third_party/blink/web_tests/external/wpt/cookies/prefix/__HostHttp.https.html

Flag name on about://flags

None

Finch feature name

PrefixCookieHttp, PrefixCookieHostHttp

Rollout plan

Will ship enabled for all users

Requires code in //chrome?

False

Tracking bug

https://issues.chromium.org/issues/426096760

Estimated milestones

Shipping on desktop140
Shipping on Android140
Shipping on WebView140


Anticipated spec changes

Open questions about a feature may be a source of future web compat or interop issues. Please list open issues (e.g. links to known github issues in the project for the feature specification) whose resolution may introduce web compat/interop risk (e.g., changing to naming or structure of the API in a non-backward-compatible way).

None

Link to entry on the Chrome Platform Status

https://chromestatus.com/feature/5170139586363392?gate=5174068239925248

This intent message was generated by Chrome Platform Status.

Vladimir Levin

unread,
Jun 24, 2025, 10:18:22 PMJun 24
to blink-dev, Yoav Weiss


On Thursday, June 19, 2025 at 9:48:37 AM UTC-4 Yoav Weiss wrote:
Contact emailsyoav...@chromium.org


Explainer
This will add the cookie name prefix `__Http-`.
Cookies that would start with that prefix would only be able to be set using the `Set-Cookie` HTTP header and will have to have an `httpOnly` attribute.

Adding that prefix to the cookie name will give site operators the guarantee that any such cookie they see was set by their server, and not be a malicious/compromised script.

There are still ongoing discussions about the exact spelling of a combination of this prefix with the `__Host-` prefix. I'd like this intent to cover both, but I'm not planning to ship the `__HostHttp` variant until the dust settles on the desired spelling.



Summary

There are cases where it's important to distinguish on the server side between cookies that were set by the server and ones that were set by the client. One such case is cookies that are normally always set by the server, unless some unexpected code (an XSS exploit, a malicious extension, a commit from a confused developer, etc.) happens to set them on the client. This proposal adds a signal that would enable servers to make such a distinction. More specifically, it defines the __Http and __HostHttp prefixes, that make sure that a cookie is not set on the client side using script.



What is the behavior if one attempts to set an `__Http`-prefixed cookie from script with this feature? Does it silently fail, or is there an error that is thrown?
 

Blink componentInternals>Network>Cookies

TAG reviewNone, as the TAG doesn't typically review HTTP features.

TAG review statusNot applicable


Risks


Interoperability and Compatibility

No particular compat issues, as we don't expect this prefix to already exist in the wild.

In terms of interop, Mozilla and Apple folks are heavily involved in the discussions and haven't raised any concerns.


I agree that the chance of there being __Http named cookies is very low, but I've been wrong about things like this before :) Do you have any metrics/code searches/etc to validate that this is safe from compat perspective?
 


Gecko: No signal (https://github.com/mozilla/standards-positions/issues/1256)

WebKit: No signal (https://github.com/WebKit/standards-positions/issues/518)

Web developers: Positive (https://lists.w3.org/Archives/Public/ietf-http-wg/2025JanMar/0146.html)

Other signals:

WebView application risks

Does this intent deprecate or change behavior of existing APIs, such that it has potentially high risk for Android WebView-based applications?

None



Debuggability

None



Will this feature be supported on all six Blink platforms (Windows, Mac, Linux, ChromeOS, Android, and Android WebView)?Yes

Is this feature fully tested by web-platform-tests?Yes
https://chromium-review.googlesource.com/c/chromium/src/+/6638647/15/third_party/blink/web_tests/external/wpt/cookies/prefix/__Http.https.html
Rollout planWill ship enabled for all users


Requires code in //chrome?False

Tracking bughttps://issues.chromium.org/issues/426096760

Estimated milestonesShipping on desktop140Shipping on Android140Shipping on WebView140

Anticipated spec changes

Open questions about a feature may be a source of future web compat or interop issues. Please list open issues (e.g. links to known github issues in the project for the feature specification) whose resolution may introduce web compat/interop risk (e.g., changing to naming or structure of the API in a non-backward-compatible way).

None

Yoav Weiss (@Shopify)

unread,
Jun 25, 2025, 1:01:02 AMJun 25
to Vladimir Levin, blink-dev
On Wed, Jun 25, 2025 at 4:18 AM Vladimir Levin <vmp...@chromium.org> wrote:


On Thursday, June 19, 2025 at 9:48:37 AM UTC-4 Yoav Weiss wrote:
Contact emailsyoav...@chromium.org

Explainer
This will add the cookie name prefix `__Http-`.
Cookies that would start with that prefix would only be able to be set using the `Set-Cookie` HTTP header and will have to have an `httpOnly` attribute.

Adding that prefix to the cookie name will give site operators the guarantee that any such cookie they see was set by their server, and not be a malicious/compromised script.

There are still ongoing discussions about the exact spelling of a combination of this prefix with the `__Host-` prefix. I'd like this intent to cover both, but I'm not planning to ship the `__HostHttp` variant until the dust settles on the desired spelling.

Specificationhttps://github.com/httpwg/http-extensions/pull/3110

Summary

There are cases where it's important to distinguish on the server side between cookies that were set by the server and ones that were set by the client. One such case is cookies that are normally always set by the server, unless some unexpected code (an XSS exploit, a malicious extension, a commit from a confused developer, etc.) happens to set them on the client. This proposal adds a signal that would enable servers to make such a distinction. More specifically, it defines the __Http and __HostHttp prefixes, that make sure that a cookie is not set on the client side using script.



What is the behavior if one attempts to set an `__Http`-prefixed cookie from script with this feature? Does it silently fail, or is there an error that is thrown?

Similar to existing prefixes, when setting a cookie using `document.cookie`, the only way to know it failed is observing (on the server) it is not present in relevant requests.
Setting such a cookie through the CookieStore API results in a Promise rejection.

 

Blink componentInternals>Network>Cookies

TAG reviewNone, as the TAG doesn't typically review HTTP features.

TAG review statusNot applicable

Risks


Interoperability and Compatibility

No particular compat issues, as we don't expect this prefix to already exist in the wild.

In terms of interop, Mozilla and Apple folks are heavily involved in the discussions and haven't raised any concerns.


I agree that the chance of there being __Http named cookies is very low, but I've been wrong about things like this before :) Do you have any metrics/code searches/etc to validate that this is safe from compat perspective?

I don't have any metrics, and GH search seems to ignore the _ and - parts when searching for `__Http-`..
I agree there's a non-zero change that someone added such a prefix to a cookie (without it being httpOnly), but I think having a Finch flag to be able to turn the feature off in case that turns out to be the case is sufficient.

Mike Taylor

unread,
Jun 25, 2025, 11:28:27 AMJun 25
to Yoav Weiss (@Shopify), blink-dev, Vladimir Levin

LGTM1, but conditioned on the spec work landing before shipping anything.

--
You received this message because you are subscribed to the Google Groups "blink-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+...@chromium.org.
To view this discussion visit https://groups.google.com/a/chromium.org/d/msgid/blink-dev/CAOmohS%2BRtDnZ9x5izwv8_4xUBOxZrzBd2L8Eh_Cn58dPvd9Ayw%40mail.gmail.com.

Vladimir Levin

unread,
Jun 25, 2025, 12:59:40 PMJun 25
to blink-dev, Mike Taylor, blink-dev, Vladimir Levin, Yoav Weiss
LGTM2, same conditions

To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+unsubscribe@chromium.org.

Chris Harrelson

unread,
Jun 25, 2025, 1:07:20 PMJun 25
to Vladimir Levin, blink-dev, Mike Taylor, Yoav Weiss
LGTM3

LGTM2, same conditions

To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+...@chromium.org.

--
You received this message because you are subscribed to the Google Groups "blink-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+...@chromium.org.
To view this discussion visit https://groups.google.com/a/chromium.org/d/msgid/blink-dev/5d068f26-f995-4263-b5aa-43bb6fa48065n%40chromium.org.

PhistucK

unread,
Jun 25, 2025, 1:38:12 PMJun 25
to Yoav Weiss (@Shopify), Vladimir Levin, blink-dev
Have you tried searching GitHub with a regular expression? Seems not to ignore anything. :)


PhistucK


--

Yoav Weiss (@Shopify)

unread,
Jun 25, 2025, 2:57:22 PMJun 25
to PhistucK, Vladimir Levin, blink-dev
On Wed, Jun 25, 2025 at 7:37 PM PhistucK <phis...@gmail.com> wrote:
Have you tried searching GitHub with a regular expression? Seems not to ignore anything. :)

Thanks!! Going over the results, it seems like there's nothing there related to cookies (other than the WPT that testing this very feature).

PhistucK

unread,
Jun 25, 2025, 2:59:56 PMJun 25
to Yoav Weiss (@Shopify), Vladimir Levin, blink-dev
I asked Copilot there and it went over the results itself and found nothing, too. Handy (even if not 100% reliable). :)


PhistucK

Yoav Weiss (@Shopify)

unread,
Jun 30, 2025, 10:36:30 AMJun 30
to PhistucK, Vladimir Levin, blink-dev
Just to close the loop, the PR has landed, and the feature is now enabled by default. Thanks all!!

Yoav Weiss (@Shopify)

unread,
Aug 11, 2025, 5:27:30 AMAug 11
to PhistucK, Vladimir Levin, blink-dev
Reviving this thread, as while talking to folks about deploying this I realized we should name `__HostHttp-` to be `__Host-Http-`.
That makes sure that deploying __Host-Http- prefixed cookies maintains host semantics in non-supporting browsers and makes for a progressive enhancement. (rather than requiring complex server side logic to determine the cookie name based on browser and version)

I discussed the rename with WebKit, Mozilla and Chrome engineers on the #cookies matrix channel and everyone seemed on board with it.
I also filed spec PRs as well as WPT.

Since this never hit stable (it landed in 140, which is still in Beta), I suggest to:
* Turn off the feature flag in 140 (either in code with back-merges or on the server-side if Google folks are interested in helping with that).
* Rename the prefix in 141 and enable the flag there.

That would mean that the __Http- prefix would ship in 140 and __HostHttp- ships in 141, but I think that's perfectly fine.

What do y'all think?

P.S. Another thing that seems important for ease of deployment is that supporting browsers would apply the prefix rules to cookies already in their stores when they are upgraded.
I'm planning to change Chromium's implementation to support that, but that doesn't seem extremely web-exposed. Let me know if you think otherwise.

Mike Taylor

unread,
Aug 20, 2025, 10:36:21 AMAug 20
to Yoav Weiss (@Shopify), PhistucK, Vladimir Levin, blink-dev

On 8/11/25 5:27 a.m., Yoav Weiss (@Shopify) wrote:

Reviving this thread, as while talking to folks about deploying this I realized we should name `__HostHttp-` to be `__Host-Http-`.
That makes sure that deploying __Host-Http- prefixed cookies maintains host semantics in non-supporting browsers and makes for a progressive enhancement. (rather than requiring complex server side logic to determine the cookie name based on browser and version)

I discussed the rename with WebKit, Mozilla and Chrome engineers on the #cookies matrix channel and everyone seemed on board with it.
I also filed spec PRs as well as WPT.

Since this never hit stable (it landed in 140, which is still in Beta), I suggest to:
* Turn off the feature flag in 140 (either in code with back-merges or on the server-side if Google folks are interested in helping with that).
* Rename the prefix in 141 and enable the flag there.

That would mean that the __Http- prefix would ship in 140 and __HostHttp- ships in 141, but I think that's perfectly fine.

What do y'all think?

Makes sense to me!


P.S. Another thing that seems important for ease of deployment is that supporting browsers would apply the prefix rules to cookies already in their stores when they are upgraded.
I'm planning to change Chromium's implementation to support that, but that doesn't seem extremely web-exposed. Let me know if you think otherwise.
Will you make sure the RFC is updated to reflect this change?

Yoav Weiss (@Shopify)

unread,
Aug 20, 2025, 10:42:28 AMAug 20
to Mike Taylor, PhistucK, Vladimir Levin, blink-dev
On Wed, Aug 20, 2025 at 4:35 PM Mike Taylor <mike...@chromium.org> wrote:

On 8/11/25 5:27 a.m., Yoav Weiss (@Shopify) wrote:

Reviving this thread, as while talking to folks about deploying this I realized we should name `__HostHttp-` to be `__Host-Http-`.
That makes sure that deploying __Host-Http- prefixed cookies maintains host semantics in non-supporting browsers and makes for a progressive enhancement. (rather than requiring complex server side logic to determine the cookie name based on browser and version)

I discussed the rename with WebKit, Mozilla and Chrome engineers on the #cookies matrix channel and everyone seemed on board with it.
I also filed spec PRs as well as WPT.

Since this never hit stable (it landed in 140, which is still in Beta), I suggest to:
* Turn off the feature flag in 140 (either in code with back-merges or on the server-side if Google folks are interested in helping with that).
* Rename the prefix in 141 and enable the flag there.

That would mean that the __Http- prefix would ship in 140 and __HostHttp- ships in 141, but I think that's perfectly fine.

What do y'all think?

Makes sense to me!


P.S. Another thing that seems important for ease of deployment is that supporting browsers would apply the prefix rules to cookies already in their stores when they are upgraded.
I'm planning to change Chromium's implementation to support that, but that doesn't seem extremely web-exposed. Let me know if you think otherwise.
Will you make sure the RFC is updated to reflect this change?

There's an ongoing discussion at https://github.com/httpwg/http-extensions/pull/3156 

Mike Taylor

unread,
Aug 20, 2025, 10:44:20 AMAug 20
to Yoav Weiss (@Shopify), PhistucK, Vladimir Levin, blink-dev

On 8/20/25 10:42 a.m., Yoav Weiss (@Shopify) wrote:



On Wed, Aug 20, 2025 at 4:35 PM Mike Taylor <mike...@chromium.org> wrote:

On 8/11/25 5:27 a.m., Yoav Weiss (@Shopify) wrote:

Reviving this thread, as while talking to folks about deploying this I realized we should name `__HostHttp-` to be `__Host-Http-`.
That makes sure that deploying __Host-Http- prefixed cookies maintains host semantics in non-supporting browsers and makes for a progressive enhancement. (rather than requiring complex server side logic to determine the cookie name based on browser and version)

I discussed the rename with WebKit, Mozilla and Chrome engineers on the #cookies matrix channel and everyone seemed on board with it.
I also filed spec PRs as well as WPT.

Since this never hit stable (it landed in 140, which is still in Beta), I suggest to:
* Turn off the feature flag in 140 (either in code with back-merges or on the server-side if Google folks are interested in helping with that).
* Rename the prefix in 141 and enable the flag there.

That would mean that the __Http- prefix would ship in 140 and __HostHttp- ships in 141, but I think that's perfectly fine.

What do y'all think?

Makes sense to me!


P.S. Another thing that seems important for ease of deployment is that supporting browsers would apply the prefix rules to cookies already in their stores when they are upgraded.
I'm planning to change Chromium's implementation to support that, but that doesn't seem extremely web-exposed. Let me know if you think otherwise.
Will you make sure the RFC is updated to reflect this change?

There's an ongoing discussion at https://github.com/httpwg/http-extensions/pull/3156 
Perfect, thanks.

Yoav Weiss (@Shopify)

unread,
Aug 25, 2025, 5:05:08 AM (12 days ago) Aug 25
to Mike Taylor, PhistucK, Vladimir Levin, blink-dev
Just to close the loop on this, the rename landed and was back-merged into 140. No flags required.
Mozilla similarly renamed their implementation.
Reply all
Reply to author
Forward
0 new messages