Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
4 changes: 2 additions & 2 deletions app/client/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "fireshare",
"version": "1.7.8",
"version": "1.7.9",
"private": true,
"dependencies": {
"@emotion/react": "^11.9.0",
Expand Down Expand Up @@ -39,4 +39,4 @@
"build": "vite build",
"preview": "vite preview"
}
}
}
10 changes: 7 additions & 3 deletions app/server/fireshare/api/game.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,15 +84,19 @@ def update_game_asset(steamgriddb_id):
if not url:
return Response(status=400, response='url is required.')

from urllib.parse import urlparse
# Validate with urllib3's parser (the one requests uses to connect), not
# urllib.parse — the two disagree on backslash handling, which lets a URL
# like https://127.0.0.1\@cdn.steamgriddb.com pass an urlparse hostname
# check while requests actually connects to 127.0.0.1 (SSRF).
from urllib3.util import parse_url
_ALLOWED_STEAMGRIDDB_HOSTS = {
'cdn2.steamgriddb.com',
'cdn.steamgriddb.com',
'steamgriddb.com',
}
try:
parsed = urlparse(url)
if parsed.scheme not in ('https',) or parsed.hostname not in _ALLOWED_STEAMGRIDDB_HOSTS:
parsed = parse_url(url)
if parsed.scheme not in ('https',) or parsed.host not in _ALLOWED_STEAMGRIDDB_HOSTS:
return Response(status=400, response='url must be a SteamGridDB asset URL.')
except Exception:
return Response(status=400, response='Invalid url.')
Expand Down
Loading