only place can raise BadSignatureAlgorithmError is checkAlgorithm
https://github.com/letsencrypt/boulder/blob/main/wfe2/verify.go#L76
but because parseJWS dosen't call that function but using upstream error warped by malformed, because it jose.ParseSigned with whitelist of algorithms so anything outside of it will error out.
|
parsedJWS, err := jose.ParseSigned(bodyStr, getSupportedAlgs()) |
this cause malformed error on any jose verification error, include bad key type.
https://github.com/letsencrypt/boulder/blob/main/wfe2/verify.go#L347
but because WFE keyrollover calles parseJWS on innerJWS before validKeyRollover, parseJWS's malformed code hits and errors out, never get to checkAlgorithm about innerJWS
https://github.com/letsencrypt/boulder/blob/main/wfe2/wfe.go#L1869
this happens on other types of wfe requests too, because
wfe.parseJWSRequest called before wfe.validJWSForAccount / wfe.validSelfAuthenticatedJWS in validPOSTForAccount/validSelfAuthenticatedPOST
and parseJWSRequest -> parseJWS chain happens and short-circuit with malformed error because , and checkAlgorithm never called.
https://github.com/letsencrypt/boulder/blob/main/wfe2/verify.go#L619
https://github.com/letsencrypt/boulder/blob/main/wfe2/verify.go#L701
only place can raise BadSignatureAlgorithmError is checkAlgorithm
https://github.com/letsencrypt/boulder/blob/main/wfe2/verify.go#L76
but because parseJWS dosen't call that function but using upstream error warped by malformed, because it jose.ParseSigned with whitelist of algorithms so anything outside of it will error out.
boulder/wfe2/verify.go
Line 370 in 3438b05
this cause malformed error on any jose verification error, include bad key type.
https://github.com/letsencrypt/boulder/blob/main/wfe2/verify.go#L347
but because WFE keyrollover calles parseJWS on innerJWS before validKeyRollover, parseJWS's malformed code hits and errors out, never get to checkAlgorithm about innerJWS
https://github.com/letsencrypt/boulder/blob/main/wfe2/wfe.go#L1869
this happens on other types of wfe requests too, because
wfe.parseJWSRequest called before wfe.validJWSForAccount / wfe.validSelfAuthenticatedJWS in validPOSTForAccount/validSelfAuthenticatedPOST
and parseJWSRequest -> parseJWS chain happens and short-circuit with malformed error because , and checkAlgorithm never called.
https://github.com/letsencrypt/boulder/blob/main/wfe2/verify.go#L619
https://github.com/letsencrypt/boulder/blob/main/wfe2/verify.go#L701