@@ -144,6 +144,7 @@ func isPrecertificate(cert *x509.Certificate) (bool, error) {
144144// errors that are commonly raised with certificates submitted to CT logs.
145145//
146146// Allowed x509 errors:
147+ //
147148// - UnhandledCriticalExtension: Precertificates have the poison extension
148149// which the Go library code does not recognize; also the Go library code
149150// does not support the standard PolicyConstraints extension (which is
@@ -161,14 +162,27 @@ func isPrecertificate(cert *x509.Certificate) (bool, error) {
161162// - CANotAuthorizedForThisName: allow to log all certificates, even if they
162163// have been isued by a CA trhat is not auhotized to issue certs for a
163164// given domain.
165+ //
166+ // TODO(phboneff): this doesn't work because, as it should, cert.Verify()
167+ // does not return a chain when it raises an error.
164168func getLaxVerifiedChain (cert * x509.Certificate , opts x509.VerifyOptions ) ([][]* x509.Certificate , error ) {
165169 chains , err := cert .Verify (opts )
166170 switch err .(type ) {
171+ // TODO(phboneff): check if we could make the x509 library aware of the CT
172+ // poison.
173+ // TODO(phboneff): re-evaluate whether PolicyConstraints is still an issue.
167174 case x509.UnhandledCriticalExtension :
168175 return chains , nil
169176 case x509.CertificateInvalidError :
170177 if e , ok := err .(x509.CertificateInvalidError ); ok {
171178 switch e .Reason {
179+ // TODO(phboneff): if need be, change time to make sure that the cert is
180+ // never considered as expired.
181+ // TODO(phboneff): see if TooManyIntermediates handling could be improved
182+ // upstream.
183+ // TODO(phboneff): see if it's necessary to log certs for which
184+ // CANotAuthorizedForThisName is raised. If browsers all check this
185+ // as well, then there is no need to log these certs.
172186 case x509 .Expired , x509 .TooManyIntermediates , x509 .CANotAuthorizedForThisName :
173187 return chains , nil
174188 // TODO(phboneff): check if we can remove these two exceptions.
0 commit comments