Skip to content

Commit

Permalink
Fix crash
Browse files Browse the repository at this point in the history
  • Loading branch information
nabla-c0d3 committed Jan 3, 2025
1 parent 73f235a commit 6e1e213
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion sslyze/plugins/certificate_info/json_output.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,9 @@ class _OcspResponseAsJson(BaseModelWithOrmMode):
@model_validator(mode="before")
@classmethod
def _handle_object(cls, ocsp_response: ocsp.OCSPResponse) -> Any:
if not isinstance(ocsp_response, ocsp.OCSPResponse):
return ocsp_response

response_status = ocsp_response.response_status.name
if ocsp_response.response_status != ocsp.OCSPResponseStatus.SUCCESSFUL:
return dict(
Expand All @@ -228,7 +231,7 @@ def _handle_object(cls, ocsp_response: ocsp.OCSPResponse) -> Any:
serial_number=None,
)
return dict(
response_status=ocsp_response.response_status,
response_status=response_status,
certificate_status=ocsp_response.certificate_status,
revocation_time=ocsp_response.revocation_time_utc,
produced_at=ocsp_response.produced_at_utc,
Expand Down

0 comments on commit 6e1e213

Please sign in to comment.