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

scripts/http_server_auth.py: Add support for reading files on HTTP GET #377

Merged
merged 2 commits into from
Feb 24, 2024

Conversation

TheSomeMan
Copy link
Collaborator

No description provided.

@TheSomeMan TheSomeMan requested a review from ojousima February 21, 2024 06:09
Copy link
Member

@ojousima ojousima left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should guard against server giving out files outside of the file root. If I'm understanding the code correctly, someone could run GET ~/secret_file and server would return it.

Chances of it happening are low, but better to not leave such openings just in case.

@TheSomeMan
Copy link
Collaborator Author

This should guard against server giving out files outside of the file root. If I'm understanding the code correctly, someone could run GET ~/secret_file and server would return it.

Chances of it happening are low, but better to not leave such openings just in case.

I checked how it works for the paths with '..' or '~'. SimpleHTTPRequestHandler class has built-in measures to prevent directory traversal attacks, so we don't need to sanitize the path to ensure that it cannot navigate outside the current directory.
I added a comment to the code.

@TheSomeMan TheSomeMan requested a review from ojousima February 23, 2024 04:11
Copy link
Member

@ojousima ojousima left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

@TheSomeMan TheSomeMan merged commit fe7c464 into master Feb 24, 2024
2 checks passed
@TheSomeMan TheSomeMan deleted the update_script_http_server_auth branch February 24, 2024 08:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants