The startswith condition added to the get workflows query when a workflow_id_prefix is set does not escape underscores (_) in the provided ID prefix. This leads to dangerously unexpected behaviour (e.g. workflow_id_prefix='user:1_' matching a workflow with ID user:12_34232).
The correct way to build a startswith query with an unsanitised input is:
query = query.where(
SystemSchema.workflow_status.c.workflow_uuid.startswith(
input.workflow_id_prefix, autoescape=True
)
)