In case of SQL errors, exception/stack trace of errors was exposed in API even if "api/expose_stack_traces" was set to false. That could lead to exposing additional information to potential attacker. Users are recommended to upgrade to Apache Airflow 3.2.0, which fixes the issue.
https://lists.apache.org/thread/tp6kz1hnfb3zsrrtg19myo8x5x80w8r9