← Back to Baseline

MB-0067

Automated prefer-stable=true in composer.json

MB-C11 Composer Dependency Hygiene High

prefer-stable=true in composer.json; assess only the collected Magento deployment scope.

Overview

prefer-stable=true in composer.json; assess only the collected Magento deployment scope.

Why it Matters

Composer allows setting a global stability level (e.g., minimum-stability in composer.json). If the default is too loose (such as dev), unstable or untested packages may be installed in production. This increases the risk of regressions, insecure code, and compatibility issues.

Ensuring that minimum-stability is set to stable (the default) protects the store from unintentionally pulling in beta or dev versions, and enforces safer dependency management.

Verification Steps

Manual Verification

  1. Read the top-level field and require boolean true.
  2. Review minimum-stability and package-specific flags separately, then validate the manifest.

Command / Review Sample

php -r '$c = json_decode(file_get_contents("composer.json"), true); var_export($c["prefer-stable"] ?? null); echo PHP_EOL;'

Use the assessed Magento project and the appropriate application or read-only review account. Replace example hosts, paths and identifiers with the assessment scope; configuration and source fragments are illustrative.

Remediation / Fix Guidance

  1. Investigate and change: Review root composer.json stability policy and set prefer-stable to true when it matches the deployment policy. Remove unnecessary minimum-stability:dev and review explicit exceptions.
  2. Validate the change: Resolve dependencies in a branch and confirm the lockfile selects approved releases; prefer-stable alone does not prohibit all development dependencies.
  3. Rerun MB-0067 against the same release, profile and relevant file/key/package scope; compare the new evidence and inspect any independent collection gaps.

Examples

Illustrative examples only. Interpret them within the current revision criterion above; missing collection evidence is unresolved, never PASS.

Fail Example

{"prefer-stable":false}

Pass Example

{"prefer-stable":true}

Scope and Evidence Limits

Rule revision: 2. Target modes: LOCAL.

prefer-stable=true in composer.json; assess only the collected Magento deployment scope.

This check covers only the collected observation. Missing collection scope, external controls and runtime behavior require separate evidence.

Catalog coverage describes implementation capability, not a scan outcome. An incomplete manual review cannot establish that the criterion is satisfied.

References