Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for the SameSite cookie option #9

Merged
merged 1 commit into from
Mar 20, 2020

Conversation

stissot
Copy link
Contributor

@stissot stissot commented Feb 24, 2020

Q A
Documentation no
Bugfix yes
BC Break no
New Feature yes
RFC yes
QA no

Description

Add support for the SameSite SetCookie parameter, described in RFC6265bis and supported by the session.cookie_samesite PHP ini option from PHP 7.3+. The parameter can have the Lax or Strict or Null values, any other value will be ignored.

@stissot stissot changed the title Samesite Support for the SameSite cookie option Feb 24, 2020
Copy link
Contributor

@PowerKiKi PowerKiKi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SameSite::fromString() already provides some validation. Maybe we don't need to duplicate validation in our code ? only check for empty values ?

@michalbundyra
Copy link
Member

@stissot Thanks for you contribution. It looks good for me, we just need some unit tests to cover these changes. Would you be able to provide some? Thanks!

@stissot
Copy link
Contributor Author

stissot commented Feb 25, 2020

@stissot Thanks for you contribution. It looks good for me, we just need some unit tests to cover these changes. Would you be able to provide some? Thanks!

I added unit tests, but we have a dependency problem: support for SameSite cookie was added in dflydev/fig-cookies 2.0, but this version requires PHP >7.1, so either we drop the support for PHP 7.1, or shall we skip some tests when running with PHP 7.1 what do you suggest?

@PowerKiKi
Copy link
Contributor

IMHO, we should migrate to require only dflydev/fig-cookies ^2.0 and PHP ^7.2, because it was also done in mezzio/mezzio-swoole@18fe812 for exactly the same reason. So it makes sense to follow the same trend in this ecosystem.

@stissot
Copy link
Contributor Author

stissot commented Feb 26, 2020

I agree with @PowerKiKi
I have upgraded the PR to require PHP ^7.2* and FigCookies ^2.0.1, upgraded to phpUnit 8.5 and added test suites with PHP 7.4.

* We still require PHP 7.3 to set SameSite in the SetCookie header, because the INI setting session.cookie_samesite was added in that version.

@michalbundyra
Copy link
Member

@PowerKiKi

IMHO, we should migrate to require only dflydev/fig-cookies ^2.0 and PHP ^7.2

I agree, but 2.0.1 and PHP 7.2 ;)
There is no other way we can provide SameSite support when our external dependencies do not support it on PHP < 7.2.

Copy link
Contributor

@PowerKiKi PowerKiKi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@michalbundyra
Copy link
Member

@PowerKiKi @stissot As the feature requires PHP 7.3 anyway and PHP 7.2 is in security fixes only phase I think we should bump PHP version to 7.3 in this library for the next minor release.

@stissot Would you be able to update it, please? BTW Thanks for the PR :)

@PowerKiKi
Copy link
Contributor

I'm usually in favor of dropping unsupported PHP version. But we still have 8 months to go for PHP 7.2. I feel it's a bit early.

Bugs affecting users that runs PHP 7.2 could be fixed in that period, forcing them to upgrade PHP or leave open bugs. And it also is slightly out of scope of this PR.

I'd prefer to have another dedicated PR to drop PHP 7.2 in November 2020.

@michalbundyra
Copy link
Member

@PowerKiKi We will provide security updates for the previous minor until PHP 7.2 EOL so in general it should not be a problem.

@PowerKiKi
Copy link
Contributor

Oh, I was under the impression, that you only released "higher" version and didn't have security update branches for older versions. If that's the case, then dropping PHP 7.2 is fine with me.

@michalbundyra
Copy link
Member

@PowerKiKi Yes, that's the plan - have security updates synchronised with PHP release cycle :)

stissot added a commit to stissot/mezzio-session-ext that referenced this pull request Mar 3, 2020
@stissot
Copy link
Contributor Author

stissot commented Mar 3, 2020

Thanks for your feedback, I agree to require PHP 7.3 in the next release and the PR has been updated accordingly.

@stissot
Copy link
Contributor Author

stissot commented Mar 11, 2020

Could you make a release? I need this feature for our project.

@michalbundyra michalbundyra force-pushed the samesite branch 2 times, most recently from e1c343b to ceb3ee4 Compare March 19, 2020 20:13
Requires PHP 7.3 and FigCookies 2.0
Update PHPUnit version to 9.0.1
As we support now only PHP 7.3 we can bump PHPUnit version to 9.
Also removed redundant conflict with phpspec/prophecy.
@michalbundyra michalbundyra added this to the 1.8.0 milestone Mar 19, 2020
michalbundyra added a commit that referenced this pull request Mar 20, 2020
Signed-off-by: Michał Bundyra <[email protected]>
michalbundyra added a commit that referenced this pull request Mar 20, 2020
@michalbundyra michalbundyra merged commit 815b768 into mezzio:develop Mar 20, 2020
@michalbundyra
Copy link
Member

Thanks, @stissot!
Thanks, @PowerKiKi!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants