In the Magento codebase, the Adobe team regularly releases security patches for the ongoing Magento version.
To upgrade the latest Magento security patch, you need to do just a little bit of changes to the composer.json file to secure your store.
It’s better to upgrade the security patch version while Adobe announced the release of new security patches.
Magento Open search:
composer require magento/product-community-edition 2.4.5-p4 --no-update composer update magento/product-community-edition --with-all-dependencies
Adobe Commerce On-Premise:
composer require magento/product-enterprise-edition 2.4.5-p4 --no-update composer update magento/product-enterprise-edition:2.4.4-p5 --with-all-dependencies
Adobe Cloud:
You need to update magento-cloud-metapackage
with current_version and next_version syntax.
For current_version, you have to define the Adobe Commerce version to install.
For next_version, you have to define the next patch version after the value specified in current_version.
If you want to install Adobe Commerce 2.4.5-p4, set current_version to 2.4.5 and the next_version to 2.4.6. The constraint looks like “>=2.4.5 <2.4.6” installs the latest available package for 2.4.5.
composer require magento/magento-cloud-metapackage ">=2.4.5 <2.4.6" --no-update composer update magento/magento-cloud-metapackage --with-all-dependencies
The Magento Cloud meta package is still not updating using the above way, You can use the flag -W to upgrade the latest security patch.
composer update magento/magento-cloud-metapackage -W
This is the simple way to secure your Magento with a security patch upgrade.