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

Added SameSite attribute to CSRF cookie #3037

Closed
wants to merge 5 commits into from
Closed

Added SameSite attribute to CSRF cookie #3037

wants to merge 5 commits into from

Conversation

nControl88
Copy link

@nControl88 nControl88 commented May 27, 2020

Description
In order to provide an additional layer of defense against cross-site request forgery (CSRF) attacks, the SameSite attribute is added to the CSRF cookie.

Checklist:

  • Securely signed commits
  • Component(s) with PHPdocs
  • Unit testing, with >80% coverage
  • User guide updated
  • Conforms to style guide

Previous to PHP 7.0.3 `setcookie()` lacks an `$options` parameter. SameSite is therefore added to the path parameter.
Copy link
Member

@lonnieezell lonnieezell left a comment

Choose a reason for hiding this comment

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

You have some tests failing, mainly becuase CodeIgniter\Test\Mock\MockAppConfig::$CSRFCookieSameSite doesn't exist.

@@ -239,13 +239,15 @@ class App extends BaseConfig
| CSRFTokenName = The token name
| CSRFHeaderName = The header name
| CSRFCookieName = The cookie name
| CSRFCookieSameSite = The cookie SameSite attribute (none, Lax or Strict)
Copy link
Member

Choose a reason for hiding this comment

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

Case for these should match what a developer is expected to use. You're using all lowercase below, but these are listed out as Initial Caps.

SameSite CamelCase description
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