Andrushika commented on code in PR #76265:
URL: https://github.com/apache/airflow/pull/76265#discussion_r4451581762


##########
airflow-ctl/src/airflowctl/ctl/commands/task_command.py:
##########
@@ -99,7 +100,7 @@ def failed_deps(args, api_client=NEW_API_CLIENT) -> None:
     except ServerResponseError as e:
         if e.response.status_code == 404:
             rich.print(
-                f"[red]{_task_instance_not_found_message(args.dag_id, run_id, 
args.task_id, args.map_index, e)}[/red]"
+                f"[red]{escape(_task_instance_not_found_message(args.dag_id, 
run_id, args.task_id, args.map_index, e))}[/red]"

Review Comment:
   We might need a test for this call, and for the connections, auth and config 
ones too. Right now I can remove those escapes and the airflow-ctl tests still 
pass.
   



##########
airflow-ctl/src/airflowctl/ctl/commands/connection_command.py:
##########
@@ -91,9 +92,9 @@ def import_(args, api_client=NEW_API_CLIENT) -> None:
         )
         response = 
api_client.connections.bulk(BulkBodyConnectionBody(actions=[connection_create_action]))
         if response.create.errors:
-            rich.print(f"[red]Failed to import connections: 
{response.create.errors}[/red]")
+            rich.print(f"[red]Failed to import connections: 
{escape(str(response.create.errors))}[/red]")

Review Comment:
   We might need the same escape in `variable_command.py`, where `variables 
import` still prints the bulk `errors` unescaped. Variable keys can contain `[` 
and `/` but connection ids cannot, so the variables path is the one users can 
actually hit.
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to