feat(#49): allow pinning the libfdb_c library path via FDB_LIBRARY_PATH - #108
Merged
Conversation
Loading libfdb_c.so by bare soname depends on the dynamic linker search path, which is subject to library search-path hijacking. NativeClient now resolves the library through NativeClient::resolveLibraryPath(): explicit argument > FDB_LIBRARY_PATH env var > bare soname. Configured paths must be absolute; the resolved path is used for both FFI::cdef() and dlopen(). Unit tests, README/getting-started security notes and a changelog entry added.
5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #49
Summary
NativeClientnow resolves the client library throughNativeClient::resolveLibraryPath(): explicit argument >FDB_LIBRARY_PATHenv var > bare soname (libfdb_c.so).InvalidArgumentException(relative paths would still traverse attacker-influenced directories).FFI::cdef()anddlopen()inensureNetwork().README.mdanddocs/getting-started.md.Tests
tests/Unit/NativeClientLibraryPathTest.php: default soname fallback, env-var override, explicit-argument precedence, empty-value fallback, relative-path rejection (env & argument), plus a functional test (skipped when libfdb_c is not installed) verifying the pinned absolute path loads viaFFI::cdef()with the real header.tests/Unit/NativeClientPartialInitTest.phpupdated to initialize the new$fdbLibraryPathproperty in its constructor-bypassing stub wiring.composer lintandcomposer test:unitpass.