mirror of
https://github.com/reconurge/flowsint.git
synced 2026-11-08 14:35:41 -06:00
fix(security): pin minimum TLS version in get_domain_from_ssl
ssl.create_default_context() already excludes TLS1/1.1 by default in modern Python/OpenSSL, but CodeQL flags the implicit reliance on that default. Pin minimum_version explicitly instead of leaving it to library defaults.
This commit is contained in:
@@ -188,6 +188,7 @@ def extract_input_schema_flow(model: Type[BaseModel]) -> Dict[str, Any]:
|
||||
def get_domain_from_ssl(ip: str, port: int = 443) -> str | None:
|
||||
try:
|
||||
context = ssl.create_default_context()
|
||||
context.minimum_version = ssl.TLSVersion.TLSv1_2
|
||||
with socket.create_connection((ip, port), timeout=3) as sock:
|
||||
with context.wrap_socket(sock, server_hostname=ip) as ssock:
|
||||
cert = ssock.getpeercert()
|
||||
|
||||
@@ -240,6 +240,7 @@ def extract_input_schema_flow(model: Type[BaseModel]) -> Dict[str, Any]:
|
||||
def get_domain_from_ssl(ip: str, port: int = 443) -> str | None:
|
||||
try:
|
||||
context = ssl.create_default_context()
|
||||
context.minimum_version = ssl.TLSVersion.TLSv1_2
|
||||
with socket.create_connection((ip, port), timeout=3) as sock:
|
||||
with context.wrap_socket(sock, server_hostname=ip) as ssock:
|
||||
cert = ssock.getpeercert()
|
||||
|
||||
Reference in New Issue
Block a user