From b7a195d3bced215bf4d197c867883c2277940b56 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sun, 15 Mar 2026 04:10:28 +0000 Subject: [PATCH] style: apply ruff auto-fix - Auto-formatted code with ruff format - Applied ruff linting fixes with --fix Co-authored-by: github-actions[bot] --- app/api/integrations.py | 2 +- app/api/url_upload.py | 1 - app/utils/network.py | 1 + 3 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/api/integrations.py b/app/api/integrations.py index ee5740cf..8d2d9209 100644 --- a/app/api/integrations.py +++ b/app/api/integrations.py @@ -564,7 +564,6 @@ def _test_webdav_connection(config: dict[str, Any] | None, credentials: dict[str return {"success": False, "message": "Missing required field: url"} # Only allow http/https to prevent file:// or other custom scheme attacks - import ipaddress from urllib.parse import urlparse parsed = urlparse(url) @@ -575,6 +574,7 @@ def _test_webdav_connection(config: dict[str, Any] | None, credentials: dict[str hostname = parsed.hostname or "" if hostname: from app.utils.network import is_private_ip + if is_private_ip(hostname): return {"success": False, "message": "URLs pointing to internal or private networks are not allowed"} diff --git a/app/api/url_upload.py b/app/api/url_upload.py index eaec0518..78598027 100644 --- a/app/api/url_upload.py +++ b/app/api/url_upload.py @@ -2,7 +2,6 @@ API endpoint for processing files from URLs """ -import ipaddress import logging import mimetypes import os diff --git a/app/utils/network.py b/app/utils/network.py index 6e988d32..7ea6d88b 100644 --- a/app/utils/network.py +++ b/app/utils/network.py @@ -4,6 +4,7 @@ import socket logger = logging.getLogger(__name__) + def is_private_ip(hostname: str) -> bool: """ Check if a hostname resolves to a private/internal IP address.