Skip to content

Commit c46f19f

Browse files
authored
Simplify custom lint directory structure (#6971)
The upstream zlint lints are organized not by what kind of certificate they apply to, but what source they are from. This change rearranges (and slightly renames) our custom lints to match the same structure. This will make it easier for us to temporarily add lints (e.g. for our CRLs) which we intend to upstream to zlint later. Part of #6934
1 parent cd24b9d commit c46f19f

7 files changed

+33
-38
lines changed

linter/linter.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,8 @@ import (
1616
"github.com/letsencrypt/boulder/crl/crl_x509"
1717
crllints "github.com/letsencrypt/boulder/linter/lints/crl"
1818

19-
_ "github.com/letsencrypt/boulder/linter/lints/all"
20-
_ "github.com/letsencrypt/boulder/linter/lints/intermediate"
21-
_ "github.com/letsencrypt/boulder/linter/lints/root"
22-
_ "github.com/letsencrypt/boulder/linter/lints/subscriber"
19+
_ "github.com/letsencrypt/boulder/linter/lints/chrome"
20+
_ "github.com/letsencrypt/boulder/linter/lints/cpcps"
2321
)
2422

2523
var ErrLinting = fmt.Errorf("failed lint(s)")

linter/lints/subscriber/e_scts_from_same_operator.go renamed to linter/lints/chrome/e_scts_from_same_operator.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package subscriber
1+
package chrome
22

33
import (
44
"time"

linter/lints/common.go

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,8 @@ const (
1414
BRDay time.Duration = 86400 * time.Second
1515

1616
// Declare our own Sources for use in zlint registry filtering.
17-
LetsEncryptCPSAll lint.LintSource = "LECPSAll"
18-
LetsEncryptCPSIntermediate lint.LintSource = "LECPSIntermediate"
19-
LetsEncryptCPSRoot lint.LintSource = "LECPSRoot"
20-
LetsEncryptCPSSubscriber lint.LintSource = "LECPSSubscriber"
21-
ChromeCTPolicy lint.LintSource = "ChromeCT"
17+
LetsEncryptCPS lint.LintSource = "LECPS"
18+
ChromeCTPolicy lint.LintSource = "ChromeCT"
2219
)
2320

2421
var (

linter/lints/root/e_validity_period_greater_than_25_years.go renamed to linter/lints/cpcps/lint_root_ca_cert_validity_period_greater_than_25_years.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package subscriber
1+
package cpcps
22

33
import (
44
"time"
@@ -10,28 +10,28 @@ import (
1010
"github.com/letsencrypt/boulder/linter/lints"
1111
)
1212

13-
type certValidityTooLong struct{}
13+
type rootCACertValidityTooLong struct{}
1414

1515
func init() {
1616
lint.RegisterLint(&lint.Lint{
17-
Name: "e_validity_period_greater_than_25_years",
17+
Name: "e_root_ca_cert_validity_period_greater_than_25_years",
1818
Description: "Let's Encrypt Root CA Certificates have Validity Periods of up to 25 years",
1919
Citation: "CPS: 7.1",
20-
Source: lints.LetsEncryptCPSRoot,
20+
Source: lints.LetsEncryptCPS,
2121
EffectiveDate: lints.CPSV33Date,
22-
Lint: NewCertValidityTooLong,
22+
Lint: NewRootCACertValidityTooLong,
2323
})
2424
}
2525

26-
func NewCertValidityTooLong() lint.LintInterface {
27-
return &certValidityTooLong{}
26+
func NewRootCACertValidityTooLong() lint.LintInterface {
27+
return &rootCACertValidityTooLong{}
2828
}
2929

30-
func (l *certValidityTooLong) CheckApplies(c *x509.Certificate) bool {
30+
func (l *rootCACertValidityTooLong) CheckApplies(c *x509.Certificate) bool {
3131
return util.IsRootCA(c)
3232
}
3333

34-
func (l *certValidityTooLong) Execute(c *x509.Certificate) *lint.LintResult {
34+
func (l *rootCACertValidityTooLong) Execute(c *x509.Certificate) *lint.LintResult {
3535
// CPS 7.1: "Root CA Certificate Validity Period: Up to 25 years."
3636
maxValidity := 25 * 365 * lints.BRDay
3737

linter/lints/intermediate/e_validity_period_greater_than_8_years.go renamed to linter/lints/cpcps/lint_subordinate_ca_cert_validity_period_greater_than_8_years.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package subscriber
1+
package cpcps
22

33
import (
44
"time"
@@ -10,28 +10,28 @@ import (
1010
"github.com/letsencrypt/boulder/linter/lints"
1111
)
1212

13-
type certValidityTooLong struct{}
13+
type subordinateCACertValidityTooLong struct{}
1414

1515
func init() {
1616
lint.RegisterLint(&lint.Lint{
1717
Name: "e_validity_period_greater_than_8_years",
1818
Description: "Let's Encrypt Intermediate CA Certificates have Validity Periods of up to 8 years",
1919
Citation: "CPS: 7.1",
20-
Source: lints.LetsEncryptCPSIntermediate,
20+
Source: lints.LetsEncryptCPS,
2121
EffectiveDate: lints.CPSV33Date,
22-
Lint: NewCertValidityTooLong,
22+
Lint: NewSubordinateCACertValidityTooLong,
2323
})
2424
}
2525

26-
func NewCertValidityTooLong() lint.LintInterface {
27-
return &certValidityTooLong{}
26+
func NewSubordinateCACertValidityTooLong() lint.LintInterface {
27+
return &subordinateCACertValidityTooLong{}
2828
}
2929

30-
func (l *certValidityTooLong) CheckApplies(c *x509.Certificate) bool {
30+
func (l *subordinateCACertValidityTooLong) CheckApplies(c *x509.Certificate) bool {
3131
return util.IsSubCA(c)
3232
}
3333

34-
func (l *certValidityTooLong) Execute(c *x509.Certificate) *lint.LintResult {
34+
func (l *subordinateCACertValidityTooLong) Execute(c *x509.Certificate) *lint.LintResult {
3535
// CPS 7.1: "Intermediate CA Certificate Validity Period: Up to 8 years."
3636
maxValidity := 8 * 365 * lints.BRDay
3737

linter/lints/subscriber/e_validity_period_greater_than_100_days.go renamed to linter/lints/cpcps/lint_subscriber_cert_validity_greater_than_100_days.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package subscriber
1+
package cpcps
22

33
import (
44
"time"
@@ -10,28 +10,28 @@ import (
1010
"github.com/letsencrypt/boulder/linter/lints"
1111
)
1212

13-
type certValidityTooLong struct{}
13+
type subscriberCertValidityTooLong struct{}
1414

1515
func init() {
1616
lint.RegisterLint(&lint.Lint{
17-
Name: "e_validity_period_greater_than_100_days",
17+
Name: "e_subscriber_cert_validity_period_greater_than_100_days",
1818
Description: "Let's Encrypt Subscriber Certificates have Validity Periods of up to 100 days",
1919
Citation: "CPS: 7.1",
20-
Source: lints.LetsEncryptCPSSubscriber,
20+
Source: lints.LetsEncryptCPS,
2121
EffectiveDate: lints.CPSV33Date,
22-
Lint: NewCertValidityTooLong,
22+
Lint: NewSubscriberCertValidityTooLong,
2323
})
2424
}
2525

26-
func NewCertValidityTooLong() lint.LintInterface {
27-
return &certValidityTooLong{}
26+
func NewSubscriberCertValidityTooLong() lint.LintInterface {
27+
return &subscriberCertValidityTooLong{}
2828
}
2929

30-
func (l *certValidityTooLong) CheckApplies(c *x509.Certificate) bool {
30+
func (l *subscriberCertValidityTooLong) CheckApplies(c *x509.Certificate) bool {
3131
return util.IsServerAuthCert(c) && !c.IsCA
3232
}
3333

34-
func (l *certValidityTooLong) Execute(c *x509.Certificate) *lint.LintResult {
34+
func (l *subscriberCertValidityTooLong) Execute(c *x509.Certificate) *lint.LintResult {
3535
// CPS 7.1: "DV SSL End Entity Certificate Validity Period: Up to 100 days."
3636
maxValidity := 100 * lints.BRDay
3737

linter/lints/all/w_validity_period_has_extra_second.go renamed to linter/lints/cpcps/lint_validity_period_has_extra_second.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package subscriber
1+
package cpcps
22

33
import (
44
"time"
@@ -16,7 +16,7 @@ func init() {
1616
Name: "w_validity_period_has_extra_second",
1717
Description: "Let's Encrypt Certificates have Validity Periods that are a round number of seconds",
1818
Citation: "CPS: 7.1",
19-
Source: lints.LetsEncryptCPSAll,
19+
Source: lints.LetsEncryptCPS,
2020
EffectiveDate: lints.CPSV33Date,
2121
Lint: NewCertValidityNotRound,
2222
})

0 commit comments

Comments
 (0)