wbond / wbond/certvalidator

Fetching OCSP responses may result in TypeError

Open
#16 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
115
Forks
34
PR merge metrics
No merged PRs in 30d

Description

First of all, thank you for certvalidator! It makes an important task easy to complete in Python. 👍

While I was experimenting with certificate revocation status checking I ran into some issues. I'll create separate GitHub issues for those.


When certvalidator tries to fetch OCSP responses, but the certificate to be validated does not contain any reference to OCSP responders, TypeError is raised:

TypeError: exceptions must derive from BaseException

The root of that error is that cert.ocsp_urls returns an empty list, so at the end of the following code block None is raised:

https://github.com/wbond/certvalidator/blob/5bc5c390c1955195507c23db91b8926bb03f7385/certvalidator/ocsp_client.py#L89-L109

The cert.ocsp_urls == [] case could be handled here (for safety) e.g. by raising an appropriate error, but in that case ocsp_client.fetch probably shouldn't be called at all, since it can not return any meaningful result.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in certvalidator/ocsp_client.py around lines 89-109 and inspect how an empty cert.ocsp_urls list reaches the fetch logic. Reproduce validation with a certificate that has no OCSP responder reference, then define handling that avoids raising None as an exception and confirms ocsp_client.fetch is not called when no responder is available.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
security
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.