@@ -144,6 +144,7 @@ func isPrecertificate(cert *x509.Certificate) (bool, error) {
144
144
// errors that are commonly raised with certificates submitted to CT logs.
145
145
//
146
146
// Allowed x509 errors:
147
+ //
147
148
// - UnhandledCriticalExtension: Precertificates have the poison extension
148
149
// which the Go library code does not recognize; also the Go library code
149
150
// does not support the standard PolicyConstraints extension (which is
@@ -161,14 +162,27 @@ func isPrecertificate(cert *x509.Certificate) (bool, error) {
161
162
// - CANotAuthorizedForThisName: allow to log all certificates, even if they
162
163
// have been isued by a CA trhat is not auhotized to issue certs for a
163
164
// 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.
164
168
func getLaxVerifiedChain (cert * x509.Certificate , opts x509.VerifyOptions ) ([][]* x509.Certificate , error ) {
165
169
chains , err := cert .Verify (opts )
166
170
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.
167
174
case x509.UnhandledCriticalExtension :
168
175
return chains , nil
169
176
case x509.CertificateInvalidError :
170
177
if e , ok := err .(x509.CertificateInvalidError ); ok {
171
178
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.
172
186
case x509 .Expired , x509 .TooManyIntermediates , x509 .CANotAuthorizedForThisName :
173
187
return chains , nil
174
188
// TODO(phboneff): check if we can remove these two exceptions.
0 commit comments