Skip to content

Commit 0e598de

Browse files
committed
AC-10815 - API Input validation
1 parent 7bdfa80 commit 0e598de

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

lib/internal/Magento/Framework/Webapi/ServiceInputProcessor.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,11 @@ class ServiceInputProcessor implements ServicePayloadConverterInterface, ResetAf
4040
{
4141
public const EXTENSION_ATTRIBUTES_TYPE = \Magento\Framework\Api\ExtensionAttributesInterface::class;
4242

43+
/**
44+
* Input param to be rejected when it contains xml content
45+
*/
46+
public const REJECTED_INPUT_PARAM_SOURCEDATA = 'sourcedata';
47+
4348
/**
4449
* @var TypeProcessor
4550
*/
@@ -249,7 +254,7 @@ private function getConstructorData(string $className, array $data): array
249254

250255
try {
251256
if (ltrim($parameterType, "\\") === SimplexmlElement::Class &&
252-
strtolower($parameter->getName()) === "sourcedata") {
257+
strtolower($parameter->getName()) === self::REJECTED_INPUT_PARAM_SOURCEDATA) {
253258
throw new InputException(new Phrase('Invalid input.'));
254259
}
255260

0 commit comments

Comments
 (0)