Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion conceptual/Npgsql/connection-string-parameters.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Root Certificate | Location of a CA certificate used to validate the
Check Certificate Revocation | Whether to check the certificate revocation list during authentication. | false
SSL Negotiation | Controls how SSL encryption is negotiated with the server, if SSL is used. Introduced in 9.0. [See docs for possible values and more info](security.md). | PGSSLNEGOTIATION
Channel Binding | Control whether channel binding is used when authenticating with SASL. Introduced in 8.0. | Prefer
Persist Security Info | Gets or sets a Boolean value that indicates if security-sensitive information, such as the password, is not returned as part of the connection if the connection is open or has ever been in an open state. | false
Persist Security Info | When enabled, security-sensitive information, such as the password, will be included as part of connection string for tracing and logging. | false
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we actually log the connection string (with the password) in logging? If so I think that's pretty questionable even when Persist Security Info is enabled... I'd prefer to review and remove this behavior...!

In my mind, this parameter was (at least originally) purely about whether reading NpgsqlConnection.ConnectionString returns the full connection string including the password (once the connection has been opened) - I don't think that it was about logging/tracing originally.

Final nit: is there anything other than the password that's actually covered here? If not, we can remove "such as the password" etc.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My interpretation of this feature is that it comes from the OleDb C++ ages where you could really connect to a database and then (given pooling is disabled) zero out the password string after establishing a connection and then the password would really be gone from memory(-dumps).
It has never worked this way in .NET (at least for Npgsql) and reflection and the inability to zero out strings in a garbage collection environment pretty much defeat the purpose.
See the discussion about SecureString (which could work in theory but only if you read a string into unmanaged memory char by char because otherwise the string would always end up in the managed heap).

Kerberos Service Name | The Kerberos service name to be used for authentication. [See docs for more info](security.md). | postgres
Include Realm | The Kerberos realm to be used for authentication. [See docs for more info](security.md).
Include Error Detail | When enabled, PostgreSQL error and notice details are included on <xref:Npgsql.PostgresException.Detail?displayProperty=nameWithType> and <xref:Npgsql.PostgresNotice.Detail?displayProperty=nameWithType>. These can contain sensitive data. | false
Expand Down