Skip to content

Commit

Permalink
Deprecate AllowCTPoison and AllowSCTList profile settings
Browse files Browse the repository at this point in the history
  • Loading branch information
aarongable committed Jul 18, 2024
1 parent a3e9943 commit 7a7f970
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 47 deletions.
28 changes: 14 additions & 14 deletions issuance/cert.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,21 @@ import (

// ProfileConfig describes the certificate issuance constraints for all issuers.
type ProfileConfig struct {
// AllowMustStaple, when false, causes all IssuanceRequests which specify the
// OCSP Must Staple extension to be rejected.
AllowMustStaple bool
AllowCTPoison bool
AllowSCTList bool
// AllowCTPoison, when false, causes all IssuanceRequests which want the
// CT Poison extension to be rejected.
// Deprecated: We will always allow the CT Poison extension because it is
// mandated for Precertificates. This boolean has no effect.
AllowCTPoison bool
// AllowSCTList, when false, causes all IssuanceRequests which include SCTs
// to be rejected.
// Deprecated: We intend to include SCTs in all final Certificates for the
// foreseeable future. This boolean has no effect.
AllowSCTList bool
// AllowCommonName, when false, causes all IssuanceRequests which specify a CN
// to be rejected.
AllowCommonName bool

MaxValidityPeriod config.Duration
Expand All @@ -47,8 +59,6 @@ type PolicyConfig struct {
// Profile is the validated structure created by reading in ProfileConfigs and IssuerConfigs
type Profile struct {
allowMustStaple bool
allowCTPoison bool
allowSCTList bool
allowCommonName bool

maxBackdate time.Duration
Expand All @@ -61,8 +71,6 @@ type Profile struct {
func NewProfile(profileConfig ProfileConfig, lints lint.Registry) (*Profile, error) {
sp := &Profile{
allowMustStaple: profileConfig.AllowMustStaple,
allowCTPoison: profileConfig.AllowCTPoison,
allowSCTList: profileConfig.AllowSCTList,
allowCommonName: profileConfig.AllowCommonName,
maxBackdate: profileConfig.MaxValidityBackdate.Duration,
maxValidity: profileConfig.MaxValidityPeriod.Duration,
Expand Down Expand Up @@ -93,14 +101,6 @@ func (i *Issuer) requestValid(clk clock.Clock, prof *Profile, req *IssuanceReque
return errors.New("must-staple extension cannot be included")
}

if !prof.allowCTPoison && req.IncludeCTPoison {
return errors.New("ct poison extension cannot be included")
}

if !prof.allowSCTList && req.sctList != nil {
return errors.New("sct list extension cannot be included")
}

if req.IncludeCTPoison && req.sctList != nil {
return errors.New("cannot include both ct poison and sct list extensions")
}
Expand Down
51 changes: 20 additions & 31 deletions issuance/cert_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,40 +93,11 @@ func TestRequestValid(t *testing.T) {
expectedError: "must-staple extension cannot be included",
},
{
name: "ct poison not allowed",
name: "both sct list and ct poison provided",
issuer: &Issuer{
active: true,
},
profile: &Profile{},
request: &IssuanceRequest{
PublicKey: &ecdsa.PublicKey{},
SubjectKeyId: goodSKID,
IncludeCTPoison: true,
},
expectedError: "ct poison extension cannot be included",
},
{
name: "sct list not allowed",
issuer: &Issuer{
active: true,
},
profile: &Profile{},
request: &IssuanceRequest{
PublicKey: &ecdsa.PublicKey{},
SubjectKeyId: goodSKID,
sctList: []ct.SignedCertificateTimestamp{},
},
expectedError: "sct list extension cannot be included",
},
{
name: "sct list and ct poison not allowed",
issuer: &Issuer{
active: true,
},
profile: &Profile{
allowCTPoison: true,
allowSCTList: true,
},
request: &IssuanceRequest{
PublicKey: &ecdsa.PublicKey{},
SubjectKeyId: goodSKID,
Expand Down Expand Up @@ -263,7 +234,24 @@ func TestRequestValid(t *testing.T) {
expectedError: "serial must be between 9 and 19 bytes",
},
{
name: "good",
name: "good with poison",
issuer: &Issuer{
active: true,
},
profile: &Profile{
maxValidity: time.Hour * 2,
},
request: &IssuanceRequest{
PublicKey: &ecdsa.PublicKey{},
SubjectKeyId: goodSKID,
NotBefore: fc.Now(),
NotAfter: fc.Now().Add(time.Hour),
Serial: []byte{1, 2, 3, 4, 5, 6, 7, 8, 9},
IncludeCTPoison: true,
},
},
{
name: "good with scts",
issuer: &Issuer{
active: true,
},
Expand All @@ -276,6 +264,7 @@ func TestRequestValid(t *testing.T) {
NotBefore: fc.Now(),
NotAfter: fc.Now().Add(time.Hour),
Serial: []byte{1, 2, 3, 4, 5, 6, 7, 8, 9},
sctList: []ct.SignedCertificateTimestamp{},
},
},
}
Expand Down
2 changes: 0 additions & 2 deletions test/config-next/ca.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,6 @@
"certProfiles": {
"defaultBoulderCertificateProfile": {
"allowMustStaple": true,
"allowCTPoison": true,
"allowSCTList": true,
"allowCommonName": true,
"policies": [
{
Expand Down

0 comments on commit 7a7f970

Please sign in to comment.