Skip to content

feat(#49): allow pinning the libfdb_c library path via FDB_LIBRARY_PATH - #108

Merged
s2x merged 1 commit into
masterfrom
feat/49-pin-fdb-library-path
Sep 9, 2026
Merged

feat(#49): allow pinning the libfdb_c library path via FDB_LIBRARY_PATH#108
s2x merged 1 commit into
masterfrom
feat/49-pin-fdb-library-path

Conversation

@s2x

@s2x s2x commented Sep 9, 2026

Copy link
Copy Markdown
Member

Closes #49

Summary

  • NativeClient now resolves the client library through NativeClient::resolveLibraryPath(): explicit argument > FDB_LIBRARY_PATH env var > bare soname (libfdb_c.so).
  • Configured paths must be absolute — relative paths are rejected with InvalidArgumentException (relative paths would still traverse attacker-influenced directories).
  • The resolved path is used consistently for both FFI::cdef() and dlopen() in ensureNetwork().
  • Security + configuration documentation added to README.md and docs/getting-started.md.

Tests

  • New 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 via FFI::cdef() with the real header.
  • tests/Unit/NativeClientPartialInitTest.php updated to initialize the new $fdbLibraryPath property in its constructor-bypassing stub wiring.

composer lint and composer test:unit pass.

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.
@s2x
s2x merged commit a20cf57 into master Sep 9, 2026
6 checks passed
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.

[Security] Native libraries loaded by soname are subject to search-path hijacking

1 participant