Skip to content

Instantly share code, notes, and snippets.

View bka's full-sized avatar

Bernhard bka

View GitHub Profile
location ~ /rest/([^/]*/)?V1/customers/me {
deny all;
}
diff --git Plugin/Webapi/Controller/Rest/ValidateCustomerData.php Plugin/Webapi/Controller/Rest/ValidateCustomerData.php
index ad2d8ed..63551ff 100644
--- Plugin/Webapi/Controller/Rest/ValidateCustomerData.php
+++ Plugin/Webapi/Controller/Rest/ValidateCustomerData.php
@@ -28,8 +28,8 @@ class ValidateCustomerData
*/
public function beforeOverride(ParamsOverrider $subject, array $inputData, array $parameters): array
{
- if (isset($inputData[self:: CUSTOMER_KEY])) {
- $inputData[self:: CUSTOMER_KEY] = $this->validateInputData($inputData[self:: CUSTOMER_KEY]);
{
"extra": {
"magento-force": "override",
"enable-patching": true,
"patches": {
"magento/module-customer": {
"CVE-2023-38218": "patches/CVE-2023-38218.patch"
}
}
},
<?php
/* Test script for reproducing https://github.com/magento/magento2/issues/35616
*
* 1. Mode of catalog_product_price indexer must be update by schedule.
*
* 2. Place this script into $MAGE_ROOT/scripts/index-buster.php
*
* 3. Execute it `php scripts/index-buster.php`. Do not terminate it. Wait for output to be ready.
*
@bka
bka / magedev.json
Created June 23, 2021 08:06
magedev.json magento 2.4.x
{
"magento_version": "2",
"project_name": "magento2-demo",
"php_version": "7.4",
"image_version": "1.1",
"domain": "magento.local",
"mysql_version": "5.7",
"es_version": "7.10.1",
"dump_file": "var/dump.sql",
"source_folder": "Source/",
@bka
bka / magento-twig-theme-setup.md
Last active June 5, 2020 11:00
Magento 2 Installation Guide with sample data for Twig Theme using magedev

Step 1: Install Magento 2 with Sample Data

This guide is based on magedev. Skip to Step 2 for other setups.

git clone https://github.com/magento/magento2.git -b 2.3.4 Source

cat >magedev.json <<'EOL'
{
  "magento_version": "2",

"project_name": "twigdemo",

<?php
// vendor/zendframework/zend-mail/src/Transport/Sendmail.php
$writer = new \Zend\Log\Writer\Stream(BP . '/var/log/mail.log');
$logger = new \Zend\Log\Logger();
$logger->addWriter($writer);
$logger->info(\print_r(['to' => $to, 'subject' => $subject, 'headers' => $headers, 'parameters' => $parameters], true));
define([
'Magento_Swatches/js/swatch-renderer',
], function (Renderer) {
Renderer.prototype.originalMethod = Renderer.prototype._RenderSwatchOptions;
Renderer.prototype._RenderSwatchOptions = function(config) {
return this.originalMethod(config);
};
return Renderer;
}
);
#!/bin/bash
# sudo apt-get install build-essential libncurses-dev libpython2-dev libx11-dev libxtst-dev xorg-dev
# sudo apt-get build-dep vim
./configure --with-features=huge \
--enable-multibyte \
--enable-rubyinterp=yes \
--enable-pythoninterp=yes \
--with-python-config-dir=/usr/lib/python2.7/config-x86_64-linux-gnu \
@bka
bka / iterate-products.php
Created May 29, 2017 19:29
Iterate magento2 products
$objectManager = $this->getObjectManager();
$appState = $objectManager->get('Magento\Framework\App\State');
$appState->setAreaCode(\Magento\Framework\App\Area::AREA_ADMINHTML);
$productCollection = $objectManager->create("\Magento\Catalog\Model\ResourceModel\Product\Collection");
$productCollection->addAttributeToSelect('*');
foreach ($productCollection as $product) {
var_dump($product->getData());
}