potiuk commented on PR #31766: URL: https://github.com/apache/airflow/pull/31766#issuecomment-1580917260
Example failing build: https://github.com/apache/airflow/actions/runs/5199718582/jobs/9378018845 ``` =================================== FAILURES =================================== _ test_get_safe_url[ javascript:alert(1)-http://localhost:8080/ javascript:alert(1)] _ mock_url_for = <MagicMock name='url_for' id='139816089007056'> app = <Flask 'airflow.www.app'>, test_url = ' javascript:alert(1)' expected_url = 'http://localhost:8080/ javascript:alert(1)' @pytest.mark.parametrize( "test_url, expected_url", [ ("", "/home"), ("javascript:alert(1)", "/home"), (" javascript:alert(1)", "http://localhost:8080/ javascript:alert(1)"), ("http://google.com/", "/home"), ("google.com", "http://localhost:8080/google.com"), ("\\/google.com", "http://localhost:8080/\\/google.com"), ("//google.com", "/home"), ("\\/\\/google.com", "http://localhost:8080/\\/\\/google.com"), ("36539'%3balert(1)%2f%2f166", "/home"), ( "http://localhost:8080/trigger?dag_id=test&origin=36539%27%3balert(1)%2f%2f166&abc=2", "/home", ), ( "http://localhost:8080/trigger?dag_id=test_dag&origin=%2Ftree%3Fdag_id%test_dag';alert(33)//", "/home", ), ( "http://localhost:8080/trigger?dag_id=test_dag&origin=%2Ftree%3Fdag_id%3Dtest_dag", "http://localhost:8080/trigger?dag_id=test_dag&origin=%2Ftree%3Fdag_id%3Dtest_dag", ), ], ) @mock.patch("airflow.www.views.url_for") def test_get_safe_url(mock_url_for, app, test_url, expected_url): mock_url_for.return_value = "/home" with app.test_request_context(base_url="http://localhost:8080"): > assert get_safe_url(test_url) == expected_url E AssertionError: assert '/home' == 'http://local...ript:alert(1)/' E - http://localhost:8080/ javascript:alert(1) E + /home ``` -- 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]
