Recent release is immutable

Checks whether the latest release is published so that its host guarantees it can never be changed.
category
security
weight
3

How Plumb checks this

What is inspected, and how the result is decided.

Composer finds the code for a version through a Git tag of the same name. On most hosts anyone with write access can move that tag to a different commit after the release is published, and people who install the version later get different code under a version number they already trust. Someone who takes over a maintainer account can use this to slip malicious code into a release that was already reviewed.

Some hosts can lock a published release for good. Once it is locked, its tag points at one commit forever and nobody can move or delete it, not even an administrator. GitHub immutable releases are the only lock that strong today. Protected tags and tag rules can be switched off by an administrator, so they do not count here.

Plumb asks the host whether the release for the latest version is locked this way. The check passes when it is. It fails when the release is not locked, and when the version was pushed as a tag without a release, because only releases can be locked. It also fails when the package is hosted somewhere that offers no such lock, because the tag can still be moved there. The check is not applicable when the package has no tagged release.

Doing it well

Why this matters

Whenever Composer installs version 2.1.0 of a package, it finds the code through a Git tag named 2.1.0. A Git tag is just a pointer to a commit, and on most hosts anyone with write access can move it to a different commit at any time.

If that happens, people who install the version afterwards get different code under a version number they already trusted, reviewed, or audited. Nothing warns them. Someone who takes over a maintainer account or a release token can use this to rewrite a version that thousands of projects already depend on, without publishing anything that looks new.

GitHub immutable releases remove this risk for every release published while the setting is on. The tag is locked to its commit and cannot be moved or deleted while the release exists, not even by an administrator. Release files are locked too, and each release gets a signed attestation people can verify.

What good looks like

  • Release immutability is turned on for the repository, or for the whole organization.
  • Every version is published as a GitHub release, not only as a bare Git tag.
  • The latest release shows the Immutable label under its title on the releases page.

How to do it

Turn on immutable releases

  1. Open the repository's Settings, then General.
  2. In the Releases section, select Enable release immutability.
  3. Publish your next version as a GitHub release.

Organization owners can turn this on for every repository at once under the organization's Settings, Repository, General, Releases.

Immutability applies only to releases published after you turn it on. Earlier releases stay as they were.

Publish releases, not just tags

Immutability applies to releases, not to tags. A tag pushed on its own has no release, so it can still be moved even with the setting turned on. Create a release for every version, for example with gh release create v2.1.0 --generate-notes, or with a release workflow that runs when you push a tag. Many projects only push tags today; this is the one change they need.

Attach files before publishing

Release files cannot be added once an immutable release is published. If your workflow uploads files, create the release as a draft, upload the files, then publish it.

Things to watch for

  • Tags pushed before the release. If a workflow pushes the tag first and creates the release later, the tag is unprotected in between. Let the release create the tag where you can.
  • Release tools that retry by recreating tags. A retry that deletes and recreates the tag will fail once releases are immutable. Make retries publish a new version instead.
  • Other hosts. GitHub is the only host that offers a lock like this today. GitLab, Bitbucket, and others have protected tags, which help against mistakes, but an administrator can switch them off. If your host adds an equivalent lock, use it.
  • Turning it off. Disabling the setting does not unlock earlier immutable releases, but new releases are no longer protected.

Further reading