From aef65b1262291c203d446b990257fc358342eac3 Mon Sep 17 00:00:00 2001 From: Prathamesh Penshanwar <128643250+PRATHAM777P@users.noreply.github.com> Date: Fri, 1 May 2026 22:49:17 +0530 Subject: [PATCH] Potential fix for code scanning alert no. 2: Clear-text logging of sensitive information Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> --- tracerecon.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/tracerecon.py b/tracerecon.py index 23f7741..b3db115 100644 --- a/tracerecon.py +++ b/tracerecon.py @@ -104,8 +104,17 @@ def err(msg): print(f" {C.WHT}[{C.RED}✗{C.WHT}]{C.RST} {C.RED}{msg}{C.RST}") +def _sanitize_info_value(label: str, value): + """Mask sensitive values before printing to terminal output.""" + sensitive_labels = {"latitude", "longitude", "google maps"} + if isinstance(label, str) and label.strip().lower() in sensitive_labels: + return "[REDACTED]" + return value + + def info(label: str, value, label_color=C.WHT, val_color=C.GRN): - print(f" {label_color}{label:<22}{C.RST}: {val_color}{value}{C.RST}") + safe_value = _sanitize_info_value(label, value) + print(f" {label_color}{label:<22}{C.RST}: {val_color}{safe_value}{C.RST}") def save_result(filename: str, data: dict):