magento / security-package

Magento Security Extensions
Open Software License 3.0
66 stars 69 forks source link

Errors with bulk API when ReCaptchaWebapiRest is enabled #312

Closed nuzil closed 2 years ago

nuzil commented 2 years ago

Preconditions (*)

  1. Magento 2.4.3

Steps to reproduce (*)

  1. Configure AMQP connection for Magento instance
  2. Try to execute any Bulk request that have a parameters in URL. For Example (valid for any call where urls are converted to "byPARAM"):
curl --location --request PUT 'http://URL/rest/async/bulk/V1/products/byProductSku/stockItems/byItemId' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer TOKEN' \
--data-raw '[
    {
        "stockItems": 1,
        "productSku": "simple_product",
        "stockItem": {
            "item_id": 1,
            "qty": 15
        }
    }
]'
  1. Directly by publishing is coming error: "An error has happened during application run. See exception log for details."

  2. From logs:

    [2021-10-04 12:36:39] report.CRITICAL: TypeError: Argument 3 passed to Magento\Framework\Webapi\ServiceInputProcessor::process() must be of the type array, string given, called in /PATH/vendor/magento/module-webapi-async/Controller/Rest/Asynchronous/InputParamsResolver.php on line 154 and defined in /PATH/vendor/magento/framework/Webapi/ServiceInputProcessor.php:172
    Stack trace:
    #0 /PATH/vendor/magento/module-webapi-async/Controller/Rest/Asynchronous/InputParamsResolver.php(154): Magento\Framework\Webapi\ServiceInputProcessor->process('Magento\\Catalog...', 'updateStockItem...', '0')
    #1 /PATH/vendor/magento/module-webapi-async/Controller/Rest/Asynchronous/InputParamsResolver.php(100): Magento\WebapiAsync\Controller\Rest\Asynchronous\InputParamsResolver->resolveBulkItemParams('0')
    #2 /PATH/vendor/magento/module-webapi-async/Controller/Rest/AsynchronousRequestProcessor.php(100): Magento\WebapiAsync\Controller\Rest\Asynchronous\InputParamsResolver->resolve()
    #3 /PATH/vendor/magento/module-webapi/Controller/Rest.php(188): Magento\WebapiAsync\Controller\Rest\AsynchronousRequestProcessor->process(Object(Magento\Framework\Webapi\Rest\Request\Proxy))
    #4 /PATH/vendor/magento/framework/Interception/Interceptor.php(58): Magento\Webapi\Controller\Rest->dispatch(Object(Magento\Framework\App\Request\Http))
    #5 /PATH/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Webapi\Controller\Rest\Interceptor->___callParent('dispatch', Array)
    #6 /PATH/vendor/fastly/magento2/Model/FrontControllerPlugin.php(131): Magento\Webapi\Controller\Rest\Interceptor->Magento\Framework\Interception\{closure}(Object(Magento\Framework\App\Request\Http))
    #7 /PATH/vendor/magento/framework/Interception/Interceptor.php(135): Fastly\Cdn\Model\FrontControllerPlugin->aroundDispatch(Object(Magento\Webapi\Controller\Rest\Interceptor), Object(Closure), Object(Magento\Framework\App\Request\Http))
    #8 /PATH/vendor/magento/framework/Interception/Interceptor.php(153): Magento\Webapi\Controller\Rest\Interceptor->Magento\Framework\Interception\{closure}(Object(Magento\Framework\App\Request\Http))
    #9 /PATH/generated/code/Magento/Webapi/Controller/Rest/Interceptor.php(23): Magento\Webapi\Controller\Rest\Interceptor->___callPlugins('dispatch', Array, Array)
    #10 /PATH/vendor/magento/framework/App/Http.php(116): Magento\Webapi\Controller\Rest\Interceptor->dispatch(Object(Magento\Framework\App\Request\Http))
    #11 /PATH/generated/code/Magento/Framework/App/Http/Interceptor.php(23): Magento\Framework\App\Http->launch()
    #12 /PATH/vendor/magento/framework/App/Bootstrap.php(264): Magento\Framework\App\Http\Interceptor->launch()
    #13 /PATH/pub/index.php(29): Magento\Framework\App\Bootstrap->run(Object(Magento\Framework\App\Http\Interceptor))
    #14 {main} [] []
  3. Error coming from vendor/magento/module-re-captcha-webapi-rest/Plugin/RestValidationPlugin.php::81 If remove afterValidate method, then no errors apears.

Expected result (*)

  1. Bulk published without errors
m2-assistant[bot] commented 2 years ago

Hi @nuzil. Thank you for your report. To help us process this issue please make sure that you provided sufficient information.

Please, add a comment to assign the issue: @magento I am working on this


nathanjosiah commented 2 years ago

@magento export issue to Jira project AC as Bug

github-jira-sync-bot commented 2 years ago

:x: Cannot export the issue. GitHub repo magento/security-package is not supported in JIRA project AC and type Bug.

nathanjosiah commented 2 years ago

https://jira.corp.magento.com/browse/ACP2E-200

theflaer commented 2 years ago

Is it possible to let me know how to fix the issue?

hostep commented 2 years ago

Closed without comments for some reason? But probably fixed by https://github.com/magento/security-package/commit/d2adcbb47d01e46ed5b193f0c973ea269eb62639

nuzil commented 2 years ago

Yeah, @nathanjosiah maybe some update why was it closed will be nice

theflaer commented 2 years ago

Closed without comments for some reason? But probably fixed by d2adcbb

True. Just checked it. To fix it apply d2adcbb