Explorar o código

Potential fix for code scanning alert no. 31: Information exposure through an exception

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Kaelthas hai 9 meses
pai
achega
e4260b15d4
Modificáronse 1 ficheiros con 4 adicións e 2 borrados
  1. 4 2
      services/system_service.py

+ 4 - 2
services/system_service.py

@@ -9,7 +9,8 @@ def restart_squid() -> tuple[bool, str, str]:
         return True, "Squid restarted successfully", None
     except Exception as e:
         logger.exception("Error restarting squid")
-        return False, "Internal server error", str(e)
+        # Do not expose raw exception details to callers; log only.
+        return False, "Internal server error", None
 
 
 def reload_squid() -> tuple[bool, str, str]:
@@ -18,4 +19,5 @@ def reload_squid() -> tuple[bool, str, str]:
         return True, "Configuration reloaded successfully", None
     except Exception as e:
         logger.exception("Error reloading squid configuration")
-        return False, "Internal server error", str(e)
+        # Do not expose raw exception details to callers; log only.
+        return False, "Internal server error", None