3 ms·
>Warning: Be very careful with logging, while we encrypt our passwords here it may be possible that in a query or server log the password will be recorded in pl
by uhoh-itsmaciek 7y ago
>Warning: Be very careful with logging, while we encrypt our passwords here it may be possible that in a query or server log the password will be recorded in plain text!
I was glad to see this noted, but surprised this is the extent of the advice and that sending passwords to the database in plaintext is still recommended. Are there more fleshed out best practices around avoiding logging pitfalls of doing this?
- vbezhenar 7y agoHash password in your application. Probably it's not compatible with that postgraphile thing, it's more general advice.
- ComputerGuru 7y agoAnd if you’re using a language that supports it, pass passwords around in a custom data type/wrapper around string that does not leak its contents when your platform equivalent of .toString() is called (and override the JSON or slog conversion interface).
- miles-po 7y agoAnother method, which has worked for me, is to never store passwords in the database at all but in a separate authenticator like Google Auth or AWS Cognito. Then the authenticated username is passed in via signed JWT. The database can perform authorization, but authentication (and authentication method) are kept far away from the data in your database.
- yrro 7y agoPostgresql has built in crypt and gen_salt functions which may be good enough for your security requirements.