-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
docs: Use validateData() to validate POST data only #8157
Conversation
Instead of withRequest(), use validateData() to validate POST data only. withRequest() uses $request->getVar() which returns $_GET, $_POST and $_COOKIE data in that order. Newer values override older values. Post values will be overriden by the cookies if they have the same name.
@@ -112,6 +112,7 @@ rule and message array formats, as well as available rules: | |||
or :ref:`$request->getRawInput() <incomingrequest-retrieving-raw-data>` | |||
or :ref:`$request->getVar() <incomingrequest-getting-data>`, and an attacker | |||
could change what data is validated. | |||
Instead of withRequest(), use validateData() to validate POST data only. withRequest() uses $request->getVar() which returns $_GET, $_POST and $_COOKIE data in that order. Newer values override older values. Post values will be overriden by the cookies if they have the same name. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This warning will be too long.
Why don't you add another warning about this addition, and move it to the top of the section?
Personally $this->validate()
is not recommended.
Instead of withRequest(), use validateData() to validate POST data only. withRequest() uses $request->getVar() which returns $_GET, $_POST and $_COOKIE data in that order. Newer values override older values. Post values will be overriden by the cookies if they have the same name. | |
Instead of ``validate()``, use ``validateData()`` to validate POST data only. | |
``withRequest()`` uses ``$request->getVar()`` which returns ``$_GET``, ``$_POST`` | |
or ``$_COOKIE`` data in that order (depending on php.ini | |
`request-order <https://www.php.net/manual/en/ini.core.php#ini.request-order>`_). | |
Newer values override older values. POST values may be overridden by the | |
cookies if they have the same name. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the edit. That is what I was trying to explain. But unfortunately I don't know this markup language used here. I would appreciate if you could do it, please.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See here it might help you.
https://github.com/codeigniter4/CodeIgniter4/blob/develop/contributing/documentation.rst
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, I sent #8169
Closed by #8169 |
Instead of withRequest(), use validateData() to validate POST data only. withRequest() uses $request->getVar() which returns $_GET, $_POST and $_COOKIE data in that order. Newer values override older values. Post values will be overriden by the cookies if they have the same name.
Description
Explain what you have changed, and why.
Checklist: