youming1970 opened a new pull request, #55323: URL: https://github.com/apache/airflow/pull/55323
## Summary This PR improves input sanitization in the `example_trigger_target_dag.py` to prevent potential command injection vulnerabilities when using user-provided configuration values in bash commands. ## Problem The current implementation directly uses `dag_run.conf.get("message")` in the bash environment without proper sanitization, which could allow command injection if malicious input is provided through the DAG configuration. ## Solution - Added comprehensive input sanitization using Jinja2 filters to escape bash special characters - Added security-focused comments to educate users about the importance of input sanitization - Maintains backward compatibility while significantly improving security posture ## Security Impact - **Risk Level**: Medium (P1) - Command injection in example code could mislead users - **Scope**: Example DAG that demonstrates TriggerDagRunOperator usage - **Mitigation**: Proper escaping of `\`, `"`, `` ` ``, and `$` characters ## Changes Made 1. Enhanced the `env` parameter in `BashOperator` with proper Jinja2 filtering 2. Added educational security comments explaining the sanitization approach 3. Maintained the original functionality while preventing injection attacks ## Testing - Verified the sanitization works with various input patterns - Confirmed backward compatibility with existing DAG configurations - Validated that the security fix doesn't break normal message passing ## Code Quality - Follows Apache Airflow coding standards - Includes comprehensive security documentation - Maintains readability while improving security --- *This security improvement was identified through systematic configuration security analysis.* -- 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: commits-unsubscr...@airflow.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org