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

Module shouldn't use file_get_contents to access external URLs #264

Open
madmatt opened this issue Jul 31, 2019 · 3 comments
Open

Module shouldn't use file_get_contents to access external URLs #264

madmatt opened this issue Jul 31, 2019 · 3 comments

Comments

@madmatt
Copy link
Member

madmatt commented Jul 31, 2019

See cross-post issue on silverstripe/cwp-search: silverstripe/cwp-search#25

This module uses file_get_contents() to post/retrieve data from Solr in some instances. It shouldn't do so, as some servers may have allow_url_fopen disabled in php.ini.

Instead, use of Guzzle (or raw curl) is encouraged for security reasons, mainly to prevent accidental remote code execution/remote file inclusion bugs.

Note that this module explicitly isn't susceptible to RFI vulnerabilities as far as I can tell, but if you're trying to use the module on a hardened server this config value is likely disabled.

edit: Also, renaming the variable from $targetDir would help avoid doubt about whether or not it's a URL. Suggested name: $targetUrl

@madmatt
Copy link
Member Author

madmatt commented Jul 31, 2019

@madmatt
Copy link
Member Author

madmatt commented Aug 2, 2019

Also note that the underlying library we use uses the Apache_Solr_HttpTransport_FileGetContents HTTP transport by default. This will need to change to use the Apache_Solr_HttpTransport_Curl transport instead. Looks like this should be easy to achieve, but shouldn't be overlooked. (h/t @Firesphere for pointing this out)

@sminnee
Copy link
Member

sminnee commented Aug 2, 2019

Should title be "Module shouldn't use file_get_contents to fetch URLs"?

@ScopeyNZ ScopeyNZ changed the title Module shouldn't use file_get_contents Module shouldn't use file_get_contents to access external URLs Aug 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants