# [VOTE] Same Site Cookie RFC

- Thread: https://externals.io/message/100304
- Original archive: https://news-web.php.net/php.internals/100304
- Started by Frederik Bosch on 2017-08-25T21:19:53+00:00
- Messages: 44
- RFC: Same Site Cookie (Implemented (PHP 7.3)) — https://externals.io/rfc/same-site-cookie.md
- Page 1 of 2: messages 1 to 25 (25 per page, add `?page=N` to the URL)
- Next page: https://externals.io/message/100304.md?page=2
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · RFCs at https://externals.io/rfc.md · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #100304 — Frederik Bosch — 2017-08-25T21:19:53+00:00

URL: https://externals.io/message/100304#100304

LS,

Just now, I opened the RFC on implementing same site cookies in PHP, 
https://wiki.php.net/rfc/same-site-cookie, for voting.

It consists of two questions, depending on the implementation you would 
like to see of the feature. Both questions will affect the API of four 
core functions: setcookie, setrawcookie, session_set_cookie_params and 
session_get_cookie_params. The first three functions have a similar 
function signature. The first implementation suggestion is to add an 
additional argument to these three functions. The second implementation 
suggestion is to allow an array of options in which all the cookie 
options will be moved into. More details are to be found in the RFC.

Hopefully, the samesite cookie flag will become a feature of the PHP 
language through this RFC!

Kind regards,
Frederik Bosch

---

## #100305 — Dan Ackroyd — 2017-08-25T22:18:04+00:00

URL: https://externals.io/message/100304#100305 · In reply to: #100304

> LS,
>
> Just now, I opened the RFC on implementing same site cookies in PHP,
> https://wiki.php.net/rfc/same-site-cookie, for voting.

Please be explicit:

> Proposed PHP Version(s)
> next PHP 7.x


It's really late in the day for 7.2. Although people might still vote
for it, the RFC needs to be explicit about which version it is for.


cheers
Dan

---

## #100307 — Frederik Bosch — 2017-08-25T22:25:13+00:00

URL: https://externals.io/message/100304#100307 · In reply to: #100305

Hi Dan,

While I agree on your statement that it is late for 7.2, I believe the 
text is explicit enough. Since features for PHP 7.2 are frozen, 
according to the rules this should go for the version thereafter. 
However, if a release managers wants to pick up it and embed in 7.2, I 
am not going to protest. Things considered, I see no reason to change 
the sentence.

Best,
Frederik




> 
> > […]
> Please be explicit:
>
> > […]
>
> It's really late in the day for 7.2. Although people might still vote
> for it, the RFC needs to be explicit about which version it is for.
>
>
> cheers
> Dan

---

## #100309 — Sara Golemon — 2017-08-25T23:10:47+00:00

URL: https://externals.io/message/100304#100309 · In reply to: #100305

> 
> > […]
>
> Please be explicit:
>
> > […]
>
>
> It's really late in the day for 7.2. Although people might still vote
> for it, the RFC needs to be explicit about which version it is for.
>
>
In my opinion it's too late for 7.2 especially as it contains an ABI
break which at best will be annoying for the folks helping us test.
The primary vote should be about 7.3 and if this wants to land on 7.2
there should be a separate vote for that.

-Sara

---

## #100310 — Remi Collet — 2017-08-26T06:21:05+00:00

URL: https://externals.io/message/100304#100310 · In reply to: #100309

Le 26/08/2017 à 01:10, Sara Golemon a écrit :

> In my opinion it's too late for 7.2 especially as it contains an ABI
> break which at best will be annoying for the folks helping us test.
> The primary vote should be about 7.3 and if this wants to land on 7.2
> there should be a separate vote for that.

+1


BTW, choice 1 seems awfull but preserve BC

Perhaps choice 2 could be implemented in a BC way, allowing both proto

Ex for session_set_cookie_params

Parse arg 2 as an optional zval

if arg2 is an array
	if argc > 2 error
	else new proto, array of options
else	old proto


Remi.

---

## #100311 — Frederik Bosch — 2017-08-26T15:34:02+00:00

URL: https://externals.io/message/100304#100311 · In reply to: #100309

Hi Sara,

Thanks for clearing this. I have no intension to have it merged in 7.2 
so I updated the RFC to specifically mention it is for 7.3. If other 
people want to have it in 7.2, they can start a new RFC to make that happen.

Best,
Frederik




> 
> > […]
> In my opinion it's too late for 7.2 especially as it contains an ABI
> break which at best will be annoying for the folks helping us test.
> The primary vote should be about 7.3 and if this wants to land on 7.2
> there should be a separate vote for that.
>
> -Sara

---

## #100312 — Lars Strojny — 2017-08-27T09:54:55+00:00

URL: https://externals.io/message/100304#100312 · In reply to: #100311

Hi Sara, hi Frederik,

Sounds good! Let's vote in getting it in first and then we can have a 2nd RFC (and vote) if it should land in 7.2

cu,
Lars

Sent from my electronic toy

> 
> 
> Hi Sara,
> 
> Thanks for clearing this. I have no intension to have it merged in 7.2 so I updated the RFC to specifically mention it is for 7.3. If other people want to have it in 7.2, they can start a new RFC to make that happen.
> 
> Best,
> Frederik
> 
> 
> 
> > […]

---

## #100313 — Andrea Faulds — 2017-08-28T09:24:21+00:00

URL: https://externals.io/message/100304#100313 · In reply to: #100304

Hi,

Frederik Bosch wrote:
> LS,
>
> Just now, I opened the RFC on implementing same site cookies in PHP,
> https://wiki.php.net/rfc/same-site-cookie, for voting.


Correct me if I'm wrong, but wasn't the RFC only put to internals a week 
ago? That's not a long enough discussion period before opening voting, 
https://wiki.php.net/rfc/howto says it should be at least 2 weeks.

Regards.
-- 
Andrea Faulds
https://ajf.me/

---

## #100314 — Theodore Brown — 2017-08-28T15:01:40+00:00

URL: https://externals.io/message/100304#100314

> Correct me if I'm wrong, but wasn't the RFC only put to internals a week 
> ago? That's not a long enough discussion period before opening voting, 
> https://wiki.php.net/rfc/howto says it should be at least 2 weeks.

The current RFC was put to internals on July 24, over a month ago
(in the "[RFC] samesite cookie implementation" thread).

Theodore Brown

---

## #100315 — Sara Golemon — 2017-08-28T15:04:56+00:00

URL: https://externals.io/message/100304#100315 · In reply to: #100312

> Sounds good! Let's vote in getting it in first and then we can have a 2nd RFC (and vote) if it should land in 7.2
>
Mmmm, not quite.  IF you want to aim for 7.2, do it now in the same
vote.  Back porting is sub-optimal and there's not a rush to land it
on 7.3.  The time sensitive part is 7.2.

FTR, I'll be voting "No" on a 7.2, and I've already submitted my yes
vote for 7.3 (options array variant).

-Sara

---

## #100316 — Andrey Andreev — 2017-08-28T15:23:32+00:00

URL: https://externals.io/message/100304#100316 · In reply to: #100315

Hi,


> 
> > […]
> Mmmm, not quite.  IF you want to aim for 7.2, do it now in the same
> vote.  Back porting is sub-optimal and there's not a rush to land it
> on 7.3.  The time sensitive part is 7.2.
>

I second this.

In fact, there was a competing idea/RFC when the discussion started,
but the author of this one insisted that there's no time to wait for
that. To me, it doesn't make sense to rush this (compared to
alternative ideas) if it doesn't get into 7.2.

Cheers,
Andrey.

---

## #100317 — Frederik Bosch | Genkgo — 2017-08-28T15:34:52+00:00

URL: https://externals.io/message/100304#100317 · In reply to: #100316

Hi Andrey,

While I agree on your statement that back-porting is suboptimal, I do 
not agree on the fact that I said that there was no time to wait. I 
submitted the RFC, awaited the opinions, changed the document according 
to the different viewpoints and I link to the other RFC from this RFC. I 
do not want to 'push' this through. I think we know the opinions, so it 
is time to vote. If both suggestions from this RFC don't make, then 
people can go for other solutions.

Best,
Frederik




> Hi,
>
> 
> > […]
> I second this.
>
> In fact, there was a competing idea/RFC when the discussion started,
> but the author of this one insisted that there's no time to wait for
> that. To me, it doesn't make sense to rush this (compared to
> alternative ideas) if it doesn't get into 7.2.
>
> Cheers,
> Andrey.

---

## #100318 — Andrey Andreev — 2017-08-28T15:58:34+00:00

URL: https://externals.io/message/100304#100318 · In reply to: #100317

Hi Frederik,

On Mon, Aug 28, 2017 at 6:34 PM, Frederik Bosch | Genkgo
<f.bosch@genkgo.nl> wrote:
> Hi Andrey,
>
> While I agree on your statement that back-porting is suboptimal, I do not
> agree on the fact that I said that there was no time to wait. I submitted
> the RFC, awaited the opinions, changed the document according to the
> different viewpoints and I link to the other RFC from this RFC. I do not
> want to 'push' this through. I think we know the opinions, so it is time to
> vote. If both suggestions from this RFC don't make, then people can go for
> other solutions.
>

You did wait for, and adjust according to suggestions, I'm not questioning that.

I was referring to this message: https://externals.io/message/99884#99893

If you want this to land in 7.2 (i.e. not "take a while before we see
samesite cookie implemented"), then there really is no time to wait.
I'm not being negative here ... I'm using this as an argument to make
the vote for 7.2 now.
Otherwise, we have an entire year to polish all the details in time for 7.3.

Cheers,
Andrey.

---

## #100319 — Frederik Bosch | Genkgo — 2017-08-28T16:10:29+00:00

URL: https://externals.io/message/100304#100319 · In reply to: #100318

Hi Andrey,

Little misunderstanding then. I agree we can better have this PHP 7.3 
and take some time for it. Current votes also suggest that we should go 
for the array argument implementation. Since there is only a PR for the 
extra argument implementation, it will also take time to have the PR for 
the array argument implementation ready. Taken that into account, we 
should not want this in 7.2.

Best,
Frederik




> Hi Frederik,
>
> On Mon, Aug 28, 2017 at 6:34 PM, Frederik Bosch | Genkgo
> <f.bosch@genkgo.nl> wrote:
> > […]
> You did wait for, and adjust according to suggestions, I'm not questioning that.
>
> I was referring to this message: https://externals.io/message/99884#99893
>
> If you want this to land in 7.2 (i.e. not "take a while before we see
> samesite cookie implemented"), then there really is no time to wait.
> I'm not being negative here ... I'm using this as an argument to make
> the vote for 7.2 now.
> Otherwise, we have an entire year to polish all the details in time for 7.3.
>
> Cheers,
> Andrey.

-- 


    Frederik Bosch


      Partner

Genkgo logo
Mail: f.bosch@genkgo.nl <mailto:f.bosch@genkgo.nl>
Web: support.genkgo.com <https://support.genkgo.com>

Entrada 123
Amsterdam
+31 208 943 931

Genkgo B.V. staat geregistreerd bij de Kamer van Koophandel onder nummer 
56501153

---

## #100320 — Sara Golemon — 2017-08-28T16:20:09+00:00

URL: https://externals.io/message/100304#100320 · In reply to: #100319

On Mon, Aug 28, 2017 at 12:10 PM, Frederik Bosch | Genkgo <f.bosch@genkgo.nl
> wrote:

> Little misunderstanding then. I agree we can better have this PHP 7.3 and
> take some time for it. Current votes also suggest that we should go for the
> array argument implementation. Since there is only a PR for the extra
> argument implementation, it will also take time to have the PR for the
> array argument implementation ready. Taken that into account, we should not
> want this in 7.2.
>
Indeed, yes. Assuming the votes continue on this sharp lean towards the
array option, we should just forget all notions of trying to sneak this
into 7.2.

Direct calls in 7.2 and earlier can easily fall back on calling
header('Set-Cookie: ...'); manually, while sessions support is slightly
more complex, but still doable from userspace.  I expect if need is deemed
high for this, a drop-in composer package can do 90% of the work
automatically.

-Sara

---

## #100321 — Stanislav Malyshev — 2017-08-28T19:06:27+00:00

URL: https://externals.io/message/100304#100321 · In reply to: #100304

Hi!

> additional argument to these three functions. The second implementation
> suggestion is to allow an array of options in which all the cookie
> options will be moved into. More details are to be found in the RFC.

Something not clear to me on the second one - why lifetime/expiration is
a separate parameter while all others are part of $options?

-- 
Stas Malyshev
smalyshev@gmail.com

---

## #100322 — Frederik Bosch — 2017-08-28T19:53:06+00:00

URL: https://externals.io/message/100304#100322 · In reply to: #100321

Hi Stanislav,

My reasoning for this is as follows.

1. The session_set_cookie_params function requires a lifetime parameter 
at the moment.

2. To enforce that lifetime stays required I did not want to make it 
required within the optional array. That would make that optional array 
not optional anymore, and even have a required key. I don't think that 
is a good idea.

3. To prevent that the array of options is different between the three 
functions (session_set_cookie_params, setcookie, setrawcookie), I chose 
to exclude lifetime from the array of options and include it in the list 
of arguments.

Hence, I chose a consistent and logical API over the three functions 
together rather than having logical ones per function. Hope it makes sense.

Best,
Frederik





> Hi!
>
> > […]
> Something not clear to me on the second one - why lifetime/expiration is
> a separate parameter while all others are part of $options?

---

## #100323 — Lars Strojny — 2017-08-28T21:16:01+00:00

URL: https://externals.io/message/100304#100323 · In reply to: #100320

Hi Sara, hi Frederik,

 

Thinking more about this I came to change my vote (and for that reason I’ll take back the suggestion to include it into 7.2):

 
The array API is the better API and allows for healthier future growth so we should pursue that option 
There is a (very ugly) workaround to set a same site policy by misusing the “session.cookie_path” or “session.cookie_domain” setting (e.g. set it to “/; SameSite=Strict”, you are welcome, Internet).
 

cu,

Lars

 

 



 



Little misunderstanding then. I agree we can better have this PHP 7.3 and take some time for it. Current votes also suggest that we should go for the array argument implementation. Since there is only a PR for the extra argument implementation, it will also take time to have the PR for the array argument implementation ready. Taken that into account, we should not want this in 7.2.

Indeed, yes. Assuming the votes continue on this sharp lean towards the array option, we should just forget all notions of trying to sneak this into 7.2.

 

Direct calls in 7.2 and earlier can easily fall back on calling header('Set-Cookie: ...'); manually, while sessions support is slightly more complex, but still doable from userspace.  I expect if need is deemed high for this, a drop-in composer package can do 90% of the work automatically.

-Sara

---

## #100325 — Andrea Faulds — 2017-08-29T11:33:18+00:00

URL: https://externals.io/message/100304#100325 · In reply to: #100314

Hi Theodore,

Theodore Brown wrote:
> 
>
> > […]
>
> The current RFC was put to internals on July 24, over a month ago
> (in the "[RFC] samesite cookie implementation" thread).

Ah, you're right of course, my apologies to everyone. I was quite tired 
yesterday and I think I misread “2017-07-17” as “2017-08-17”.

-- 
Andrea Faulds
https://ajf.me/

---

## #100839 — Niklas Keller — 2017-10-08T07:46:25+00:00

URL: https://externals.io/message/100304#100839 · In reply to: #100304

There are no voting dates in the RFC, but it's open for over a month now.

I guess it can be closed.

Regards, Niklas

2017-08-25 23:19 GMT+02:00 Frederik Bosch <f.bosch@genkgo.nl>:

> LS,
>
> Just now, I opened the RFC on implementing same site cookies in PHP,
> https://wiki.php.net/rfc/same-site-cookie, for voting.
>
> It consists of two questions, depending on the implementation you would
> like to see of the feature. Both questions will affect the API of four core
> functions: setcookie, setrawcookie, session_set_cookie_params and
> session_get_cookie_params. The first three functions have a similar
> function signature. The first implementation suggestion is to add an
> additional argument to these three functions. The second implementation
> suggestion is to allow an array of options in which all the cookie options
> will be moved into. More details are to be found in the RFC.
>
> Hopefully, the samesite cookie flag will become a feature of the PHP
> language through this RFC!
>
> Kind regards,
> Frederik Bosch

---

## #100845 — Frederik Bosch — 2017-10-10T06:00:00+00:00

URL: https://externals.io/message/100304#100845 · In reply to: #100839

Hi Niklas,

Sorry for the delay. I have my mind on totally different things these 
days. Closed the voting and moved it to accepted. Thanks everyone for 
voting! Now, let's implement this RFC!

Best regards,
Frederik




> There are no voting dates in the RFC, but it's open for over a month now.
>
> I guess it can be closed.
>
> Regards, Niklas
>
> 2017-08-25 23:19 GMT+02:00 Frederik Bosch <f.bosch@genkgo.nl 
> <mailto:f.bosch@genkgo.nl>>:
>
>     LS,
>
>     Just now, I opened the RFC on implementing same site cookies in
>     PHP, https://wiki.php.net/rfc/same-site-cookie
>     <https://wiki.php.net/rfc/same-site-cookie>, for voting.
>
>     It consists of two questions, depending on the implementation you
>     would like to see of the feature. Both questions will affect the
>     API of four core functions: setcookie, setrawcookie,
>     session_set_cookie_params and session_get_cookie_params. The first
>     three functions have a similar function signature. The first
>     implementation suggestion is to add an additional argument to
>     these three functions. The second implementation suggestion is to
>     allow an array of options in which all the cookie options will be
>     moved into. More details are to be found in the RFC.
>
>     Hopefully, the samesite cookie flag will become a feature of the
>     PHP language through this RFC!
>
>     Kind regards,
>     Frederik Bosch

---

## #102909 — mail@pmmaga.net — 2018-07-18T21:00:27+00:00

URL: https://externals.io/message/100304#102909 · In reply to: #100322

> Something not clear to me on the second one - why lifetime/expiration is
> a separate parameter while all others are part of $options?




> 1. The session_set_cookie_params function requires a lifetime parameter
> at the moment.
>
> 2. To enforce that lifetime stays required I did not want to make it
> required within the optional array. That would make that optional array
> not optional anymore, and even have a required key. I don't think that
> is a good idea.
>
> 3. To prevent that the array of options is different between the three
> functions (session_set_cookie_params, setcookie, setrawcookie), I chose
> to exclude lifetime from the array of options and include it in the list
> of arguments.
>
> Hence, I chose a consistent and logical API over the three functions
> together rather than having logical ones per function. Hope it makes sense.
>

Hi all,

This reasoning doesn't make a lot of sense to me.
With regards to session_set_cookie_params, I believe that the only reason
why lifetime is required in that function is because calling it without
parameters doesn't have a purpose.
With an array of options (which keeps the first parameter mandatory), there
is no strong reason to make one of them required. An empty array or an
array without any valid key would still error.
If this is acceptable for that function, all the other functions can have
all the options in the array as that keeps the array consistent across them.

With this being said, would anyone oppose an implementation where all the
options (including lifetime) are included in the array parameter?

About the implementation, the array of options is never really defined in
the RFC. If we assume that it is identical to the proposed output
of session_get_cookie_params, the name of the first key should be lifetime.
However, for setcookie and setrawcookie, the documented parameter name is
expire. Would there be any issue if we would assume lifetime for the 4
functions?

Regards,
Pedro

---

## #102937 — Christoph M. Becker — 2018-07-21T11:11:19+00:00

URL: https://externals.io/message/100304#102937 · In reply to: #102909

> 
> 
> > […]
> 
> 
> 
> > […]
> 
> This reasoning doesn't make a lot of sense to me.
> With regards to session_set_cookie_params, I believe that the only reason
> why lifetime is required in that function is because calling it without
> parameters doesn't have a purpose.
> With an array of options (which keeps the first parameter mandatory), there
> is no strong reason to make one of them required. An empty array or an
> array without any valid key would still error.
> If this is acceptable for that function, all the other functions can have
> all the options in the array as that keeps the array consistent across them.
> 
> With this being said, would anyone oppose an implementation where all the
> options (including lifetime) are included in the array parameter?

Personally, I'd even prefer this, but that's not what was voted upon, so
I'm not sure if it's okay.  Anyhow, the implementation is available as
<https://github.com/php/php-src/pull/3398>.  Thanks, Pedro!

> About the implementation, the array of options is never really defined in
> the RFC. If we assume that it is identical to the proposed output
> of session_get_cookie_params, the name of the first key should be lifetime.
> However, for setcookie and setrawcookie, the documented parameter name is
> expire. Would there be any issue if we would assume lifetime for the 4
> functions?

I'd prefer “expire_s_”, but I'm okay with “lifetime”.

-- 
Christoph M. Becker

---

## #102942 — mail@pmmaga.net — 2018-07-21T21:49:26+00:00

URL: https://externals.io/message/100304#102942 · In reply to: #102937

On Sat, Jul 21, 2018 at 12:11 PM Christoph M. Becker <cmbecker69@gmx.de>
wrote:

> Personally, I'd even prefer this, but that's not what was voted upon, so
> I'm not sure if it's okay.  Anyhow, the implementation is available as
> <https://github.com/php/php-src/pull/3398>.  Thanks, Pedro!
>

I personally believe that the intent of the vote is to have this feature
and to have it included as an alternative array of parameters. I don't mean
to step on anyone's toes with the proposed implementation, but given that
the RFC doesn't define the array of options I think most people didn't
notice this design choice and/or ultimately just wanted this feature
accepted.


> > […]
> lifetime.
> > […]
>
> I'd prefer “expire_s_”, but I'm okay with “lifetime”.
>

Although I had suggested using the same key for all functions, when I
started the implementation I realized they have different meanings. For
session_get_cookie_params, lifetime is a relative amount of seconds, but
for setcookie and setrawcookie expire is an absolute timestamp. So I kept
that distinction.
About your suggestion, I looked again, and in fact, the only place where
the parameter is called expire is in the docs. Internally (ie. Reflection)
it is called expires. Given this and the fact that it is what actually is
used in the cookie header, I've changed the key to "expires".

Regards,
Pedro

---

## #102944 — Andrey Andreev — 2018-07-21T22:26:28+00:00

URL: https://externals.io/message/100304#102944 · In reply to: #102909

Hi,


>
> With this being said, would anyone oppose an implementation where all the
> options (including lifetime) are included in the array parameter?
>

Yes.

All other "options" are actual *cookie attribute* names, as defined by
the various IETF RFCs, while "lifetime" is just a convenient name used
by PHP. It doesn't correspond to a particular attribute, but instead
the values for the Expires and Max-Age attributes are derived from it.
I believe during discussion I insisted that the parameter be called
"attributes", for this very reason.
On another note, I also wanted that pretty much any key/value pair to
be accepted instead of raising an error, for forward compatibility.

Unfortunately, neither of these 2 points I raised were addressed, but
it also looked like the author abandoned the RFC mid-vote as he agreed
that targeting 7.2 at the time wasn't a good idea, only he didn't
actually close the vote. So ... I'm not even sure of the status of
this RFC?

Cheers,
Andrey.

---

Next page: https://externals.io/message/100304.md?page=2
