-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Do not include the SQL query in the Exception message #13356
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
Conversation
|
@test I used a cli script to test this and works as expected using MySQL database. Executed script before patch: Executed script after patch: Script used here: https://github.com/fastslack/joomla-cli-tools/blob/master/JoomlaTests/issue-13356/Issue13356 |
|
I have tested this item ✅ successfully on 65ea823 This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/13356. |
| * @since 3.4.6 | ||
| */ | ||
| protected function getErrorMessage($query) | ||
| protected function getErrorMessage() |
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.
as we have removed the $query param from getErrorMessage()
we don't need to pass when calling that function see
|
same as #10949 |
|
Didn't remember that was there. Either way the change needs to be merged in sooner than later. I don't know why there's a bad test on that other PR because there is no code change to duplicate the error output. |
|
I have tested this item ✅ successfully on 5386864 This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/13356. |
|
fully agree, i close mine in favour of this one. p.s. |
|
I have tested this item ✅ successfully on 5386864 This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/13356. |
|
RTC This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/13356. |
Summary of Changes
Including the SQL query in the Exception message is a mild information disclosure in that it displays to the user the failed SQL query and exposes information about the database structure. This PR removes the query from the Exception message retaining only the engine's error message.
The
JDatabaseExceptionExecutingobject has a$queryproperty (accessible viagetQuery()) that contains the failed SQL query. For debugging purposes, if you need access to the failed query, you should extract it from the Exception's property versus relying on the message.Testing Instructions
Create a query failure that triggers the error page. Pre-patch, the error message will contain the query. Post-patch, it will not.
Documentation Changes Required
Note that the query is not exposed as part of the Exception message any longer, developers must read it from the
JDatabaseExceptionExecutingobject's$queryproperty.