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

#4844: File Inspector: Do not traverse above the base directory #4845

Merged
merged 1 commit into from
Aug 9, 2022

Conversation

Deltik
Copy link
Member

@Deltik Deltik commented Aug 8, 2022

Fixes: #4844

Motivation and Context

To prevent this error when open_basedir restriction in effect:

[Mon Aug 08 00:33:58.185203 2022] [php7:error] [pid xxxxxx] [client xxx.xxx.xxx.xxx:xxxxx] PHP Fatal error: Uncaught RuntimeException: SplFileInfo::isDir(): open_basedir restriction in effect. File(/var/www/www.mydomain.com/htdocs/..) is not within the allowed path(s): (/var/www/www.mydomain.com/htdocs/) in /var/www/www.mydomain.com/htdocs/e107_admin/fileinspector.php:608
Stack trace:
#0 /var/www/www.mydomain.com/htdocs/e107_admin/fileinspector.php(608): SplFileInfo->isDir()
#1 /var/www/www.mydomain.com/htdocs/e107_admin/fileinspector.php(594): file_inspector->inspect_existing()
#2 /var/www/www.mydomain.com/htdocs/e107_admin/fileinspector.php(932): file_inspector->inspect()
#3 /var/www/www.mydomain.com/htdocs/e107_admin/fileinspector.php(156): file_inspector->scan_results()
#4 /var/www/www.mydomain.com/htdocs/e107_handlers/admin_ui.php(1080): fileinspector_admin->init()
#5 /var/www/www.mydomain.com/htdocs/e107_admin/fileinspector.php(249): e_admin_dispatcher->__construct()
#6 {main}
 thrown in /var/www/www.mydomain.com/htdocs/e107_admin/fileinspector.php on line 608, referer: https://www.mydomain.com/e107_admin/fileinspector.php?core=none&type=tree&missing=1&noncore=1&oldcore=1&scan=a4807caec4e844118a8c837616354631&mode=main&action=run

Description

File Inspector will ignore the .. directory during the recursive directory iteration.

Types of Changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Performance enhancement (non-breaking change which improves efficiency)
  • Code cleanup (non-breaking change which makes code smaller or more readable)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation (a change to man pages or other documentation)

Checklist

@codeclimate
Copy link

codeclimate bot commented Aug 8, 2022

Code Climate has analyzed commit 8ae49c2 and detected 0 issues on this pull request.

The test coverage on the diff in this pull request is 0.0% (80% is the threshold).

This pull request will bring the total coverage in the repository to 34.7% (0.1% change).

View more on Code Climate.

@CaMer0n
Copy link
Member

CaMer0n commented Aug 9, 2022

Thank you @Deltik !

@CaMer0n CaMer0n merged commit 29331ea into e107inc:master Aug 9, 2022
@Deltik Deltik deleted the fix/4844 branch December 15, 2022 04:53
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.

File Inspector tries to traverse above the e107 docroot
2 participants