Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Validating provider description for urls in provider list view #40475

Merged
merged 2 commits into from
Jun 28, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion airflow/www/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
from json import JSONDecodeError
from pathlib import Path
from typing import TYPE_CHECKING, Any, Collection, Iterator, Mapping, MutableMapping, Sequence
from urllib.parse import unquote, urlencode, urljoin, urlsplit
from urllib.parse import unquote, urlencode, urljoin, urlparse, urlsplit

import configupdater
import flask.json
Expand Down Expand Up @@ -4514,6 +4514,13 @@ def _clean_description(self, description):
def _build_link(match_obj):
text = match_obj.group(1)
url = match_obj.group(2)

# parsing the url to check if ita a valid url
parsed_url = urlparse(url)
if not (parsed_url.scheme == "http" or parsed_url.scheme == "https"):
# returning the original raw text
return escape(match_obj.group(0))

ephraimbuddy marked this conversation as resolved.
Show resolved Hide resolved
return Markup(f'<a href="{url}">{text}</a>')

cd = escape(description)
Expand Down