Heimdall: A Minimum Age Policy for Your Composer Dependencies

Last updated on by

Heimdall: A Minimum Age Policy for Your Composer Dependencies image

Most malicious Composer releases get reported and pulled within a day or two of going up. Heimdall, a plugin from Encore Digital Group, takes advantage of that by making your project wait. Set a number of days, and it won't install any version younger than that. The name comes from the Norse watchman who guarded the bridge into Asgard, and the package description carries the metaphor through: the bridge here is the one between Packagist and your vendor/ directory.

Setting a Minimum Package Age

Configuration goes under extra.heimdall in your composer.json. The minimum_age key takes a number of days:

{
"extra": {
"heimdall": {
"minimum_age": 7
}
}
}

Now a package released three days ago won't get installed. Composer falls back to the newest version that's old enough and carries on. If you leave minimum_age out, the plugin does nothing, so there's no policy until you ask for one.

Trusting Vendors and Packages

A flat rule across every dependency is going to annoy you eventually. It stalls your own packages for a week, and it stalls the security patch you actually want today. Heimdall lets you create exceptions by vendor or by individual package:

{
"extra": {
"heimdall": {
"minimum_age": 7,
"trusted": {
"vendors": [
"encoredigitalgroup"
],
"packages": [
"acme/widgets"
]
}
}
}
}

Anything matching a trusted vendor or listed in trusted.packages skips the age check. Everything else still has to wait.

Filtering Before the Solver Runs

Heimdall does its work on Composer's PluginEvents::PRE_POOL_CREATE, which fires before the dependency solver starts. Versions that are too new get dropped from the candidate pool, so the solver never considers them in the first place. You end up with an ordinary install result instead of an error after the fact, and resolution stays deterministic.

Need to skip the policy once? composer install --no-plugins turns Heimdall off along with every other plugin.

Installation

You'll need PHP 8.4 or newer and Composer 2.0 or later:

composer require encoredigitalgroup/heimdall

Composer will ask whether to allow the plugin to run. Say yes, add your extra.heimdall block, and the policy applies from the next install or update onward.

How This Compares to Composer's Own Policies

Composer and Packagist have both tightened up on supply chain security lately. Composer 2.10 introduced a policy config block for security advisories, abandoned packages, and versions flagged as malware. Packagist.org wired in Aikido malware detection and stopped stable versions from being quietly rewritten by re-tagging. Every one of those depends on someone knowing something is wrong first.

A compromised release does most of its damage in the first few hours, before there's an advisory or a malware flag to go on. Heimdall doesn't need either one. All it looks at is the publish date. Packagist makes the same point in its update on Composer and Packagist supply chain security, where a minimum release age shows up on the list of things still to come.

Composer does plan to handle this itself. The config docs already reserve the name minimum-release-age, so you can't use it for a custom policy, and PR #12692 from Viktor Djupsjöbacka adds a cooldown policy for exactly this. As of this writing, it's milestoned for Composer 2.11. Heimdall gets you there sooner, and it runs on Composer 2.0 and up if you're not on the newest release.

You can learn more about this package, get full installation instructions, and view the source code on the Heimdall GitHub repository.

Yannick Lyn Fatt photo

Staff Writer at Laravel News and Full stack web developer.

Cube

Laravel Newsletter

Join 40k+ other developers and never miss out on new tips, tutorials, and more.

image
Tinkerwell

Enjoy coding and debugging in an editor designed for fast feedback and quick iterations. It's like a shell for your application – but with multi-line editing, code completion, and more.

Visit Tinkerwell
SaaSykit: Laravel SaaS Starter Kit logo

SaaSykit: Laravel SaaS Starter Kit

SaaSykit is a Multi-tenant Laravel SaaS Starter Kit that comes with all features required to run a modern SaaS. Payments, Beautiful Checkout, Admin Panel, User dashboard, Auth, Ready Components, Stats, Blog, Docs and more.

SaaSykit: Laravel SaaS Starter Kit
Lucky Media logo

Lucky Media

Get Lucky Now - the ideal choice for Laravel Development, with over a decade of experience!

Lucky Media
Laravel Cloud logo

Laravel Cloud

Easily create and manage your servers and deploy your Laravel applications in seconds.

Laravel Cloud
Shift logo

Shift

Running an old Laravel version? Instant, automated Laravel upgrades and code modernization to keep your applications fresh.

Shift
Acquaint Softtech logo

Acquaint Softtech

Acquaint Softtech offers AI-ready Laravel developers who onboard in 48 hours at $3000/Month with no lengthy sales process and a 100 percent money-back guarantee.

Acquaint Softtech
No Compromises logo

No Compromises

Joel and Aaron, the two seasoned devs from the No Compromises podcast, are now available to hire for your Laravel project. ⬧ Flat rate of $9500/mo. ⬧ No lengthy sales process. ⬧ No contracts. ⬧ 100% money back guarantee.

No Compromises
Harpoon: Next generation time tracking and invoicing logo

Harpoon: Next generation time tracking and invoicing

The next generation time-tracking and billing software that helps your agency plan and forecast a profitable future.

Harpoon: Next generation time tracking and invoicing
Kirschbaum logo

Kirschbaum

Providing innovation and stability to ensure your web application succeeds.

Kirschbaum
PhpStorm logo

PhpStorm

The go-to PHP IDE with extensive out-of-the-box support for Laravel and its ecosystem.

PhpStorm
Tinkerwell logo

Tinkerwell

The must-have code runner for Laravel developers. Tinker with AI, autocompletion and instant feedback on local and production environments.

Tinkerwell

The latest

View all →
Building and Deploying a Laravel App With Claude Code on Zerops image

Building and Deploying a Laravel App With Claude Code on Zerops

Read article
The first hands-on AI Developer Certification image

The first hands-on AI Developer Certification

Read article
Laravel Announces the Founders Summit, a One-Day Event for Founders image

Laravel Announces the Founders Summit, a One-Day Event for Founders

Read article
A Practical Guide to Laravel's First-Party Image Processing image

A Practical Guide to Laravel's First-Party Image Processing

Read article
RouteKey Model Attribute in Laravel 13.21 image

RouteKey Model Attribute in Laravel 13.21

Read article
Laravel Time Machine: A Request Lifecycle Profiler image

Laravel Time Machine: A Request Lifecycle Profiler

Read article