validate_usage: Exception on LDAP CRL URLs
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 28/100
Research direction
Trace validate_usage() through context.py retrieve_crls and crl_client.py _grab_crl, using the reported LDAP URL and urllib URLError as the starting case. Determine the intended behavior for LDAP CRL distribution points and define a regression test; done means validation no longer raises this undocumented exception and the chosen handling is covered.
Written by the indexing model from the issue text.
Description
Hi,
I try to validate the chain and usage of a certificate. The CA provides a CRL distribution point using HTTP and another one using LDAP. The later triggers an undocumented exception in certvalidator.validate_usage()
Code
usage=["digital_signature", "key_encipherment"]
validation_context = ValidationContext(
allow_fetching=True, revocation_mode="hard-fail"
)
validator = CertificateValidator(
end_entity_cert, intermediates, validation_context
)
validator.validate_usage(set(usage))
Extension
<Extension(oid=<ObjectIdentifier(oid=2.5.29.31, name=cRLDistributionPoints)>, critical=False, value=<CRLDistributionPoints([<DistributionPoint(full_name=[<UniformResourceIdentifier(value='http://crl.swisssign.net/3C9E527903636F4F9C811BD328700C245AEAA587')>], relative_name=None, reasons=None, crl_issuer=None)>, <DistributionPoint(full_name=[<UniformResourceIdentifier(value='ldap://directory.swisssign.net/CN=3C9E527903636F4F9C811BD328700C245AEAA587%2CO=SwissSign%2CC=CH?certificateRevocationList?base?objectClass=cRLDistributionPoint')>], relative_name=None, reasons=None, crl_issuer=None)>])>)>
Traceback
Traceback (most recent call last):
File "./check_wpa_eapol.py", line 314, in main
cert_file.file_name, hostname=realm, verbose=args.verbose
File "./check_wpa_eapol.py", line 152, in validate_certificate_chain
validator.validate_usage(set(usage))
File "/home/zeuz/git/wpa_eapol_checker/venv/lib64/python3.6/site-packages/certvalidator/__init__.py", line 193, in validate_usage
self._validate_path()
File "/home/zeuz/git/wpa_eapol_checker/venv/lib64/python3.6/site-packages/certvalidator/__init__.py", line 121, in _validate_path
validate_path(self._context, candidate_path)
File "/home/zeuz/git/wpa_eapol_checker/venv/lib64/python3.6/site-packages/certvalidator/validate.py", line 50, in validate_path
return _validate_path(validation_context, path)
File "/home/zeuz/git/wpa_eapol_checker/venv/lib64/python3.6/site-packages/certvalidator/validate.py", line 407, in _validate_path
end_entity_name_override=end_entity_name_override
File "/home/zeuz/git/wpa_eapol_checker/venv/lib64/python3.6/site-packages/certvalidator/validate.py", line 1211, in verify_crl
certificate_lists = validation_context.retrieve_crls(cert)
File "/home/zeuz/git/wpa_eapol_checker/venv/lib64/python3.6/site-packages/certvalidator/context.py", line 452, in retrieve_crls
**self._crl_fetch_params
File "/home/zeuz/git/wpa_eapol_checker/venv/lib64/python3.6/site-packages/certvalidator/crl_client.py", line 59, in fetch
output.append(_grab_crl(user_agent, url, timeout))
File "/home/zeuz/git/wpa_eapol_checker/venv/lib64/python3.6/site-packages/certvalidator/crl_client.py", line 86, in _grab_crl
response = urlopen(request, None, timeout)
File "/usr/lib64/python3.6/urllib/request.py", line 223, in urlopen
return opener.open(url, data, timeout)
File "/usr/lib64/python3.6/urllib/request.py", line 526, in open
response = self._open(req, data)
File "/usr/lib64/python3.6/urllib/request.py", line 549, in _open
'unknown_open', req)
File "/usr/lib64/python3.6/urllib/request.py", line 504, in _call_chain
result = func(*args)
File "/usr/lib64/python3.6/urllib/request.py", line 1419, in unknown_open
raise URLError('unknown url type: %s' % type)
urllib.error.URLError: <urlopen error unknown url type: ldap>
I'm unsure on how to handle this case. Just ignore the LDAP CRL? Issue a warning?
Workaround
Initialize validator with
validation_context = ValidationContext(
allow_fetching=False, revocation_mode="soft-fail"
)
- Dominant language
- Python
- Stars
- 117
- Forks
- 37
- PR merge metrics
- No merged PRs in 30d
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from wbond/certvalidator
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
wbond/certvalidator#46 ·
-
Difficulty 1/5 1-3 hours Newbie friendliness 65/100
wbond/certvalidator#44 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 65/100
wbond/certvalidator#22 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
wbond/certvalidator#11 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 35/100
wbond/certvalidator#56 · 1 comment ·
All issues in wbond/certvalidator
Similar issues
-
bug: conversation context selects the oldest thread messages instead of recent repliesPossibly taken @BLVCK-MAMBA-6 claimed this today. Openbug enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
AOSSIE-Org/SkillBot#74 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
bad-antics/lateralus-lang#1438 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 77/100
Maintainers usually reply within 1 day
-
area: control app
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
glossyio/traffic-monitor#415 ·
Maintainers usually reply within 1 day
-
apply_matrix_rect takes 6-9% of extract_text timePossibly taken @g4lb claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
pdfminer/pdfminer.six#1333 ·
Maintainers usually reply within 1 day