Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Information exposure alert through an exception #1543 #1545

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,9 @@ def setup():
client = page.context.new_cdp_session(page) # talk to chrome devtools
client.send("Accessibility.enable") # to get AccessibilityTrees
except Exception as e:
logger.error("Failed to start session", exc_info=True)
return jsonify(
{"status": "error", "message": f"failed to start session (already started?): {e}"}
{"status": "error", "message": "failed to start session (already started?)"}
)
return jsonify({"status": "success", "message": "session started"})

Expand Down Expand Up @@ -116,10 +117,11 @@ def exec_command():
}
)
except TypeError as e:
logger.error(f"Error returning results for command: {request.json['command']}: {e}")
response = jsonify(
{
"status": "success",
"message": f"could not return results of executed commands {request.json['command']}",
"message": f"An internal error has occurred while returning the results",
"content": str(e),
"url": page.url,
}
Expand Down Expand Up @@ -161,10 +163,11 @@ def exec_commands():
}
)
except TypeError as e:
logger.error(f"Error returning results of executed commands: {e}")
response = jsonify(
{
"status": "success",
"message": f"could not return results of executed commands {request.json['commands']}",
"message": f"An internal error has occurred while returning the results",
"content": str(e),
"url": page.url,
}
Expand All @@ -188,7 +191,7 @@ def _execute_command(json_data: dict):
logger.error(e)
raise ValueError(
f"Error executing command {command}",
jsonify({"status": "error", "message": f"error executing command {command}: {e}"}),
jsonify({"status": "error", "message": f"An internal error has occurred while executing the command"}),
)


Expand Down