Skip to content

Commit

Permalink
sigstore: lintage
Browse files Browse the repository at this point in the history
Signed-off-by: William Woodruff <william@trailofbits.com>
  • Loading branch information
woodruffw committed Dec 7, 2023
1 parent 470232c commit b46eac9
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
17 changes: 10 additions & 7 deletions sigstore/_internal/rekor/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,16 @@ class RekorClientError(Exception):
"""

def __init__(self, http_error: requests.HTTPError):
try:
error = rekor_types.Error.model_validate_json(http_error.response.text)
super().__init__(f"{error.code}: {error.message}")
except Exception:
super().__init__(
f"Rekor returned an unknown error with HTTP {http_error.response.status_code}"
)
if http_error.response:
try:
error = rekor_types.Error.model_validate_json(http_error.response.text)
super().__init__(f"{error.code}: {error.message}")
except Exception:
super().__init__(
f"Rekor returned an unknown error with HTTP {http_error.response.status_code}"
)
else:
super().__init__(f"Unexpected Rekor error: {http_error}")


class _Endpoint(ABC):
Expand Down
5 changes: 2 additions & 3 deletions sigstore/sign.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
from __future__ import annotations

import base64
import hashlib
import logging
from contextlib import contextmanager
from datetime import datetime, timezone
Expand Down Expand Up @@ -191,8 +190,8 @@ def sign(
raise e

# Verify the SCT
sct = certificate_response.sct # noqa
cert = certificate_response.cert # noqa
sct = certificate_response.sct
cert = certificate_response.cert
chain = certificate_response.chain

verify_sct(sct, cert, chain, self._signing_ctx._rekor._ct_keyring)
Expand Down

0 comments on commit b46eac9

Please sign in to comment.