parent
3b09571e70
commit
7dd3211f25
7
ra/ra.go
7
ra/ra.go
|
|
@ -468,8 +468,11 @@ func (ra *RegistrationAuthorityImpl) validateContacts(ctx context.Context, conta
|
|||
if parsed.Scheme != "mailto" {
|
||||
return berrors.InvalidEmailError("contact method %q is not supported", parsed.Scheme)
|
||||
}
|
||||
if parsed.RawQuery != "" {
|
||||
return berrors.InvalidEmailError("contact email [%q] contains hfields", contact)
|
||||
if parsed.RawQuery != "" || contact[len(contact)-1] == '?' {
|
||||
return berrors.InvalidEmailError("contact email %q contains a question mark", contact)
|
||||
}
|
||||
if parsed.Fragment != "" {
|
||||
return berrors.InvalidEmailError("contact email %q contains a '#'", contact)
|
||||
}
|
||||
if !core.IsASCII(contact) {
|
||||
return berrors.InvalidEmailError(
|
||||
|
|
|
|||
|
|
@ -416,6 +416,12 @@ func TestValidateContacts(t *testing.T) {
|
|||
err = ra.validateContacts(context.Background(), []string{"mailto:admin@a.com?no-reminder-emails"})
|
||||
test.AssertError(t, err, "No hfields in email")
|
||||
|
||||
err = ra.validateContacts(context.Background(), []string{"mailto:example@a.com?"})
|
||||
test.AssertError(t, err, "No hfields in email")
|
||||
|
||||
err = ra.validateContacts(context.Background(), []string{"mailto:example@a.com#optional"})
|
||||
test.AssertError(t, err, "No fragment")
|
||||
|
||||
// The registrations.contact field is VARCHAR(191). 175 'a' characters plus
|
||||
// the prefix "mailto:" and the suffix "@a.com" makes exactly 191 bytes of
|
||||
// encoded JSON. The correct size to hit our maximum DB field length.
|
||||
|
|
|
|||
Loading…
Reference in New Issue