Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upInclude raw SQL statement and values in query errors #1788
Conversation
| function handleQueryError (err, query) { | ||
| err.sql = { | ||
| text: query.text, | ||
| values: query.values |
This comment has been minimized.
This comment has been minimized.
joelmukuthu
Dec 21, 2018
Including values introduces a security issue. This could lead to user data e.g. passwords being logged in production. Perhaps this should be configurable or removed altogether.
This comment has been minimized.
This comment has been minimized.
marshall007
Dec 21, 2018
•
Author
@joelmukuthu agreed, do you think we should just make the population of err.sql.values configurable, err.sql entirely, or have fine-grained options for both?
|
I've addressed @joelmukuthu's concern in dd7352c. There is a new config option,
|
mledom
commented
Feb 11, 2019
|
This is great, I was actually trying to find a way to get that information. |
|
I'm not a fan of doing this - there's a security issue here in that we could be causing apps to accidentally log out sensitive information (e.g. a hashed password in the query params). It also is something that can/should be handled by a higher level library or your own application code if this kind of logging is required. Our responsibility as a database driver is to propagate the error back to the caller w/ the details included from the PostgreSQL backend. |
It would be indeed unacceptable in many businesses (including our) and uncompliant with European regulation on personal data protection (GDPR). |
@brianc because the new behavior is strictly opt-in, I tend to disagree here. I'd be happy to add some logic that explicitly warns the user of your concern when |
|
I think the best approach here is to log your query text & sql out in your own application if you need to see it in your logs. I'm not comfortable putting code in that has the possible to leak secure information...even less so if it's non-compliant with regulation. I don't see a reason this has to be the responsibility of node-postgres. |

Formed in 2009, the Archive Team (not to be confused with the archive.org Archive-It Team) is a rogue archivist collective dedicated to saving copies of rapidly dying or deleted websites for the sake of history and digital heritage. The group is 100% composed of volunteers and interested parties, and has expanded into a large amount of related projects for saving online and digital history.

marshall007 commentedDec 12, 2018
Fixes #881