Skip to content

Commit

Permalink
Switch from lint.Lint to lint.CertificateLint (#7230)
Browse files Browse the repository at this point in the history
Zlint is deprecating lint.Lint in favour of lint.CertificateLint.

The main difference is that metadata is now its own struct, shared with
lint.RevocationListLint and presumably future lint types.
  • Loading branch information
mcpherrinm authored Dec 21, 2023
1 parent d84e8d0 commit e331a51
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 40 deletions.
18 changes: 10 additions & 8 deletions linter/lints/chrome/e_scts_from_same_operator.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,19 @@ type sctsFromSameOperator struct {
}

func init() {
lint.RegisterLint(&lint.Lint{
Name: "e_scts_from_same_operator",
Description: "Let's Encrypt Subscriber Certificates have two SCTs from logs run by different operators",
Citation: "Chrome CT Policy",
Source: lints.ChromeCTPolicy,
EffectiveDate: time.Date(2022, time.April, 15, 0, 0, 0, 0, time.UTC),
Lint: NewSCTsFromSameOperator,
lint.RegisterCertificateLint(&lint.CertificateLint{
LintMetadata: lint.LintMetadata{
Name: "e_scts_from_same_operator",
Description: "Let's Encrypt Subscriber Certificates have two SCTs from logs run by different operators",
Citation: "Chrome CT Policy",
Source: lints.ChromeCTPolicy,
EffectiveDate: time.Date(2022, time.April, 15, 0, 0, 0, 0, time.UTC),
},
Lint: NewSCTsFromSameOperator,
})
}

func NewSCTsFromSameOperator() lint.LintInterface {
func NewSCTsFromSameOperator() lint.CertificateLintInterface {
return &sctsFromSameOperator{logList: loglist.GetLintList()}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,19 @@ import (
type rootCACertValidityTooLong struct{}

func init() {
lint.RegisterLint(&lint.Lint{
Name: "e_root_ca_cert_validity_period_greater_than_25_years",
Description: "Let's Encrypt Root CA Certificates have Validity Periods of up to 25 years",
Citation: "CPS: 7.1",
Source: lints.LetsEncryptCPS,
EffectiveDate: lints.CPSV33Date,
Lint: NewRootCACertValidityTooLong,
lint.RegisterCertificateLint(&lint.CertificateLint{
LintMetadata: lint.LintMetadata{
Name: "e_root_ca_cert_validity_period_greater_than_25_years",
Description: "Let's Encrypt Root CA Certificates have Validity Periods of up to 25 years",
Citation: "CPS: 7.1",
Source: lints.LetsEncryptCPS,
EffectiveDate: lints.CPSV33Date,
},
Lint: NewRootCACertValidityTooLong,
})
}

func NewRootCACertValidityTooLong() lint.LintInterface {
func NewRootCACertValidityTooLong() lint.CertificateLintInterface {
return &rootCACertValidityTooLong{}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,19 @@ import (
type subordinateCACertValidityTooLong struct{}

func init() {
lint.RegisterLint(&lint.Lint{
Name: "e_validity_period_greater_than_8_years",
Description: "Let's Encrypt Intermediate CA Certificates have Validity Periods of up to 8 years",
Citation: "CPS: 7.1",
Source: lints.LetsEncryptCPS,
EffectiveDate: lints.CPSV33Date,
Lint: NewSubordinateCACertValidityTooLong,
lint.RegisterCertificateLint(&lint.CertificateLint{
LintMetadata: lint.LintMetadata{
Name: "e_validity_period_greater_than_8_years",
Description: "Let's Encrypt Intermediate CA Certificates have Validity Periods of up to 8 years",
Citation: "CPS: 7.1",
Source: lints.LetsEncryptCPS,
EffectiveDate: lints.CPSV33Date,
},
Lint: NewSubordinateCACertValidityTooLong,
})
}

func NewSubordinateCACertValidityTooLong() lint.LintInterface {
func NewSubordinateCACertValidityTooLong() lint.CertificateLintInterface {
return &subordinateCACertValidityTooLong{}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,19 @@ import (
type subscriberCertValidityTooLong struct{}

func init() {
lint.RegisterLint(&lint.Lint{
Name: "e_subscriber_cert_validity_period_greater_than_100_days",
Description: "Let's Encrypt Subscriber Certificates have Validity Periods of up to 100 days",
Citation: "CPS: 7.1",
Source: lints.LetsEncryptCPS,
EffectiveDate: lints.CPSV33Date,
Lint: NewSubscriberCertValidityTooLong,
lint.RegisterCertificateLint(&lint.CertificateLint{
LintMetadata: lint.LintMetadata{
Name: "e_subscriber_cert_validity_period_greater_than_100_days",
Description: "Let's Encrypt Subscriber Certificates have Validity Periods of up to 100 days",
Citation: "CPS: 7.1",
Source: lints.LetsEncryptCPS,
EffectiveDate: lints.CPSV33Date,
},
Lint: NewSubscriberCertValidityTooLong,
})
}

func NewSubscriberCertValidityTooLong() lint.LintInterface {
func NewSubscriberCertValidityTooLong() lint.CertificateLintInterface {
return &subscriberCertValidityTooLong{}
}

Expand Down
18 changes: 10 additions & 8 deletions linter/lints/cpcps/lint_validity_period_has_extra_second.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,19 @@ import (
type certValidityNotRound struct{}

func init() {
lint.RegisterLint(&lint.Lint{
Name: "w_validity_period_has_extra_second",
Description: "Let's Encrypt Certificates have Validity Periods that are a round number of seconds",
Citation: "CPS: 7.1",
Source: lints.LetsEncryptCPS,
EffectiveDate: lints.CPSV33Date,
Lint: NewCertValidityNotRound,
lint.RegisterCertificateLint(&lint.CertificateLint{
LintMetadata: lint.LintMetadata{
Name: "w_validity_period_has_extra_second",
Description: "Let's Encrypt Certificates have Validity Periods that are a round number of seconds",
Citation: "CPS: 7.1",
Source: lints.LetsEncryptCPS,
EffectiveDate: lints.CPSV33Date,
},
Lint: NewCertValidityNotRound,
})
}

func NewCertValidityNotRound() lint.LintInterface {
func NewCertValidityNotRound() lint.CertificateLintInterface {
return &certValidityNotRound{}
}

Expand Down

0 comments on commit e331a51

Please sign in to comment.