Skip to content

Commit 86fe202

Browse files
refactor: minor adjustments
1 parent a4babae commit 86fe202

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

protocol/utils.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@ func parseX5C(x5c []any) (x5cs []*x509.Certificate, err error) {
7171
// mangling the not after value for purpose of just validating the attestation lineage. If you set mangleNotAfter to
7272
// true this function should only be considered safe for determining lineage, and not hte validity of a chain in
7373
// general.
74+
//
75+
// WARNING: Setting mangleNotAfter=true weakens security by accepting expired certificates.
7476
func attStatementCertChainVerify(certs []*x509.Certificate, roots *x509.CertPool, mangleNotAfter bool, mangleNotAfterSafeTime time.Time) (chains [][]*x509.Certificate, err error) {
7577
if len(certs) == 0 {
7678
return nil, errors.New("empty chain")
@@ -146,6 +148,8 @@ func certsInsecureNotAfterMangle(certs []*x509.Certificate) (out []*x509.Certifi
146148
// This function is used to intentionally but conditionally mangle the certificate not after value to exclude it from
147149
// the verification process. This should only be used in instances where all you care about is which certificates
148150
// performed the signing.
151+
//
152+
// WARNING: Setting mangle=true weakens security by accepting expired certificates.
149153
func certInsecureConditionalNotAfterMangle(cert *x509.Certificate, mangle bool, safe time.Time) (out *x509.Certificate) {
150154
if !mangle || cert.NotAfter.After(safe) {
151155
return cert

0 commit comments

Comments
 (0)