boulder icon indicating copy to clipboard operation
boulder copied to clipboard

Refactor `checkJWSAuthType` to enforce precondition

Open aarongable opened this issue 4 years ago • 0 comments

func checkJWSAuthType(jws *jose.JSONWebSignature) (jwsAuthType, *probs.ProblemDetails) {
	// checkJWSAuthType is called after parseJWS() which defends against the
	// incorrect number of signatures.
	header := jws.Signatures[0].Header

This is an anti-pattern: it has a precondition which is (documented, but) not enforced. This should either enforce the precondition, or be refactored to take the Header as its argument directly, or something similar.

aarongable avatar Sep 29 '21 17:09 aarongable