mirror of
https://github.com/atiilla/GeoIntel.git
synced 2026-04-26 16:15:57 +03:00
[PR #19] [MERGED] Potential fix for code scanning alert no. 46: Information exposure through an exception #16
Labels
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/GeoIntel#16
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/atiilla/GeoIntel/pull/19
Author: @atiilla
Created: 3/9/2026
Status: ✅ Merged
Merged: 3/9/2026
Merged by: @atiilla
Base:
main← Head:alert-autofix-46📝 Commits (1)
36de946Potential fix for code scanning alert no. 46: Information exposure through an exception📊 Changes
1 file changed (+2 additions, -1 deletions)
View changed files
📝
geointel/web_server.py(+2 -1)📄 Description
Potential fix for https://github.com/atiilla/GeoIntel/security/code-scanning/46
In general, to fix information exposure via exceptions, log detailed exception messages and stack traces only on the server, and return generic, non-sensitive error messages to the client. Avoid including
str(e)or other raw exception data in HTTP responses.In this file, the problematic behavior is in the
except GeoIntelError as e:block of the/api/analyzeroute (lines 176–180). The fix is to stop returningstr(e)directly and instead (a) logeon the server and (b) send a generic, user-safe error message in the JSON response. The unexpected-exception handler directly below (lines 182–187) already follows this pattern and can serve as a template.Concretely, in
geointel/web_server.py, within theanalyze_imagefunction, adjust lines 176–180 so that:logger.error(f"GeoIntel error: {e}")(or similar).'GeoIntel processing error'or similar, and does not interpolateeat all.detailsstring), but not the exception message itself.No new imports or helper methods are strictly required; we can implement the fix with the existing
loggerand Flaskjsonify.Suggested fixes powered by Copilot Autofix. Review carefully before merging.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.