Skip to content

[FrameworkBundle] Change the default value of cookie_httponly #15372

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

Merged
merged 1 commit into from
Aug 1, 2015

Conversation

jderusse
Copy link
Member

Q A
Bug fix? no
New feature? yes
BC breaks? yes
Deprecations? no
Tests pass? yes
Fixed tickets #15303
License MIT
Doc PR symfony/symfony-docs#5561

@@ -468,6 +468,8 @@ UPGRADE FROM 2.x to 3.0
interface.
The `security.csrf.token_manager` should be used instead.

* The default value of the parameter `cookie_httponly` is now `true`.
Copy link
Member

Choose a reason for hiding this comment

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

I don't know if the UPGRADE guide is the best place for this, but should we also add a short phrase exaplining the consequences of this change?

@jderusse
Copy link
Member Author

It's a BC break because the default value changed. But it's for the own good of the application. It could be a issue on an application which retrieve the cookie value in javascript on purpose.

BTW I don't see how to notify the developper: I'm 👎 for adding a deprecated notice when the parameter is not overrided.

Other question, should I add a tests who asserts defaults values?

@javiereguiluz
Copy link
Member

@jderusse I wasn't thinking about a deprecation notice. If I understand this change right, any Symfony app that uses JavaScript to read cookies values will stop working. I was wondering if we could say that explicitly somewhere.

@jderusse
Copy link
Member Author

@javiereguiluz You're right, thats why it's a BC break.

Adding a deprecated notice when the parameter is not overrided will force everybody to explicitly sets this optional parameter :(

@nicolas-grekas
Copy link
Member

👍

@nicolas-grekas nicolas-grekas changed the title Change the default value of cookie_httponly [FrameworkBundle] Change the default value of cookie_httponly Jul 27, 2015
@xabbuh
Copy link
Member

xabbuh commented Jul 28, 2015

If this should be merged into the 2.8 branch, the upgrade docs for 2.8 must be updated.

@linaori
Copy link
Contributor

linaori commented Jul 28, 2015

I think this change is worth the (minor) BC break it provides pre-3.0.

@@ -340,7 +340,7 @@ private function addSessionSection(ArrayNodeDefinition $rootNode)
->scalarNode('cookie_path')->end()
->scalarNode('cookie_domain')->end()
->booleanNode('cookie_secure')->end()
->booleanNode('cookie_httponly')->end()
->booleanNode('cookie_httponly')->defaultValue(true)->end()
Copy link
Member

Choose a reason for hiding this comment

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

please use `defaultTrue()``instead for consistency

@stof
Copy link
Member

stof commented Jul 28, 2015

@javiereguiluz this will only break things if you use Javascript to read the session cookie.

and 👍 for this change. It makes the session cookie safer by default

@jderusse jderusse force-pushed the default_value_cookie_httponly branch from 17c9fa7 to 5425d8c Compare July 28, 2015 09:51
@jderusse
Copy link
Member Author

I set the description in both UPGRADE-2.8.md and UPGRADE-3.0.md. Is it ok ?
ping @xabbuh

@stof
Copy link
Member

stof commented Jul 28, 2015

if the change is done in 2.8, there is nothing to add in UPGRADE-3.0.md, as upgrading from 2.8 to 3.0 won't change anything

@jderusse jderusse force-pushed the default_value_cookie_httponly branch from 5425d8c to 682a681 Compare July 28, 2015 11:02
@jderusse
Copy link
Member Author

fixed

* The default value of the parameter `session`.`cookie_httponly` is now `true`.
It prevents scripting languages, such as JavaScript to access the cookie,
which help to reduce identity theft through XSS attacks. If your
application need to access the session cookie override this parameter:
Copy link
Member

Choose a reason for hiding this comment

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

needs

Copy link
Member

Choose a reason for hiding this comment

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

And there should be a coma before override.

@jderusse jderusse force-pushed the default_value_cookie_httponly branch from 682a681 to a7bef1e Compare July 28, 2015 11:21
@fabpot
Copy link
Member

fabpot commented Aug 1, 2015

Thank you @jderusse.

@fabpot fabpot merged commit a7bef1e into symfony:2.8 Aug 1, 2015
fabpot added a commit that referenced this pull request Aug 1, 2015
…ttponly (jderusse)

This PR was merged into the 2.8 branch.

Discussion
----------

[FrameworkBundle] Change the default value of cookie_httponly

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | yes
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #15303
| License       | MIT
| Doc PR        | symfony/symfony-docs#5561

Commits
-------

a7bef1e Change the default value of cookie_httponly to fix #15303
xabbuh added a commit to symfony/symfony-docs that referenced this pull request Oct 5, 2015
This PR was merged into the 2.8 branch.

Discussion
----------

Change default value of cookie_httponly

| Q             | A
| ------------- | ---
| Doc fix?      | no
| New docs?     | symfony/symfony#15372
| Applies to    | 2.8
| Fixed tickets | symfony/symfony#15303

Commits
-------

e6c8b6c Change default value of cookie_httponly
@fabpot fabpot mentioned this pull request Nov 16, 2015
@jderusse jderusse deleted the default_value_cookie_httponly branch March 23, 2017 20:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants