Remove telephone contacts as a option

This commit is contained in:
Roland Shoemaker 2016-03-08 16:03:16 -08:00
parent bad35e7fe8
commit 03427ccb81
3 changed files with 10 additions and 15 deletions

View File

@ -262,8 +262,6 @@ func (ra *RegistrationAuthorityImpl) validateContacts(ctx context.Context, conta
return core.MalformedRequestError("Invalid contact")
}
switch contact.Scheme {
case "tel":
continue
case "mailto":
start := ra.clk.Now()
ra.stats.Inc("RA.ValidateEmail.Calls", 1, 1.0)

View File

@ -291,20 +291,17 @@ func TestValidateContacts(t *testing.T) {
_, _, ra, _, cleanUp := initAuthorities(t)
defer cleanUp()
tel, _ := core.ParseAcmeURL("tel:")
ansible, _ := core.ParseAcmeURL("ansible:earth.sol.milkyway.laniakea/letsencrypt")
validEmail, _ := core.ParseAcmeURL("mailto:admin@email.com")
otherValidEmail, _ := core.ParseAcmeURL("mailto:other-admin@email.com")
malformedEmail, _ := core.ParseAcmeURL("mailto:admin.com")
err := ra.validateContacts(context.Background(), []*core.AcmeURL{})
test.AssertNotError(t, err, "No Contacts")
err = ra.validateContacts(context.Background(), []*core.AcmeURL{tel, validEmail})
err = ra.validateContacts(context.Background(), []*core.AcmeURL{validEmail, otherValidEmail})
test.AssertError(t, err, "Too Many Contacts")
err = ra.validateContacts(context.Background(), []*core.AcmeURL{tel})
test.AssertNotError(t, err, "Simple Telephone")
err = ra.validateContacts(context.Background(), []*core.AcmeURL{validEmail})
test.AssertNotError(t, err, "Valid Email")

View File

@ -786,7 +786,7 @@ func TestBadNonce(t *testing.T) {
test.AssertNotError(t, err, "Failed to make signer")
responseWriter := httptest.NewRecorder()
result, err := signer.Sign([]byte(`{"resource":"new-reg","contact":["tel:123456789"],"agreement":"` + agreementURL + `"}`))
result, err := signer.Sign([]byte(`{"resource":"new-reg","contact":["mailto:person@mail.com"],"agreement":"` + agreementURL + `"}`))
test.AssertNotError(t, err, "Failed to sign body")
wfe.NewRegistration(newRequestEvent(), responseWriter,
makePostRequest(result.FullSerialize()))
@ -806,7 +806,7 @@ func TestNewECDSARegistration(t *testing.T) {
signer.SetNonceSource(wfe.nonceService)
responseWriter := httptest.NewRecorder()
result, err := signer.Sign([]byte(`{"resource":"new-reg","contact":["tel:123456789"],"agreement":"` + agreementURL + `"}`))
result, err := signer.Sign([]byte(`{"resource":"new-reg","contact":["mailto:person@mail.com"],"agreement":"` + agreementURL + `"}`))
test.AssertNotError(t, err, "Failed to sign")
wfe.NewRegistration(newRequestEvent(), responseWriter, makePostRequest(result.FullSerialize()))
@ -814,7 +814,7 @@ func TestNewECDSARegistration(t *testing.T) {
err = json.Unmarshal([]byte(responseWriter.Body.String()), &reg)
test.AssertNotError(t, err, "Couldn't unmarshal returned registration object")
test.Assert(t, len(reg.Contact) >= 1, "No contact field in registration")
test.AssertEquals(t, reg.Contact[0].String(), "tel:123456789")
test.AssertEquals(t, reg.Contact[0].String(), "mailto:person@mail.com")
test.AssertEquals(t, reg.Agreement, "http://example.invalid/terms")
test.AssertEquals(t, reg.InitialIP.String(), "1.1.1.1")
@ -831,7 +831,7 @@ func TestNewECDSARegistration(t *testing.T) {
// Reset the body and status code
responseWriter = httptest.NewRecorder()
// POST, Valid JSON, Key already in use
result, err = signer.Sign([]byte(`{"resource":"new-reg","contact":["tel:123456789"],"agreement":"` + agreementURL + `"}`))
result, err = signer.Sign([]byte(`{"resource":"new-reg","contact":["mailto:person@mail.com"],"agreement":"` + agreementURL + `"}`))
wfe.NewRegistration(newRequestEvent(), responseWriter, makePostRequest(result.FullSerialize()))
test.AssertEquals(t, responseWriter.Body.String(), `{"type":"urn:acme:error:malformed","detail":"Registration key is already in use","status":409}`)
@ -854,7 +854,7 @@ func TestNewRegistration(t *testing.T) {
fooBody, err := signer.Sign([]byte("foo"))
test.AssertNotError(t, err, "Unable to sign")
wrongAgreementBody, err := signer.Sign([]byte(`{"resource":"new-reg","contact":["tel:123456789"],"agreement":"https://letsencrypt.org/im-bad"}`))
wrongAgreementBody, err := signer.Sign([]byte(`{"resource":"new-reg","contact":["mailto:person@mail.com"],"agreement":"https://letsencrypt.org/im-bad"}`))
test.AssertNotError(t, err, "Unable to sign")
type newRegErrorTest struct {
@ -926,7 +926,7 @@ func TestNewRegistration(t *testing.T) {
}
responseWriter := httptest.NewRecorder()
result, err := signer.Sign([]byte(`{"resource":"new-reg","contact":["tel:123456789"],"agreement":"` + agreementURL + `"}`))
result, err := signer.Sign([]byte(`{"resource":"new-reg","contact":["mailto:person@mail.com"],"agreement":"` + agreementURL + `"}`))
wfe.NewRegistration(newRequestEvent(), responseWriter,
makePostRequest(result.FullSerialize()))
@ -934,7 +934,7 @@ func TestNewRegistration(t *testing.T) {
err = json.Unmarshal([]byte(responseWriter.Body.String()), &reg)
test.AssertNotError(t, err, "Couldn't unmarshal returned registration object")
test.Assert(t, len(reg.Contact) >= 1, "No contact field in registration")
test.AssertEquals(t, reg.Contact[0].String(), "tel:123456789")
test.AssertEquals(t, reg.Contact[0].String(), "mailto:person@mail.com")
test.AssertEquals(t, reg.Agreement, "http://example.invalid/terms")
test.AssertEquals(t, reg.InitialIP.String(), "1.1.1.1")
@ -960,7 +960,7 @@ func TestNewRegistration(t *testing.T) {
// Reset the body and status code
responseWriter = httptest.NewRecorder()
// POST, Valid JSON, Key already in use
result, err = signer.Sign([]byte(`{"resource":"new-reg","contact":["tel:123456789"],"agreement":"` + agreementURL + `"}`))
result, err = signer.Sign([]byte(`{"resource":"new-reg","contact":["mailto:person@mail.com"],"agreement":"` + agreementURL + `"}`))
wfe.NewRegistration(newRequestEvent(), responseWriter,
makePostRequest(result.FullSerialize()))