ephraimbuddy commented on code in PR #47577:
URL: https://github.com/apache/airflow/pull/47577#discussion_r1987653755
##########
airflow/api_fastapi/core_api/security.py:
##########
@@ -197,3 +199,26 @@ def _requires_access(
) -> None:
if not is_authorized_callback():
raise HTTPException(status.HTTP_403_FORBIDDEN, "Forbidden")
+
+
+def is_safe_url(target_url: str) -> bool:
+ """
+ Check that the URL is safe.
+
+ Needs to belong to the same domain as base_url, use HTTP or HTTPS (no
JavaScript/data schemes),
+ is a valid normalized path.
+ """
+ base_url = conf.get("api", "base_url")
+ parsed_base = urlparse(base_url)
Review Comment:
`werkzueg` has some url validation functions. We should use it if we have it
in our dependencies.
--
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]