Skip to content

SQL query is printed into browser in case of exception #13385

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
alexkuk opened this issue Jan 26, 2018 · 5 comments
Closed

SQL query is printed into browser in case of exception #13385

alexkuk opened this issue Jan 26, 2018 · 5 comments
Assignees
Labels
Fixed in 2.2.x The issue has been fixed in 2.2 release line Fixed in 2.3.x The issue has been fixed in 2.3 release line Issue: Clear Description Gate 2 Passed. Manual verification of the issue description passed Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development Reproduced on 2.2.x The issue has been reproduced on latest 2.2 release Reproduced on 2.3.x The issue has been reproduced on latest 2.3 release

Comments

@alexkuk
Copy link

alexkuk commented Jan 26, 2018

Preconditions

  1. Magento 2.2.2. Was reproduced on Magento 2.1.9 as well.
  2. Production mode
  3. Reproduced on EAV collections

Steps to reproduce

  1. Add an erroneous SQL statement to collection select object. I've added this code to \Magento\Catalog\Block\Product\ListProduct::initializeProductCollection():
$collection = $layer->getProductCollection();
$collection->getSelect()->columns('qwerty');

as an example
2. Open some category page in a browser.

Expected result

  1. No SQL query is printed in a browser

Actual result

  1. SQL query is printed in a browser

Fix proposal

In the \Magento\Eav\Model\Entity\Collection\AbstractCollection::_loadEntities() replace $this->printLogQuery(true, true, $query); with $this->printLogQuery(false, true, $query);

@magento-engcom-team magento-engcom-team added the Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed label Jan 26, 2018
@bydrei
Copy link

bydrei commented Jan 26, 2018

@alexkuk do you have pub/errors/local.xml or pub/errors/local.xml.sample ?

@magento-engcom-team magento-engcom-team added the Issue: Clear Description Gate 2 Passed. Manual verification of the issue description passed label Jan 29, 2018
@magento-engcom-team
Copy link
Contributor

@alexkuk, thank you for your report.
We've acknowledged the issue and added to our backlog.

@magento-engcom-team magento-engcom-team added Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Reproduced on 2.2.x The issue has been reproduced on latest 2.2 release Reproduced on 2.3.x The issue has been reproduced on latest 2.3 release labels Jan 29, 2018
@shyamranpara shyamranpara self-assigned this Feb 11, 2018
@alexkuk
Copy link
Author

alexkuk commented Feb 11, 2018

@shyamranpara Common, displaying SQL in production IS an issue. It is a security problem and it's acknowledged and reproduced by the core team. The problem is in the AbstractCollection that is used by both framework and application code. Changing the core file is provided as an example how to reproduce the bug.

@magento-engcom-team
Copy link
Contributor

Hi @alexkuk. Thank you for your report.
The issue has been fixed in #13607 by @shyamranpara in 2.2-develop branch
Related commit(s):

The fix will be available with the upcoming 2.2.5 release.

@magento-engcom-team
Copy link
Contributor

Hi @alexkuk. Thank you for your report.
The issue has been fixed in #14223 by @rostyslav-hymon in 2.3-develop branch
Related commit(s):

The fix will be available with the upcoming 2.3.0 release.

@magento-engcom-team magento-engcom-team added the Fixed in 2.3.x The issue has been fixed in 2.3 release line label Mar 22, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Fixed in 2.2.x The issue has been fixed in 2.2 release line Fixed in 2.3.x The issue has been fixed in 2.3 release line Issue: Clear Description Gate 2 Passed. Manual verification of the issue description passed Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development Reproduced on 2.2.x The issue has been reproduced on latest 2.2 release Reproduced on 2.3.x The issue has been reproduced on latest 2.3 release
Projects
None yet
Development

No branches or pull requests

4 participants