Skip to content

feat: include ext-sodium - #1212

Open
Jean85 wants to merge 2 commits into
containerbase:mainfrom
Jean85:include-ext-sodium
Open

Jean85 wants to merge 2 commits into
containerbase:mainfrom
Jean85:include-ext-sodium

Conversation

@Jean85

@Jean85 Jean85 commented Dec 3, 2026

Copy link
Copy Markdown

Changes

Bundles ext-sodium by compiling with --with-sodium, since PHP has it in core since 7.2

Context

Please select one of the following:

  • This closes an existing Issue, Closes: ext-sodium is not bundled #1211
  • This doesn't close an Issue, but I accept the risk that this PR may be closed if maintainers disagree with its opening or implementation

AI assistance disclosure

Did you use AI tools to create any part of this pull request?

Please select one option and, if yes, briefly describe how AI was used (e.g., code, tests, docs) and which tool(s) you used.

  • No — I did not use AI for this contribution.
  • Yes — minimal assistance (e.g., IDE autocomplete, small code completions, grammar fixes).
  • Yes — substantive assistance (AI-generated non‑trivial portions of code, tests, or documentation).
  • Yes — other (please describe):

Use of AI in replying to PR comments

Who answers review comments:

  • @Jean85 will read and reply directly. Name the account.
  • An agent will draft replies and @Jean85 will read them before they are posted. Name the account.
  • An agent will draft replies and reply autonomously. This is heavily discouraged, and we prefer that there are humans in the loop
  • Nobody has explicitly committed to replying.

Documentation (please check one with an [x])

  • I have updated the documentation, or
  • No documentation update is required

How I've tested my work (please select one)

I have verified these changes via:

  • Code inspection only, or
  • Newly added/modified tests
  • CI build

@Jean85 Jean85 changed the title Include ext-sodium feat: include ext-sodium Dec 3, 2026
@Jean85
Jean85 marked this pull request as ready for review December 3, 2026 11:33
@Jean85

Jean85 commented Dec 3, 2026

Copy link
Copy Markdown
Author

@viceice can you approve the CI? I built it locally and it seems to work

@qodo-code-review

qodo-code-review Bot commented Dec 3, 2026 •

Copy link
Copy Markdown

PR Summary by Qodo

Bundle ext-sodium in PHP builds via --with-sodium

✨ Enhancement ⚙️ Configuration changes 🕐 Less than 5 minutes

Grey Divider

AI Description

• Adds --with-sodium to PHP configure options so ext-sodium is compiled in.
• Installs libsodium-dev in the builder setup so the sodium extension can build.
• Relies on sodium being in PHP core since 7.2; older PHP versions are not guarded.
Merge Risk 🟢 Low

Blast radius 🟢 Low 💥 1 capability

  • 1 affected end-to-end capability after fault-specific containment; implementation boundaries do not widen its functional scope.
  • The changed package installation and configure option jointly control one end-to-end outcome: the PHP binaries produced and packaged by this repository.
  • The propagation path terminates at that release capability; distro and architecture jobs are deployment variants of the same bounded integration, not independent functional scopes.
Sources

bin/builder.sh[64-64]

export PHP_BUILD_CONFIGURE_OPTS="--disable-intl --disable-cgi --disable-fpm --disable-phpdbg --disable-shared --enable-static --with-sodium" PHP_BUILD_XDEBUG_ENABLE=off

bin/install-builder.sh[38-39]

  libsodium-dev \
  libsodium23 \
Behavioral complexity 🟢 Low 🧩 Straightforward

  • Before, the builder installed general PHP build dependencies and configured a static PHP build without an explicit sodium option.
  • After, it adds libsodium-dev and libsodium23 and passes one additional configure flag.
  • The added correctness condition is that both package names and the configure option remain compatible with each supported PHP version and build image; no new state machine, concurrency protocol, transformation algorithm, or coordinated invariant is introduced.
Sources

bin/builder.sh[64-64]

export PHP_BUILD_CONFIGURE_OPTS="--disable-intl --disable-cgi --disable-fpm --disable-phpdbg --disable-shared --enable-static --with-sodium" PHP_BUILD_XDEBUG_ENABLE=off

bin/install-builder.sh[38-39]

  libsodium-dev \
  libsodium23 \
Potential damage 🟡 Medium 🩹 Temporary loss

  • If the package or configure behavior regresses, the PHP release may fail to build or may lack sodium support.
  • PHP itself and unrelated extensions remain available, so the affected capability is limited to sodium-enabled release production.
  • Reverting prevents future affected builds, but an already published artifact would need to be rebuilt and republished; the source does not establish automatic repair for consumers already adopting it.
  • A failed build can be rerun after reverting.
  • A successfully published artifact without the intended sodium capability requires a replacement build and release; downstream consumers would need to adopt that replacement.
Sources

bin/builder.sh[64-64]

export PHP_BUILD_CONFIGURE_OPTS="--disable-intl --disable-cgi --disable-fpm --disable-phpdbg --disable-shared --enable-static --with-sodium" PHP_BUILD_XDEBUG_ENABLE=off

bin/install-builder.sh[38-39]

  libsodium-dev \
  libsodium23 \
Assessed commit 3814a99
Diagram

graph TD
  A["install-builder.sh"] --> B["libsodium-dev package"] --> C["builder.sh"]
  C --> D["PHP_BUILD_CONFIGURE_OPTS"] --> E["php-build"] --> F["PHP binary with ext-sodium"]
Loading
High-Level Assessment

The PR uses the standard approach: enable the bundled PHP extension with --with-sodium and install the system libsodium headers. Alternatives such as a PECL install or a separate extension build are unnecessary since PHP 7.2+ bundles sodium in core. One gap remains: builds for PHP versions below 7.2 would fail or lack sodium, and the PR does not guard against them. If older versions are still built, add a version check around the flag.

Files changed (2) +2 / -1

Enhancement (2) +2 / -1
builder.shAdd --with-sodium to PHP configure options +1/-1

Add --with-sodium to PHP configure options

• Appends --with-sodium to PHP_BUILD_CONFIGURE_OPTS so php-build compiles the sodium extension into PHP.

bin/builder.sh

install-builder.shInstall libsodium-dev build dependency +1/-0

Install libsodium-dev build dependency

• Adds libsodium-dev to the apt-get install list so the sodium extension has the libsodium headers it needs to compile.

bin/install-builder.sh

@qodo-code-review

qodo-code-review Bot commented Dec 3, 2026 •

Copy link
Copy Markdown

Code Review by Qodo

🔗 Cross-repo conflicts (1)

Grey Divider


Action required

1. PHP needs missing runtime libsodium 🔗 Cross-repo conflict
Description
--with-sodium links PHP to system libsodium, but builder.sh archives only the PHP installation
directory, leaving the builder-installed library out of the release. When containerbase/base
installs the artifact without a matching libsodium runtime library, PHP can fail before any command
runs—including commands that do not use sodium—affecting its own tests, composer-prebuild, and
renovatebot/base-image.
Code

bin/builder.sh[64]

+export PHP_BUILD_CONFIGURE_OPTS="--disable-intl --disable-cgi --disable-fpm --disable-phpdbg --disable-shared --enable-static --with-sodium" PHP_BUILD_XDEBUG_ENABLE=off
Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Enabling sodium adds a runtime dependency on libsodium that is present in the builder image but absent from the release archive and containerbase/base's PHP runtime preparation. An extracted PHP release may therefore fail to start where the matching library is unavailable.

## Fix Focus Areas
- bin/builder.sh[64-78]
- bin/install-builder.sh[35-39]
- /cross_repos/base/src/cli/tools/php/index.ts[18-44]

## Recommended Fix
Install the matching libsodium runtime package through containerbase/base's PHP preparation for each supported distro before consumers adopt the artifacts. Alternatively, link libsodium statically or otherwise package PHP so the release does not depend on an unprovided system library. Check the extracted release's shared-library dependencies and verify that PHP starts in a clean consumer runtime image.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Dismiss ↗ | View ↗


Grey Divider

Tip of the day
💡 Did you know, you can move or hide resolved findings to focus on what still needs action

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

Comment thread bin/builder.sh Resolved
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.

ext-sodium is not bundled

1 participant