Skip to content

Commit

Permalink
fix(controller/main.py): Validate UUID before trying to retrieve it
Browse files Browse the repository at this point in the history
This commit provides a graceful error message when supplied UUID for a
test is invalid for /tests/$plugin/$uuid endpoint.

Fixes scylladb#527
  • Loading branch information
k0machi committed Dec 16, 2024
1 parent 420b826 commit 9350f8b
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions argus/backend/controller/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@ def runs(test_id: UUID):
@bp.route("/tests/<string:plugin_name>/<string:run_id>")
@login_required
def get_run_by_plugin(plugin_name: str, run_id: UUID | str):
try:
run_id = UUID(run_id)
except ValueError:
flash(message=f"Invalid UUID: {run_id}", category="error")
return redirect(url_for("main.error", type=404))
run = TestRunService().get_run(plugin_name, run_id)
return render_template("run_view_by_plugin.html.j2", run=run)

Expand Down

0 comments on commit 9350f8b

Please sign in to comment.