Skip to content

Resolves Issue #344: Only send InternalServerError when needed - #354

Merged
rolandshoemaker merged 3 commits into
masterfrom
344-internal_server_errors
Jun 15, 2015
Merged

rolandshoemaker merged 3 commits into
masterfrom
344-internal_server_errors

Conversation

@jcjones

@jcjones jcjones commented Jun 12, 2015

Copy link
Copy Markdown
Contributor

Basically, just send InternalServerError when it indicates an internal state
was broken.

  • Also, unexported the wfe Challenge method that was only used internally, and looked dangerous with direct call-by-users semantics.

@jcjones

jcjones commented Jun 12, 2015

Copy link
Copy Markdown
Contributor Author

As a note to reviewers, InternalServerError is commonly intercepted by proxies and CDNs as indication that they should intervene, so this patch's purpose is to use it that way.

Comment thread ra/registration-authority.go Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As far as I can tell by this point we have checked all the fields which constitute the Authorization object we construct so the only errors returned should be internal SQL transaction ones, the full body of which we may not want to pass back to the user?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed. By using MalformedRequestError we are stating to the WFE that the error is safe to pass to the user. So we should probably replace this with a specific string (and log the error). There are a couple of other instances below.

@rolandshoemaker

Copy link
Copy Markdown
Contributor

All of the WFE changes look good to me, my one comment in the RA code goes for the other RA.SA methods being switch from InternalServerError -> MalformedRequestError.

Comment thread ra/registration-authority.go Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Side note net.LookupMX can return underlying transport errors not caused by the user, it can be checked for type *net.DNSError to see the internal error (no host/timeout/server issues/etc) but this probably isn't 100% necessary.

@jcjones

jcjones commented Jun 13, 2015

Copy link
Copy Markdown
Contributor Author

So looking through the RA again, @rolandshoemaker and @jsha , I changed about everything back to InternalServerError, and also saw that the reasoning -- that inputs were validated -- was untrue for UpdateRegistration. It turns out while on NewRegistration we make sure your contact info is acceptable, we do nothing on Update. So I tossed that in there too.
See what you think about the rework patch. I'm feeling much less confident about the RA changes here.

J.C. Jones added 2 commits June 13, 2015 00:21
Basically, just send InternalServerError when it indicates an internal state
was broken.
@rolandshoemaker

Copy link
Copy Markdown
Contributor

LGTM, good call on UpdateRegistration.

@jcjones

jcjones commented Jun 15, 2015

Copy link
Copy Markdown
Contributor Author

eh, I should pull that into a method. I'll do that real quick and submit another commit.

- Created a `validateContacts` method to avoid duplicated code
- Added tests for `validateContacts` and `validateEmail`
- Fix error formatting in `validateEmail`:
  Discovered while testing `validateEmail` that, if no MX records are found,
  `err` is returned, not an empty array. As such, the error message
   was misleading, so I consoldated the conditions into one.
@rolandshoemaker

Copy link
Copy Markdown
Contributor

Refactor + tests look good, merging.

rolandshoemaker added a commit that referenced this pull request Jun 15, 2015
Resolves Issue #344: Only send InternalServerError when needed
@rolandshoemaker
rolandshoemaker merged commit 01c41c1 into master Jun 15, 2015
@jcjones
jcjones deleted the 344-internal_server_errors branch June 16, 2015 00:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants