mirror of
https://github.com/atiilla/GeoIntel.git
synced 2026-04-26 08:05:58 +03:00
[PR #18] [MERGED] Potential fix for code scanning alert no. 35: Information exposure through an exception #17
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#17
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/18
Author: @atiilla
Created: 3/9/2026
Status: ✅ Merged
Merged: 3/9/2026
Merged by: @atiilla
Base:
main← Head:alert-autofix-35📝 Commits (1)
5cb6dbbPotential fix for code scanning alert no. 35: Information exposure through an exception📊 Changes
1 file changed (+4 additions, -2 deletions)
View changed files
📝
geointel/geointel.py(+4 -2)📄 Description
Potential fix for https://github.com/atiilla/GeoIntel/security/code-scanning/35
In general, to fix this type of issue you keep detailed exception information on the server (logs) and send only high-level, non-sensitive messages to clients. You avoid returning raw exception messages or stack traces, especially for generic exceptions.
For this codebase, the cleanest fix without changing functionality is:
geointel/geointel.py, change theGeoIntel.locateerror handling so that:GeoIntelError, still distinguish the error type, but do not exposestr(e)directly; instead send a stable, generic message while logging the detailed exception.Exception, do not returnstr(e)to the caller; instead return a generic “unexpected error” message, possibly with a non-sensitivedetailsfield like a static string or error code.geointel/web_server.py, keep the existinganalyze_imagelogic, but when'error' in result, ensure that the data fromlocateno longer contains raw exception text, so returning it is safe. No structural change is needed inanalyze_imageoncelocateis sanitized.Concretely:
GeoIntel.locate, update the twoexceptblocks:logger.error(..., exc_info=True))."error": a generic message (for example"GeoIntel processing error"or"An unexpected error occurred")."details": forGeoIntelError, a non-sensitive identifier such astype(e).__name__; for generic exceptions, a generic string like"Internal processing error"instead ofstr(e).No changes are needed to imports, and no new methods or external libraries are required.
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.