Skip to content

Commit

Permalink
fix: prevent CSS injection in profile banner filename filter (#9731)
Browse files Browse the repository at this point in the history
* fix the invaild check

* fix the insecure change
  • Loading branch information
TkzcM authored Nov 26, 2021
1 parent 6f5fdd0 commit 876baf9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion app/dashboard/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -5780,7 +5780,7 @@ def change_user_profile_banner(request):
try:
profile = profile_helper(handle, True)
is_valid = request.user.profile.id == profile.id
if filename[0:7] != '/static' or filename.split('/')[-1] not in load_files_in_directory('wallpapers'):
if filename[0:19] != '/static/wallpapers/' or filename[19:] not in load_files_in_directory('wallpapers'):
is_valid = False
if not is_valid:
return JsonResponse(
Expand Down

0 comments on commit 876baf9

Please sign in to comment.