Hi @wfpeter,
Thanks to you and your team for giving this consideration, and for the feedback.
It’s a bit chicken-and-eggy, if you see what I mean.
The is_file()
call isn’t the only issue as the include
won’t work if the original file is outside of open_basedir
at that point.
It isn’t at that point. It is itself the file that sets open_basedir
, whereafter access to most of the filesystem is restricted. (I assume WordFence employs similar damage limitation.)
I have inserted the code that should have been at the top of wordfence-waf.php
:
if (\file_exists('/home/username/public_html/autoprepend.php')) {
include_once '/home/username/public_html/autoprepend.php';
}
I can confirm this seems to work fine.
FI: My own file has two purposes:
1. Set open_basedir
for damage limitation should one site be breached (with multiple sites on shared hosting);
2. Set error_log
based on hostname (this works once again).
I would maintain that the is_file()
test is a excessively redundant. I think the best solution would be for the UI/UX on installation to say something like “You already have an autoprepend file, but WF can’t access it. Are you sure it exists, and you want WF to include it?”
-
This reply was modified 2 years, 11 months ago by jqz.