Skip to content

Conversation

@Roopan-Microsoft
Copy link
Contributor

This PR includes,

  • Workflow addition/update
  • Docker integration
  • Lint issues fixed
  • Unit test cases added


return Response(stream_with_data(body, headers, endpoint, history_metadata), mimetype='text/event-stream')
return Response(
stream_with_data(body, headers, endpoint, history_metadata),

Check warning

Code scanning / CodeQL

Information exposure through an exception Medium

Stack trace information
flows to this location and may be exposed to an external user.
Stack trace information
flows to this location and may be exposed to an external user.

Copilot Autofix

AI 11 months ago

To fix the problem, we need to ensure that detailed exception messages are not exposed to the end user. Instead, we should log the detailed exception on the server and return a generic error message to the user. This can be achieved by modifying the exception handling in the fetchUserGroups function to log the exception and yield a generic error message.

  1. Modify the exception handling in the fetchUserGroups function to log the exception using the logging module.
  2. Return a generic error message to the user instead of the detailed exception message.
Suggested changeset 1
ResearchAssistant/App/app.py

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/ResearchAssistant/App/app.py b/ResearchAssistant/App/app.py
--- a/ResearchAssistant/App/app.py
+++ b/ResearchAssistant/App/app.py
@@ -338,3 +338,4 @@
         except Exception as e:
-            yield format_as_ndjson({"error" + str(e)})
+            logging.error("An error occurred: %s", str(e))
+            yield format_as_ndjson({"error": "An internal error has occurred."})
     else:
@@ -436,4 +437,4 @@
         except Exception as e:
-            yield format_as_ndjson({"error" + str(e)})
-
+            logging.error("An error occurred: %s", str(e))
+            yield format_as_ndjson({"error": "An internal error has occurred."})
 
EOF
@@ -338,3 +338,4 @@
except Exception as e:
yield format_as_ndjson({"error" + str(e)})
logging.error("An error occurred: %s", str(e))
yield format_as_ndjson({"error": "An internal error has occurred."})
else:
@@ -436,4 +437,4 @@
except Exception as e:
yield format_as_ndjson({"error" + str(e)})

logging.error("An error occurred: %s", str(e))
yield format_as_ndjson({"error": "An internal error has occurred."})

Copilot is powered by AI and may make mistakes. Always verify output.
@Roopan-Microsoft Roopan-Microsoft merged commit 3a019d7 into main Nov 26, 2024
10 checks passed
@github-actions
Copy link

🎉 This PR is included in version 1.0.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants