diff --git a/backend/box/box.go b/backend/box/box.go index e932b0762..21fdcf6de 100644 --- a/backend/box/box.go +++ b/backend/box/box.go @@ -241,6 +241,9 @@ func getQueryParams(boxConfig *api.ConfigJSON) map[string]string { func getDecryptedPrivateKey(boxConfig *api.ConfigJSON) (key *rsa.PrivateKey, err error) { block, rest := pem.Decode([]byte(boxConfig.BoxAppSettings.AppAuth.PrivateKey)) + if block == nil { + return nil, errors.New("box: failed to PEM decode private key") + } if len(rest) > 0 { return nil, fmt.Errorf("box: extra data included in private key: %w", err) }