Explicitly ignore errors from writes to responses
Some checks failed
/ docker (push) Failing after 15m26s
Some checks failed
/ docker (push) Failing after 15m26s
This commit is contained in:
parent
ef95a0552d
commit
4a2462e24e
30 changed files with 280 additions and 237 deletions
|
@ -80,7 +80,7 @@ func BuildAuthorizedFetchCheck(forNonGet bool, forGet bool) webutils.HandlerBuil
|
|||
rawDate := r.Header.Get("Date")
|
||||
date, err := http.ParseTime(rawDate)
|
||||
if err != nil {
|
||||
webutils.ProblemDetails(
|
||||
_ = webutils.ProblemDetails(
|
||||
w,
|
||||
http.StatusBadRequest,
|
||||
"/errors/bad-date",
|
||||
|
@ -91,7 +91,7 @@ func BuildAuthorizedFetchCheck(forNonGet bool, forGet bool) webutils.HandlerBuil
|
|||
return
|
||||
}
|
||||
if time.Since(date) > time.Hour+time.Minute*5 {
|
||||
webutils.ProblemDetails(
|
||||
_ = webutils.ProblemDetails(
|
||||
w,
|
||||
http.StatusUnauthorized,
|
||||
"/errors/invalid-auth-signature",
|
||||
|
@ -105,7 +105,7 @@ func BuildAuthorizedFetchCheck(forNonGet bool, forGet bool) webutils.HandlerBuil
|
|||
if signatureHeader == "" {
|
||||
log.Debug().
|
||||
Msg("Received AP request without signature header where one is required")
|
||||
webutils.ProblemDetails(
|
||||
_ = webutils.ProblemDetails(
|
||||
w,
|
||||
http.StatusUnauthorized,
|
||||
"/errors/invalid-auth-signature",
|
||||
|
@ -123,7 +123,7 @@ func BuildAuthorizedFetchCheck(forNonGet bool, forGet bool) webutils.HandlerBuil
|
|||
log.Debug().
|
||||
Str("header", signatureHeader).
|
||||
Msg("Received signature with invalid pattern")
|
||||
webutils.ProblemDetails(
|
||||
_ = webutils.ProblemDetails(
|
||||
w,
|
||||
http.StatusUnauthorized,
|
||||
"/errors/invalid-auth-signature",
|
||||
|
@ -143,7 +143,7 @@ func BuildAuthorizedFetchCheck(forNonGet bool, forGet bool) webutils.HandlerBuil
|
|||
rawAlgorithm2 := match[4]
|
||||
signature, err := base64.StdEncoding.DecodeString(match[5])
|
||||
if err != nil {
|
||||
webutils.ProblemDetails(
|
||||
_ = webutils.ProblemDetails(
|
||||
w,
|
||||
http.StatusUnauthorized,
|
||||
"/errors/invalid-auth-signature",
|
||||
|
@ -167,7 +167,7 @@ func BuildAuthorizedFetchCheck(forNonGet bool, forGet bool) webutils.HandlerBuil
|
|||
_, err = url.Parse(rawKeyId)
|
||||
if err != nil {
|
||||
log.Debug().Err(err).Msg("Key id is not an url")
|
||||
webutils.ProblemDetails(
|
||||
_ = webutils.ProblemDetails(
|
||||
w,
|
||||
http.StatusUnauthorized,
|
||||
"/errors/invalid-auth-signature",
|
||||
|
@ -184,7 +184,7 @@ func BuildAuthorizedFetchCheck(forNonGet bool, forGet bool) webutils.HandlerBuil
|
|||
requestingActor, err := getRequestingActor(rawKeyId)
|
||||
if err != nil {
|
||||
log.Error().Err(err).Msg("Failed to get requesting actor")
|
||||
webutils.ProblemDetails(
|
||||
_ = webutils.ProblemDetails(
|
||||
w,
|
||||
http.StatusUnauthorized,
|
||||
"/errors/invalid-auth-signature",
|
||||
|
@ -206,7 +206,7 @@ func BuildAuthorizedFetchCheck(forNonGet bool, forGet bool) webutils.HandlerBuil
|
|||
rawKey, err := x509.ParsePKIXPublicKey(requestingActor.PublicKeyRsa)
|
||||
if err != nil {
|
||||
log.Warn().Err(err).Msg("Failed to parse public key of requesting actor")
|
||||
webutils.ProblemDetails(
|
||||
_ = webutils.ProblemDetails(
|
||||
w,
|
||||
http.StatusUnauthorized,
|
||||
"/errors/invalid-auth-signature",
|
||||
|
@ -220,7 +220,7 @@ func BuildAuthorizedFetchCheck(forNonGet bool, forGet bool) webutils.HandlerBuil
|
|||
key, ok = rawKey.(*rsa.PublicKey)
|
||||
if !ok {
|
||||
log.Warn().Msg("Received public key is not rsa")
|
||||
webutils.ProblemDetails(
|
||||
_ = webutils.ProblemDetails(
|
||||
w,
|
||||
http.StatusUnauthorized,
|
||||
"/errors/invalid-auth-signature",
|
||||
|
@ -235,7 +235,7 @@ func BuildAuthorizedFetchCheck(forNonGet bool, forGet bool) webutils.HandlerBuil
|
|||
err = rsa.VerifyPKCS1v15(key, crypto.SHA256, hash[:], []byte(signature))
|
||||
if err != nil {
|
||||
log.Warn().Err(err).Msg("Signature verification failed")
|
||||
webutils.ProblemDetails(
|
||||
_ = webutils.ProblemDetails(
|
||||
w,
|
||||
http.StatusUnauthorized,
|
||||
"/errors/invalid-auth-signature",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue