ACSD-64523: REST Endpoint fails to validate mandatory fields
The ACSD-64523 patch fixes an issue where the REST endpoint [V1/import/csv] fails to validate mandatory fields, allowing product creation without required data. To resolve this, update the Authorization header.This patch is available when the Quality Patches Tool (QPT) 1.1.62 is installed. Please note that the issue is scheduled to be fixed in Adobe Commerce 2.4.8.
Affected products and versions
The patch is created for Adobe Commerce version:
- Adobe Commerce (all deployment methods) 2.4.7-p3
Compatible with Adobe Commerce versions:
- Adobe Commerce (all deployment methods) 2.4.7 - 2.4.7-p4
magento/quality-patches
package to the latest version and check the compatibility on the Quality Patches Tool: Search for patches page. Use the patch ID as a search keyword to locate the patch.Issue
The REST endpoint [V1/import/csv]
fails to validate mandatory fields, allowing the creation of products without providing these required fields.
Steps to reproduce:
-
Execute the following payload (update the Authorization header):
code language-none curl --location 'http://<domain>/rest/default/V1/import/json' \ --header 'Content-Type: application/json' \ --header 'Authorization: Bearer xxxxx' \ --data '{ "source": { "locale": "en_AU", "entity": "catalog_product", "behavior": "append", "validation_strategy": "validation-stop-on-errors", "allowed_error_count": 0, "items": [ { "sku": "product_sku", "product_online": "no", "attribute_set_code": "Default", "product_type": "configurable", "product_websites": "base", "store_view_code": "default", "name": null, "description": null, "short_description": null, "weight": null, "tax_class_name": null, "visibility": null, "price": null, "url_key": null, "cost": null, "additional_attributes": { "special_price": "", "retail_price": "" }, "configurable_variations": [] } ] } }'
Expected results:
The application should prevent saving a product without mandatory fields.
Actual results:
The product was saved successfully without specifying the product name, which is a required attribute. As a result, we can’t access the backend product grid, and it gives the following error.
Warning: Undefined array key "name" in /app/code/Magento/Catalog/Ui/Component/Listing/Columns/Thumbnail.php on line 91
Apply the patch
To apply individual patches, use the following links depending on your deployment method:
- Adobe Commerce or Magento Open Source on-premises: Quality Patches Tool > Usage in the Quality Patches Tool guide.
- Adobe Commerce on cloud infrastructure: Upgrades and Patches > Apply Patches in the Commerce on Cloud Infrastructure guide.
Related reading
To learn more about Quality Patches Tool, refer to:
- Quality Patches Tool: A self-service tool for quality patches in the Tools guide.