Skip to content

fix: harden console inspection, bundles.php loading and network-only activation - #39

Merged
brianvarskonst merged 4 commits into
mainfrom
fix/kernel-reaudit-followups
Nov 23, 2026
Merged

brianvarskonst merged 4 commits into
mainfrom
fix/kernel-reaudit-followups

Conversation

@brianvarskonst

Copy link
Copy Markdown
Member

Problem

From the Fable re-audit (2026-11-22) of sympress/kernel v1.1.17:

Fix

  • New internal Console\ConfiguredBuilder: it returns the live builder when that builder is already configured. Otherwise it configures a fresh builder on a clone of the container via KernelInterface::configureContainer(), so the live container is untouched. All three commands use it, and lint:container always compiles.
  • KernelConfigurationResolver::bundlesConfiguration() requires the file once per resolver. The kernel passes the result to BundleDiscovery through a new optional trailing constructor argument (BC: direct callers still get the file required for them).
  • PackageManagerActions::canRun('activate') also requires current_user_can('activate_plugin', $entry), and it rejects network-only plugins outside the network admin. That also hides the button.

Tests

Each test fails on main and passes on this branch:

  • tests/Console/WarmCacheInspectionTest.php: after a warm hit, --parameters lists kernel.project_dir, --types describes services_resetter, the yaml dump contains the console services, lint passes, and the live builder stays unconfigured. Lint with a runtime container plus a broken definition now returns 1. Each assertion fails on main on its own.
  • ConfigPrecedenceTest::testColdBootRequiresBundlesConfigurationOnce: main loads the file 2 times, this branch loads it once.
  • PackageManagerPageTest::testSiteAdminCannotActivateNetworkOnlyPlugin: on main, a site admin is allowed to activate a network-only plugin.
  • composer qa passes: CS clean, PHPStan max clean, 114 tests, 1 FPM-only skip. composer validate --strict is valid.

Release

Patch 1.1.18. chore(release): prepare kernel v1.1.18 adds the CHANGELOG entry. It covers this PR, #38 (cache fixes, merge first) and the unreleased CI commit 4ef88cf. No other version files exist.

A cold boot required config/bundles.php twice: once in bundle discovery
and once for the known environments in the kernel configuration. A
bundles.php that declares a function or class failed with "Cannot
redeclare".

KernelConfigurationResolver now loads the file once and the kernel
hands the result to BundleDiscovery through a new optional trailing
constructor argument. Direct BundleDiscovery callers still get the
file required for them.
On multisite, activate_plugin() activates a "Network: true" plugin
network-wide without a capability check. Core's plugins.php refuses that
outside the network admin (is_network_only_plugin()), but the package
page only checked activate_plugins, so a site admin with the plugins
menu enabled could activate such a SymPress package for the whole
network.

canRun() now mirrors core: it also requires the activate_plugin meta
capability for the entry and rejects network-only plugins outside the
network admin, which also hides the button.
App::boot() configures the builder only on a cache miss. After a warm
hit the builder is the bootstrap stub, so container:dump and
debug:container --parameters/--tag/--types/--env-vars showed almost
nothing, and lint:container reported "valid" without compiling because
a runtime container is always set after boot.

The commands now use ConfiguredBuilder, which returns the live builder
when it is configured and otherwise configures a fresh builder on a
clone of the container, leaving the live one untouched. lint:container
always compiles that builder.
@brianvarskonst
brianvarskonst merged commit bdb2008 into main Nov 23, 2026
3 checks passed
@brianvarskonst
brianvarskonst deleted the fix/kernel-reaudit-followups branch November 23, 2026 13:38
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.

1 participant