Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 6 additions & 13 deletions app/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,21 +134,14 @@ def test_connection():
if not success:
# Log the detailed error server-side
print(f"Sanitized error: {message}")
# Provide generic error for user
# Provide generic error for user, never send message details
user_message = "Connection test failed. Please check your details and try again or contact support."
return jsonify({'success': False, 'message': user_message})

# Only allow pre-approved success messages to be sent back to the user
allowed_success_prefixes = [
"Successfully connected",
"Connected, but domain",
"Connected, but domain",
]
result = {'success': False, 'message': user_message}
print(f"Sending response: {result}")
Copy link

Copilot AI Oct 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This debug print statement could expose sensitive information in logs. Consider using a proper logging framework with appropriate log levels instead of print statements, or remove this logging entirely if not needed for production.

Copilot uses AI. Check for mistakes.
return jsonify(result)

# Only allow strictly safe success message to be sent back to the user
Copy link

Copilot AI Oct 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Corrected grammar from 'strictly safe success message' to 'a strictly safe success message'.

Suggested change
# Only allow strictly safe success message to be sent back to the user
# Only allow a strictly safe success message to be sent back to the user

Copilot uses AI. Check for mistakes.
user_message = "Successfully connected to DirectAdmin."
for prefix in allowed_success_prefixes:
if message.startswith(prefix):
user_message = message
break
result = {
'success': True,
'message': user_message
Expand Down