From 0c4f8b43f9b7fe0fa3be211b143d49006d81dc7b Mon Sep 17 00:00:00 2001 From: VenkateshPabbati Date: Sat, 21 Feb 2026 11:36:01 +0530 Subject: [PATCH] Potential fix for code scanning alert no. 13: Information exposure through an exception Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com> --- .../hotel_booker_app/hotelbooker_core.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/contributing/samples/authn-adk-all-in-one/hotel_booker_app/hotelbooker_core.py b/contributing/samples/authn-adk-all-in-one/hotel_booker_app/hotelbooker_core.py index 8bf94632d8..3858286b63 100644 --- a/contributing/samples/authn-adk-all-in-one/hotel_booker_app/hotelbooker_core.py +++ b/contributing/samples/authn-adk-all-in-one/hotel_booker_app/hotelbooker_core.py @@ -131,8 +131,9 @@ def get_available_hotels(self, cursor, location=None): cursor.execute(query, params) rows = cursor.fetchall() return [dict(row) for row in rows], None - except sqlite3.Error as e: - return None, f"Error getting available hotels: {e}" + except sqlite3.Error: + logging.exception("Database error while getting available hotels.") + return None, "An internal error occurred while retrieving available hotels." def book_a_room( self, conn, hotel_id, guest_name, check_in_date, check_out_date, num_rooms @@ -259,5 +260,6 @@ def get_booking_details(self, cursor, booking_id=None, guest_name=None): bookings = [dict(row) for row in rows] return bookings if result_type == "list" else bookings[0], None - except sqlite3.Error as e: - return None, f"Error getting booking details: {e}" + except sqlite3.Error: + logging.exception("Database error while getting booking details.") + return None, "An internal error occurred while retrieving booking details."