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

Expose media endpoint only if RETURN_MEDIA_AS_URL is True #1415

Conversation

tadejmagajna
Copy link
Contributor

According to the documentation RETURN_MEDIA_AS_URL behaves as follows:

Set it to True to enable serving media files at a dedicated media endpoint. Defaults to False.

However, this is not entirely correct. Serving media files at a dedicated media endpoint is, in the current version of Eve, enabled regardless of what the value of RETURN_MEDIA_AS_URL is. This poses a serious security risk as most users that use RETURN_MEDIA_AS_BASE64_STRING = True won't be aware that their files can be served publicly via a url even if they explicitly set RETURN_MEDIA_AS_URL to False (it's False by default).

This change simply makes sure the media endpoint is enabled only if RETURN_MEDIA_AS_URL is True.

Side note: Current version of Eve does though allow us to disable the media endpoint by setting MEDIA_ENDPOINT to False, but this is an undocumented feature and users can only be made aware of it by browsing through this source code here. In order not to introduce too many breaking changes I decided to keep this code as is as it's unlikely to cause harm.

@nicolaiarocci nicolaiarocci added this to the 1.1.4 milestone Oct 22, 2020
nicolaiarocci added a commit that referenced this pull request Oct 22, 2020
@nicolaiarocci
Copy link
Member

rebased and merged, thank you!

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