Skip to content

Conversation

@yogeshojha
Copy link
Owner

Fixes a security issue in nginx that allowed media directives to be accessed by non auth users.

Used X-Accel-Redirect as suggested by @0xtejas . Thank you 🥳

Reported by @confd0

@yogeshojha yogeshojha linked an issue Jul 4, 2024 that may be closed by this pull request
1 task
@github-actions
Copy link
Contributor

github-actions bot commented Jul 4, 2024

👋 Hi @yogeshojha,
Thank you for sending this pull request.
Please make sure you have followed our contribution guidelines.
We will review this PR as soon as possible. Thank you for your patience.

@login_required
def serve_protected_media(request, path):
file_path = os.path.join(settings.MEDIA_ROOT, path)
if os.path.isdir(file_path):

Check failure

Code scanning / CodeQL

Uncontrolled data used in path expression

This path depends on a [user-provided value](1).
file_path = os.path.join(settings.MEDIA_ROOT, path)
if os.path.isdir(file_path):
raise Http404("File not found")
if os.path.exists(file_path):

Check failure

Code scanning / CodeQL

Uncontrolled data used in path expression

This path depends on a [user-provided value](1).
@yogeshojha yogeshojha self-assigned this Jul 4, 2024
@yogeshojha yogeshojha merged commit ca8389b into master Jul 5, 2024
@yogeshojha yogeshojha deleted the 1202-bug-risk-of-leaking-the-scan-result-files branch July 19, 2024 05:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: Risk of leaking the scan result files

2 participants