boulder
boulder copied to clipboard
Refactor `checkJWSAuthType` to enforce precondition
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.