We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 15c5e11 commit 17610e2Copy full SHA for 17610e2
backend/app/models/feed.py
@@ -157,10 +157,16 @@ class UpstreamError(Exception):
157
158
async def parse_feed(feed_url: HttpUrl) -> Feed:
159
"""Register a new feed."""
160
+ if feed_url.host and re.match(
161
+ r"^(25[0-5]|(2[0-4]|1\d|[1-9]|)\d)\.?\b", feed_url.host
162
+ ):
163
+ raise RuntimeError("Invalid URL")
164
async with ClientSession() as aiohttp_session:
165
try:
166
async with aiohttp_session.get(
- str(feed_url), headers={"User-agent": "Mozilla/5.0"}
167
+ str(feed_url),
168
+ headers={"User-agent": "Mozilla/5.0"},
169
+ allow_redirects=False,
170
) as response:
171
response.raise_for_status()
172
feed_response = await response.text()
0 commit comments