From c0dc60afbb5f053a88eba46f9917be86bb2d2324 Mon Sep 17 00:00:00 2001 From: Anton Petrov Date: Fri, 28 Aug 2026 21:02:38 +0300 Subject: [PATCH] Potential fix for code scanning alert no. 1: Information exposure through an exception Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> --- inventory/devices/utils.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/inventory/devices/utils.py b/inventory/devices/utils.py index ee64c58..5fbdcfa 100644 --- a/inventory/devices/utils.py +++ b/inventory/devices/utils.py @@ -1,8 +1,11 @@ +import logging import random from datetime import date from inventory.devices.models import Device +logger = logging.getLogger(__name__) + def create_devices_form_upload(sheet, business): """ @@ -58,8 +61,15 @@ def create_devices_form_upload(sheet, business): ) results.append({"device_name": row[0].value, "status": "success"}) except Exception as e: + logger.exception( + "Device import failed for device_name=%r", row[0].value, exc_info=e + ) results.append( - {"device_name": row[0].value, "status": "Error", "error": str(e)} + { + "device_name": row[0].value, + "status": "Error", + "error": "Device could not be imported due to invalid data.", + } ) continue