-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Security issue: DB passwords possibly leaking to logs #1568
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
Comments
The
Configure your error logging not to include the |
I highly recommend to reconsider this error management because right now I would not recommend this package for any serious industrial use-cases. I explain it in details. You can never know how your exceptions will be handled. The try-catch block is not necessarily near the database operations. See this actual example: something broke and the error was caught by the uncaught error handler. (Which logged the error and then killed the whole process.) In this very case we can (and will) check the exception in the uncaught error handler if it contains You don't know how and where your exceptions will be handled. And vice versa: one should not be afraid in their And about the sensitivity of this information: In many cases even the developers won't know the actual configuration that is being used in the production server. Maybe the whole developer organization has no access right to the production environment. But hey, some DB passwords are leaking because we logged an error object. And the developer of the package does not even consider this a serious issue. If you need to make the |
Sorry, I missed that this was an uncaught exception handler. Don’t let it go uncaught; add an
I’m not the developer. Just offering advice on how to use the current version of pg considering your problem. Even error messages aren’t as safe to log in general as you’d like them to be, though. |
This comment has been minimized.
This comment has been minimized.
Hmm I think it's a pretty serious issue. Since we operate in a very security sensitive industry, I'm very concerned with that. |
The simplest solution would be to replace this line:
with this: Object.defineProperty(this, 'password', {value: val('password', config)}); i.e. make property |
|
@charmander yes, those are accessed explicitly, that's why. |
Nice ! Given the criticity of that, perhaps it would be good to have a comment in code + setting explicitly enumerable to false, to show the intent and avoid a future infortunate change. Anyone for the PR ? |
On second thought : don't we only need to attach client to error ? I just had a look at the code, and if IIUC the client is attached to error in pg-pool : I don't see So perhaps a more efficient solution should be to remove this line from pg-pool. Besides, client is passed to the error listener in https://github.com/brianc/node-pg-pool/blob/4d7734a71122cbbe1bb81bb466430e96f3405394/index.js#L186 Any thoughts ? |
That sounds good, but it’s also a breaking change. Cancellation can be removed about as easily. |
Ah yes you're right. Looks like there are 3 important PR which will need to be merged in pg-pool :
@charmander I see that you dont' have collaborator access to pg-pool. Is it something you are willing to ask @brianc for ? Or perhaps it's more simple in the short term to make password non enumerable in connectionParameters (but I'm not totally sure if it's enough, password is also assigned directly to client instance IIRC).
I haven't followed the cancellation issue, but I don't see why it would be related to this leak. |
Credentials are attached to clients to support (only) cancellation, but that hasn’t worked in any pg 7.x. The existing API for cancellation is a bit misleading too. It could be removed in 7.x, then return with a new interface for 8.x – at which point the |
8.x - is it even on the map? I don't see any branch for it. |
@vitaly-t Oh, it’s not necessarily planned for an 8.x – all I mean is that it would have to be some future major version. |
Has there been any updates on this? Or is the approved solution to just not log any errors? https://node-postgres.com/features/pooling#checkout-use-and-return |
This comment has been minimized.
This comment has been minimized.
@brianc I have tested this issue in v8.0.0, and it was fixed there. This can be closed now. |
Awesome! Good news! :)
…On Tue, Mar 31, 2020 at 4:34 PM Vitaly Tomilov ***@***.***> wrote:
@brianc <https://github.com/brianc> I have tested this issue in v8.0.0,
and it was fixed there. This can be closed now.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#1568 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAAMHILWIKCZDOUZXYSCU5TRKJOVLANCNFSM4EPYP36Q>
.
|
Version:
"pg": "7.1.2"
We've seen such lines in our logs (uncaught exception handler).
Well. I hope I don't have to explain.
Also it's kinda urgent for us.
The text was updated successfully, but these errors were encountered: