<commit_before><?php
namespace Omise\Payment\Plugin;

class CsrfValidatorSkip
{
    /**
     * @param \Magento\Framework\App\Request\CsrfValidator $subject
     * @param \Closure $proceed
     * @param \Magento\Framework\App\RequestInterface $request
     * @param \Magento\Framework\App\ActionInterface $action
     */
    public function aroundValidate(
        $subject,
        \Closure $proceed,
        $request,
        $action
    ) {
        if ($request->getModuleName() == 'omise') {
            return;
        }
        $proceed($request, $action);
    }
}<commit_msg>Adding url path check specific to webhook<commit_after><?php
namespace Omise\Payment\Plugin;

class CsrfValidatorSkip
{
    protected $urlInterface;
    public function __construct(\Magento\Framework\UrlInterface $urlInterface) {
        $this->urlInterface = $urlInterface;
    }
    /**
     * @param \Magento\Framework\App\Request\CsrfValidator $subject
     * @param \Closure $proceed
     * @param \Magento\Framework\App\RequestInterface $request
     * @param \Magento\Framework\App\ActionInterface $action
     */
    public function aroundValidate(
        $subject,
        \Closure $proceed,
        $request,
        $action
    ) {
        if ($request->getModuleName() == 'omise' && strpos($this->urlInterface->getCurrentUrl(), 'omise/callback/webhook')) {
            return;
        }
        $proceed($request, $action);
    }
}
{'fraction_non_alphanumeric': 0.12631578947368421, 'fraction_numerical': 0.0, 'mean_word_length': 2.5919395465994963, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2823744', 'n_tokens_mistral': 421, 'n_tokens_neox': 424, 'n_words': 78}