Skip to content

fix: pin plugin and theme sources and clone them as www-data - #45

Merged
YvesCesar merged 5 commits into
mainfrom
fix/pin-setup-sources
Nov 17, 2026
Merged

YvesCesar merged 5 commits into
mainfrom
fix/pin-setup-sources

Conversation

@YvesCesar

@YvesCesar YvesCesar commented Nov 14, 2026 •

Copy link
Copy Markdown
Member

The setup YAML could only point at moving targets: wordpress_custom_plugins and wordpress_custom_themes were cloned from the default branch, wordpress_archive_plugins installed whatever the URL returned and wordpress_org_plugins took the latest release. Nothing recorded or checked what ended up in wp-content, and the clone ran as root.

Changes

  • wordpress_custom_plugins and wordpress_custom_themes accept an optional ref. The repository is cloned as www-data, the ref is fetched from the configured source and checked out detached. Only a full commit SHA counts as a pin: HEAD is verified, a plugin that does not match is not activated, and an existing checkout at another commit is moved to it. A tag or branch is still checked out and followed on every start, but it is reported as movable, since it can point to another commit without any change to the configuration.
  • wordpress_archive_plugins accepts sha256: the archive is downloaded, checked and installed from the local file, and a mismatch skips the plugin. The checksum is recorded in .archive-sha256 inside the plugin folder (dotfiles are denied by nginx), so changing sha256 reinstalls the plugin from the new archive on the next start.
  • wordpress_org_plugins accepts a mapping with slug and version; an installed plugin at another version is reinstalled at the pinned one. Plain slugs keep working.
  • Entries without a pin, and Git entries whose ref is not a commit SHA, are reported in the log. WORDPRESS_SETUP_REQUIRE_PINNED=1 skips them instead (passed through common-services.yml, default 0).
  • README shows the new fields, recommends ref: <sha> # vX.Y.Z, and explains that pins belong to the project that supplies WORDPRESS_SETUP_CONFIG_YAML, which keeps them up to date (for example with Renovate). The values in the README and in the tests are only examples.

Tests

tests/security/pinned-setup-sources.bats runs the real entrypoint in the published image with a stubbed wp and local Git and archive sources: commit pins, a commit that cannot be fetched, moving an existing checkout, a pinned theme, a tag that moves between two starts, tags and commits under WORDPRESS_SETUP_REQUIRE_PINNED=1, the unpinned warning and skip, a pinned wordpress.org version, archives with a matching and a wrong checksum, and an archive whose checksum changes across starts. 11 of the 13 cases fail on main; the two that pass there only check that nothing is installed or activated. bats tests/security: 62/62; ShellCheck clean.

On a fresh stack with WooCommerce and WORDPRESS_SETUP_REQUIRE_PINNED=1: a GitHub plugin pinned to a commit is cloned at that commit, owned by www-data and activated, an unpinned one is skipped, WooCommerce pinned to the installed version is left alone, and login, wp-admin, /wp-json/, wp-cron.php, checkout and My Account keep working.

Signed-off-by: YvesCesar <yvesamorim73@gmail.com>
Base automatically changed from fix/local-only-password-reset to main November 14, 2026 14:22

@vitormattos vitormattos left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Renovate is already configured in renovate.json, but its only custom manager currently tracks WORDPRESS_BASE_IMAGE in the Docker publishing workflow. The new version, ref, and sha256 fields introduced here are not covered.

Could we extend the existing Renovate configuration to track real, version-controlled plugin and theme declarations, and validate dependency detection and update proposals with a dry run? WordPress.org plugin versions and Git tags/refs need appropriate data sources; archive URLs and SHA-256 values must only be updated together when a trustworthy checksum is available.

The values in the README and Bats tests are examples/fixtures and should not be treated as production dependencies. Since WORDPRESS_SETUP_CONFIG_YAML can be supplied externally, please also clarify where the actual dependency declarations will live and how Renovate can access them. Otherwise, adding a manager that only detects example values would not solve the maintenance problem.

Comment thread .docker/wordpress/entrypoint.sh Resolved
Comment thread .docker/wordpress/entrypoint.sh Resolved
Signed-off-by: YvesCesar <yvesamorim73@gmail.com>
Signed-off-by: YvesCesar <yvesamorim73@gmail.com>
Signed-off-by: YvesCesar <yvesamorim73@gmail.com>
Signed-off-by: YvesCesar <yvesamorim73@gmail.com>
@YvesCesar
YvesCesar merged commit d89e8ad into main Nov 17, 2026
4 checks passed
@YvesCesar
YvesCesar deleted the fix/pin-setup-sources branch November 17, 2026 21:12
@YvesCesar

YvesCesar commented Nov 17, 2026 •

Copy link
Copy Markdown
Member Author

On Renovate: I didn't add a manager here, since this repository only has example values, as you pointed out. The real declarations live in LibreSign/saas, in the WORDPRESS_SETUP_CONFIG_YAML of docker-compose.saas.yml. That repository already runs Renovate (git-tags with digest) for the two third-party plugins we pin, polylang-pro and woocommerce-subscriptions, through a version=… pin=… workaround in post_install_commands. Our own repositories intentionally follow main. 7f5c614 documents in the README that pins belong to the project supplying the YAML.

Now that this is merged, LibreSign/saas#39 moves those two entries to ref: <sha> # vX.Y.Z and updates its Renovate regex, validated with a dry run. There are no archive plugins there today, so the checksum and URL pairing doesn't apply yet.

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.

2 participants