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

Uncontrolled data used in path expression #1456

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
3 changes: 2 additions & 1 deletion web/api/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -1553,7 +1553,8 @@ def get(self, request):
return Response(response)
return Response(response)
except Exception as e:
response = {'status': False, 'message': str(e)}
logger.exception("An error occurred while detecting CMS")
response = {'status': False, 'message': 'An internal error has occurred!'}
return Response(response)


Expand Down
5 changes: 3 additions & 2 deletions web/reNgine/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@

@login_required
def serve_protected_media(request, path):
file_path = os.path.join(settings.MEDIA_ROOT, path)
file_path = os.path.normpath(os.path.join(settings.MEDIA_ROOT, path))
if not file_path.startswith(settings.MEDIA_ROOT):
raise Http404("File not found")
if os.path.isdir(file_path):
raise Http404("File not found")
if os.path.exists(file_path):
Expand All @@ -18,4 +20,3 @@ def serve_protected_media(request, path):
return response
else:
raise Http404("File not found")

Loading