-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Make compiling SQL in error message optional #5282
Make compiling SQL in error message optional #5282
Conversation
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.
perfect, thx for the PR
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.
seems good for me, but I think we need to set this boolean to true by default no ? to have same behavior that before, or need to fix tests
it would be a semver major if default is "no" |
Thanks for the answer, here I'd like to get your feedback about this. I would prefer it to be "no" as default because it is a much safer option and when I get your validation about this I can update the tests to not fail. However I do understand that this requires a major version increase, I have not contributed a lot to open source projects, would I have to do anything to make the major version happen or is this part handled by the maintainers? |
@kibertoad or @OlivierCavadenti what would you think about making this a major upgrade as mentioned above? |
Okay, to move on with this, I made the field to be true as default, so no major upgrade would be needed, but this is something that I think should be though of with the next major upgrade :) |
hi, seems you still have one test fail on postgres. |
Indeed it was, tests had a bit different setup, should be fixed now, tests pass on local machine |
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.
@JakobJoonas Thanks and sorry again for the delay.
Can you check that merged documentation is ok in knex/documentation repo since you change init value for the boolean ?
@OlivierCavadenti Thanks for reminding that, created a PR: knex/documentation#463 |
|
Hello!
Description
Currently the only and default behaviour of Knex is to add compiled SQL query into the error message, while it is good for debugging and visibility purposes, it also has a major drawback that it may leak sensitive information to logs.
Changes
compileSqlOnError
(Documentation PR).compileSqlOnError
is true, then compiled SQL will be added to error, otherwise parameterized SQL will be addedDefault value
By default the parameterized SQL will be added to the error message instead of the compiled SQL as it is now. Why did I make it default to parameterized? Because not having compiled SQL come up in error messages by default seems to be a much safer option, as it avoids leaking sensitive information to the logs, If a developer needs to debug anything then there is always the option to turn it on by enabling
compileSqlOnError
Extra notes
Please let me know if you have any remarks about this and if you think the default behaviour should be the opposite, I'm sure we can find a way integrate this option into Knex as this is something that can save leaking someones information.