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

open_basedir restriction error #142

Open
m-overlund opened this issue Apr 13, 2023 · 4 comments
Open

open_basedir restriction error #142

m-overlund opened this issue Apr 13, 2023 · 4 comments

Comments

@m-overlund
Copy link

Keep getting these Warnings caused by Logger (Sentry) trying to access outside of public_html dir.
Seems to be caused by an empty variable used as argument in realpath() function.

realpath(): open_basedir restriction in effect. File(/var/www/[DOMAIN].com/) is not within the allowed path(s)

{
code: 2, 
/public_html/lib/sentry/lib/Raven/Client.php, 
line: 317
}
@m-overlund
Copy link
Author

AI suggests to change the function to:

    private static function _convertPath($value)
    {
        $allowedDirs = explode(PATH_SEPARATOR, ini_get('open_basedir'));

        foreach ($allowedDirs as $allowedDir) {
            if (strpos($value, $allowedDir) === 0) {
                $path = @realpath($value);
                if ($path === false) {
                    $path = $value;
                }
                // we need app_path to have a trailing slash otherwise
                // base path detection becomes complex if the same
                // prefix is matched
                if ($path[0] === DIRECTORY_SEPARATOR && substr($path, -1) !== DIRECTORY_SEPARATOR) {
                    $path .= DIRECTORY_SEPARATOR;
                }
                return $path;
            }
        }

        // If the $value is not within the allowed directories, return the original value
        return $value;
    }

However i'm not sure that's ideal.

@colinmollenhour
Copy link
Collaborator

Can you provide a stack trace?

@m-overlund
Copy link
Author

To the best of my knowledge, there hasn't been a "separate" stack trace.
However in all stack traces it appears in the breadcrumbs, in Sentry.

image

@colinmollenhour
Copy link
Collaborator

It is not clear from the info provided if the bug is in this module or Raven_Client. The Raven_Client library is old and probably no longer supported but there is a PR #141 that updates to use the latest SDK so that is probably worth trying.

As my PR #140 never got any review or merged I think this project is somewhat dead and I'm not a firegento maintainer... You're welcome to try my sentry-sdk-3 branch as well but it has not been tested on vanilla Magento so it may not work perfectly, it was developed for a different project based on a modified Magento platform.

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

No branches or pull requests

2 participants