Skip to content
Open
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
6 changes: 3 additions & 3 deletions redis/ocsp.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
from urllib.parse import urljoin, urlparse

import cryptography.hazmat.primitives.hashes
import requests
from cryptography import hazmat, x509
from cryptography.exceptions import InvalidSignature
from cryptography.hazmat import backends
Expand All @@ -16,6 +15,7 @@
from cryptography.hazmat.primitives.serialization import Encoding, PublicFormat
from cryptography.x509 import ocsp
from redis.exceptions import AuthorizationError, ConnectionError
from security import safe_requests


def _verify_response(issuer_cert, ocsp_response):
Expand Down Expand Up @@ -268,7 +268,7 @@ def build_certificate_url(self, server, cert, issuer_cert):
def check_certificate(self, server, cert, issuer_url):
"""Checks the validity of an ocsp server for an issuer"""

r = requests.get(issuer_url)
r = safe_requests.get(issuer_url)
if not r.ok:
raise ConnectionError("failed to fetch issuer certificate")
der = r.content
Expand All @@ -281,7 +281,7 @@ def check_certificate(self, server, cert, issuer_url):
"Host": urlparse(ocsp_url).netloc,
"Content-Type": "application/ocsp-request",
}
r = requests.get(ocsp_url, headers=header)
r = safe_requests.get(ocsp_url, headers=header)
if not r.ok:
raise ConnectionError("failed to fetch ocsp certificate")
return _check_certificate(issuer_cert, r.content, True)
Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
python_requires=">=3.8",
install_requires=[
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This library holds security tools for protecting Python API calls.

License: MITOpen SourceMore facts

'async-timeout>=4.0.3; python_full_version<"3.11.3"',
"security==1.3.1",
],
classifiers=[
"Development Status :: 5 - Production/Stable",
Expand Down