Document potential footgun with GTlsCertificateFlags

Once upon a time, we tried to return all possible certificate errors,
but it never actually worked reliably and nowadays we have given up.
This needs to be documented because a reasonable developer would not
expect it.

Because mistakes could be security-critical, I decided to copy the same
warning in several different places rather than relying only on
cross-referencese.
This commit is contained in:
Michael Catanzaro
2021-08-04 14:57:05 -05:00
committed by Philip Withnall
parent 42f5a3ec20
commit 780af9cff3
5 changed files with 68 additions and 13 deletions

View File

@@ -1588,10 +1588,16 @@ typedef enum {
* flags
*
* A set of flags describing TLS certification validation. This can be
* used to set which validation steps to perform (eg, with
* g_tls_client_connection_set_validation_flags()), or to describe why
* a particular certificate was rejected (eg, in
* #GTlsConnection::accept-certificate).
* used to describe why a particular certificate was rejected (for
* example, in #GTlsConnection::accept-certificate).
*
* GLib guarantees that if certificate verification fails, at least one
* flag will be set, but it does not guarantee that all possible flags
* will be set. Accordingly, you may not safely decide to ignore any
* particular type of error. For example, it would be incorrect to mask
* %G_TLS_CERTIFICATE_EXPIRED if you want to allow expired certificates,
* because this could potentially be the only error flag set even if
* other problems exist with the certificate.
*
* Since: 2.28
*/