Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

acme: Return 501 for the key-change route #276

Merged
merged 2 commits into from
May 29, 2020
Merged

Conversation

dcow
Copy link
Contributor

@dcow dcow commented May 26, 2020

RFC 8555 § 7.3.5 is not listed as optional but we do not currently
support it. Rather than 404, return a 501 to inform clients that this
functionality is not yet implemented.

The notImplmented error type is not an official error registered in the
ietf:params:acme:error namespace, so prefix if with step:acme:error. An
ACME server is allowed to return other errors and clients should display
the message detail to users.

Fixes: #209

RFC 8555 § 7.3.5 is not listed as optional but we do not currently
support it. Rather than 404, return a 501 to inform clients that this
functionality is not yet implemented.

The notImplmented error type is not an official error registered in the
ietf:params:acme:error namespace, so prefix if with step:acme:error. An
ACME server is allowed to return other errors and clients should display
the message detail to users.

Fixes: #209
@dcow dcow requested a review from dopey May 26, 2020 08:48
@codecov-commenter
Copy link

codecov-commenter commented May 26, 2020

Codecov Report

Merging #276 into master will increase coverage by 0.24%.
The diff coverage is 35.29%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #276      +/-   ##
==========================================
+ Coverage   73.93%   74.17%   +0.24%     
==========================================
  Files          76       79       +3     
  Lines        8670     8964     +294     
==========================================
+ Hits         6410     6649     +239     
- Misses       1920     1974      +54     
- Partials      340      341       +1     
Impacted Files Coverage Δ
acme/api/handler.go 70.58% <0.00%> (-2.59%) ⬇️
acme/errors.go 36.73% <42.85%> (+0.09%) ⬆️
authority/provisioner/provisioner.go 40.63% <0.00%> (-5.14%) ⬇️
kms/uri/uri.go 100.00% <0.00%> (ø)
kms/awskms/awskms.go 95.53% <0.00%> (ø)
kms/awskms/signer.go 100.00% <0.00%> (ø)
kms/kms.go 85.71% <0.00%> (+5.71%) ⬆️
kms/apiv1/options.go 100.00% <0.00%> (+5.88%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ab0f2ae...a26b5f3. Read the comment docs.

acme/api/handler.go Outdated Show resolved Hide resolved
acme/api/handler.go Outdated Show resolved Hide resolved
acme/errors.go Outdated Show resolved Hide resolved
Copy link
Contributor

@dopey dopey left a comment

Choose a reason for hiding this comment

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

overall this looks good to me. You say that semantically it's a placeholder for something "we plan to implement", but we don't have any plans there that I know of. But that's semantics I suppose. Let me know about my other comments.

@@ -59,13 +59,15 @@ func (h *Handler) Route(r api.Router) {

r.MethodFunc("POST", getLink(acme.NewAccountLink, "{provisionerID}", false, nil), extractPayloadByJWK(h.NewAccount))
r.MethodFunc("POST", getLink(acme.AccountLink, "{provisionerID}", false, nil, "{accID}"), extractPayloadByKid(h.GetUpdateAccount))
r.MethodFunc("POST", getLink(acme.KeyChangeLink, "{provisionerID}", false, nil, "{accID}"), extractPayloadByKid(h.NotImplemented))
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Any reason to ExtractPayloadByKid if we're just going to respond 501? That method might return a 4xx instead of a 501. @dopey

Copy link
Contributor

Choose a reason for hiding this comment

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

what?

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh, sorry, were you just copying my comment to the right place?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I figure we do as much as we can until we hit the "not implemented" point. That way we don't expose anything that doesn't need to be.

@dcow
Copy link
Contributor Author

dcow commented May 27, 2020

@dopey is there any reason we wouldn't or shouldn't support it eventually? If so maybe there's a different way to communicate it. But AFAIU it's part of the spec and probably worth it to support at some point.

@dopey
Copy link
Contributor

dopey commented May 27, 2020

I'm guessing we would never support it if no one ever asks for it. It may not be a super useful feature for a private ACME server. New accounts are cheap, so maybe our stance will just be "create a new account".

Doesn't matter, I'm fine with 501. You've left good documentation for why you chose that and if someone has a problem with it downstream they can open an issue.

@dcow dcow requested a review from dopey May 28, 2020 00:12
@dcow
Copy link
Contributor Author

dcow commented May 28, 2020

@dopey reworded the comment to make sure a 501 in no way is a guarantee of future functionality.

Copy link
Contributor

@dopey dopey left a comment

Choose a reason for hiding this comment

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

lgtm

@dopey
Copy link
Contributor

dopey commented May 28, 2020

Looks like travis is failing so let's make sure we get that sorted before merging.

Add more specific wording describing what a 501 means and add more color
explaining how official vs unofficial error types should be handled.
@dcow dcow merged commit 30bfba4 into master May 29, 2020
@dcow dcow deleted the dcow/key-change-error branch May 29, 2020 00:11
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.

Account Key Rollover RFC 8555 § 7.3.5
3 participants