Skip to content

added a note about returning an object when using a JSON response #2555

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

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions components/http_foundation/introduction.rst
Original file line number Diff line number Diff line change
Expand Up @@ -507,11 +507,18 @@ the response content will look like this:

handleResponse({'data': 123});

.. caution::

Note that it is recommended to always return an object as a response to
protect yourself against XSSI and JSON-JavaScript Hijacking. Read the
`OWASP guidelines`_ for more information.

Session
-------

The session information is in its own document: :doc:`/components/http_foundation/sessions`.

.. _Packagist: https://packagist.org/packages/symfony/http-foundation
.. _Nginx: http://wiki.nginx.org/XSendfile
.. _Apache: https://tn123.org/mod_xsendfile/
.. _Packagist: https://packagist.org/packages/symfony/http-foundation
.. _Nginx: http://wiki.nginx.org/XSendfile
.. _Apache: https://tn123.org/mod_xsendfile/
.. _OWASP guidelines: https://www.owasp.org/index.php/OWASP_AJAX_Security_Guidelines#Always_return_JSON_with_an_Object_on_the_outside