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

File(/etc/machine-id) is not within the allowed path(s) #1450

Open
ZebraNorth opened this issue Dec 11, 2024 · 3 comments · May be fixed by #1451 or #1454
Open

File(/etc/machine-id) is not within the allowed path(s) #1450

ZebraNorth opened this issue Dec 11, 2024 · 3 comments · May be fixed by #1451 or #1454
Labels
bug Something isn't working

Comments

@ZebraNorth
Copy link

Describe your environment Describe any aspect of your environment relevant to the problem, including your php version (php -v will tell you your current version), version numbers of installed dependencies, information about your cloud hosting provider, etc. If you're reporting a problem with a specific version of a library in this repo, please check whether the problem has been fixed on master.

Linux, PHP 8.3.11, Laravel 11, opentelemetry-sdk v1.1.2

Steps to reproduce
Describe exactly how to reproduce the error. Include a code sample if applicable.

Edit php.ini to include open_basedir=/var/www

What is the expected behavior?
What did you expect to see?

The site should continue to work as before.

What is the actual behavior?
What did you see instead?

During page load, the following exception is thrown:

is_file(): open_basedir restriction in effect. File(/etc/machine-id) is not within the allowed path(s):

OpenTelemetry\SDK\Resource\Detectors\Host
:58
getLinuxId
 
OpenTelemetry\SDK\Resource\Detectors\Host
:42
getMachineId
 
OpenTelemetry\SDK\Resource\Detectors\Host
:33
getResource
 
OpenTelemetry\SDK\Resource\Detectors\Composite
:24
getResource
 
OpenTelemetry\SDK\Resource\ResourceInfoFactory
:38
defaultResource
 
Stickee\Instrumentation\Laravel\ServiceProvider
:158
Stickee\Instrumentation\Laravel\{closure}
 
Illuminate\Container\Container
:937
build
 
Illuminate\Container\Container
:819
resolve
 
Illuminate\Foundation\Application
:1048
resolve
 
Illuminate\Container\Container
:755
make
 
Illuminate\Foundation\Application
:1030
make
 
PlunkettScott\LaravelOpenTelemetry\Otel
:39
start
 
PlunkettScott\LaravelOpenTelemetry\OtelServiceProvider
:26
boot
 
Illuminate\Container\BoundMethod
:36
Illuminate\Container\{closure}
 
Illuminate\Container\Util
:43
unwrapIfClosure
 
Illuminate\Container\BoundMethod
:95
callBoundMethod
 
Illuminate\Container\BoundMethod
:35
call
 
Illuminate\Container\Container
:694
call
 
Illuminate\Foundation\Application
:1121
bootProvider
 
Illuminate\Foundation\Application
:1102
array_walk
 
Illuminate\Foundation\Application
:1101
boot
 
Illuminate\Foundation\Bootstrap\BootProviders
:17
bootstrap
 
Illuminate\Foundation\Application
:316
bootstrapWith
 
Illuminate\Foundation\Http\Kernel
:187
bootstrap
 
Illuminate\Foundation\Http\Kernel
:171
sendRequestThroughRouter
 
Illuminate\Foundation\Http\Kernel
:145
handle
 
Illuminate\Foundation\Application
:1190
handleRequest
 
public/index.php
:17

Additional context
Add any other context about the problem here.

@ZebraNorth ZebraNorth added the bug Something isn't working label Dec 11, 2024
@ZebraNorth ZebraNorth linked a pull request Dec 11, 2024 that will close this issue
@brettmc
Copy link
Collaborator

brettmc commented Dec 11, 2024

Which version of PHP is this? in 8.3, I don't see an exception but rather warning and is_file returns false, which is what the docs say should happen:

$ php -d open_basedir=/usr/src/myapp -a
Interactive shell

php > var_dump(is_file('/tmp/foo'));

Warning: is_file(): open_basedir restriction in effect. File(/tmp/foo) is not within the allowed path(s): (/usr/src/myapp) in php shell code on line 1
bool(false)

@ZebraNorth
Copy link
Author

Ah yes I've been using an error handler for so long that I forgot it wasn't enabled by default. The failure emits a warning, which will trigger the error handler if you or your framework use set_error_handler().

This means that any site using an error handler (such as Laravel) will fail to load any page as soon as OpenTelemetry is installed.

@brettmc
Copy link
Collaborator

brettmc commented Dec 13, 2024

@ZebraNorth does the test in #1454 accurately replicate your setup?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
2 participants