Skip to content

Commit 0f95acb

Browse files
security: add timeouts to HTTP requests to prevent DoS via slow servers
Adds a 30-second timeout to requests.get() calls in cache.py and common.py to prevent indefinite hanging when remote servers are unresponsive. This mitigates potential denial-of-service via slow or malicious endpoints.
1 parent 628d400 commit 0f95acb

2 files changed

Lines changed: 5 additions & 2 deletions

File tree

src/data_profiling/utils/cache.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@
22
import zipfile
33
from pathlib import Path
44

5-
from requests import get as get_file
5+
from functools import partial
6+
from requests import get as _get_file
7+
8+
get_file = partial(_get_file, timeout=30)
69

710
from data_profiling.utils.paths import get_data_path
811

src/data_profiling/utils/common.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ def analytics_features(
102102
f"&dbx={dbx}"
103103
)
104104

105-
requests.get(request_message)
105+
requests.get(request_message, timeout=30)
106106

107107

108108
def is_running_in_databricks():

0 commit comments

Comments
 (0)