Skip to content

fulcio: remove ABC registration #1235

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 1 addition & 11 deletions sigstore/_internal/fulcio/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,11 +165,6 @@ def signature(self) -> bytes:
return self.digitally_signed[4:]


# SignedCertificateTimestamp is an ABC, so register our DetachedFulcioSCT as
# virtual subclass.
SignedCertificateTimestamp.register(DetachedFulcioSCT)


class ExpiredCertificate(Exception):
"""An error raised when the Certificate is expired."""

Expand Down Expand Up @@ -294,12 +289,7 @@ def post(
)

try:
sct_json = json.loads(base64.b64decode(sct_b64).decode())
except ValueError as exc:
raise FulcioClientError from exc

try:
sct = DetachedFulcioSCT.parse_obj(sct_json)
sct = DetachedFulcioSCT.model_validate_json(base64.b64decode(sct_b64))
except Exception as exc:
# Ideally we'd catch something less generic here.
raise FulcioClientError from exc
Expand Down
4 changes: 0 additions & 4 deletions test/unit/internal/fulcio/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
from cryptography.x509.certificate_transparency import (
LogEntryType,
SignatureAlgorithm,
SignedCertificateTimestamp,
Version,
)
from pydantic import ValidationError
Expand All @@ -48,9 +47,6 @@ def test_sct_hash_none(self):


class TestDetachedFulcioSCT:
def test_fulcio_sct_virtual_subclass(self):
assert issubclass(client.DetachedFulcioSCT, SignedCertificateTimestamp)

def test_fields(self):
blob = enc(b"this is a base64-encoded blob")
now = datetime.now(tz=timezone.utc)
Expand Down
Loading