drupal/core-vendor-hardening
Composer plugin for Drupal that hardens the vendor directory by stripping unnecessary files such as tests, documentation, and version-control metadata from dependencies. It reduces deployment size and attack surface while keeping required code intact.
vendor/ inside the docroot is an architectural choice, usually made for you by shared hosting or a legacy single-docroot layout. This package is a compensating control for that choice, not a fix. Adopting it is effectively a decision to accept a weaker architecture and mitigate it, and that trade-off should be recorded in the risk register rather than absorbed silently into a Composer file..htaccess / web.config) where the server honors them. That is a demonstrable hardening step for a security questionnaire, even though its protection is partial and server-dependent.vendor/ and drop access-control files in place. An equivalent deploy-time script is maybe a day of engineering. Choosing the package trades ~1 day of code for an external dependency with 17 stars, GPL-2.0, and low activity. That is a legitimate PM call, but it should be made explicitly, not by default.allow-plugins entry and belongs in the supply-chain review alongside any other install-time hook.Adopt when:
Look elsewhere when:
public/; vendor/ is a sibling, not a descendant. There is nothing web-reachable to harden. This package's premise does not apply, and adding it would be cargo-culting a control against a threat you do not have..htaccess is not honored (nginx, or Apache with AllowOverride None). The bundled deny rules become dead weight; only the file pruning remains useful.To executives — one line: "It's a seatbelt, not a new car." A small Composer plugin that shrinks the blast radius if our third-party code is ever web-reachable. Low cost, no user-facing change, no performance impact. It does not fix the underlying exposure — it only narrows it — and we should describe it that way rather than report the risk as closed.
To engineering — differentiated by stack: For Drupal sites on restricted hosting where vendor/ genuinely sits under the docroot, adopt it as a pinned scaffolding dependency and move on. For our Laravel services, decline: the docroot already excludes vendor/, so there is no exposure and no benefit. If we ever land on single-docroot hosting, write a short deploy step — thirty lines, no license question, no external maintainer, and we control the PHP version support. Either way, route the install-time plugin execution through the allow-plugins review so it shows up in the supply-chain inventory.
How can I help you explore Laravel packages today?