XD-DENG commented on a change in pull request #14698:
URL: https://github.com/apache/airflow/pull/14698#discussion_r591712047
##########
File path: tests/www/test_views.py
##########
@@ -3330,7 +3361,36 @@ class TestHelperFunctions(TestBase):
]
)
@mock.patch("airflow.www.views.url_for")
- def test_get_safe_url(self, test_url, expected_url, mock_url_for):
+ @pytest.mark.skipif(
+ sys.version_info < (3, 8, 8),
+ reason='Vulnerability was fixed in Python 3.8.8 which changed the
query string separator: bpo-42967',
+ )
+ def test_get_safe_url_py_lte_387(self, test_url, expected_url,
mock_url_for):
+ mock_url_for.return_value = "/home"
+ with self.app.test_request_context(base_url="http://localhost:8080"):
+ assert get_safe_url(test_url) == expected_url
+
+ @parameterized.expand(
+ [
+ ("", "/home"),
+ ("http://google.com", "/home"),
+ (
+
"http://localhost:8080/trigger?dag_id=test_dag&origin=%2Ftree%3Fdag_id%test_dag';alert(33)//",
+
"http://localhost:8080/trigger?dag_id=test_dag&origin=%2Ftree%3F"
+ "dag_id%25test_dag%27&alert%2833%29%2F%2F=",
Review comment:
This line is missed to be updated?
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]