How to debug Magento Javascript components in DevTools

Often when debugging frontend functionality, I find myself reaching for access into Magento Javascript components. To either read the current state or invoke various methods within that component to test return values. But how do we do this? How do we get, lets say, the current quote? It’s quite simple really, we just call require instead of define like we would in a component. Slap a debugger call in the body and now you can play with that component to your hearts content....

August 8, 2024 · 1 min · 139 words · Me

Cleaning Up Github Actions Artifacts via cli

There are a handful of guides on how to clean-up old Github Action Artifacts. The issue I have with the ones I’ve seen, is they are really convoluted solutions for such a simple task. I am making an assumption here that you are using the Github CLI tool. If you are not, then your missing out, go give it a go (even just for this task). You can even use the CLI directly within your workflows if you can to run the clean-up as a nightly task etc....

August 5, 2024 · 2 min · 261 words · Me

Blocking TOR exit routes

One of my clients have recently seen a surge in TOR traffic with zero conversion from them. And has requested for them to be blocked, since its no point in autoscaling the infrastructure, leading to increased cost, for non converting anonymous traffic. We have a few different ways to block TOR/Onion traffic, firstly we can just click some buttons in cloudflare and problem solved. But thats boring, and does not protect us if we move away from Cloudflare in the future (maybe they’ll deem we are a ’enterprise’ at some point 🙃)....

July 22, 2024 · 2 min · 298 words · Me

Simple 2 line fix for Polyfill.io Malware in Magento 2

A simple two line Nginx config update can remove any reference of the polyfill Malware from coming out of your store. What is the Polyfill.io Malware? As you likely have already heard, the polyfill.io domain has been serving malware. And there is still a concerning number of sites that still are including scripts from that domain. Cloudflare and Fastly have both released alternative services that only require a change of domain....

July 12, 2024 · 2 min · 293 words · Me

Check if your Magento site is safe from CosmicSting (CVE-2024-34102)

I’ve been sat on this post and POC for CosmicSting (CVE-2024-34102) for a little while, giving time for stores to patch the vulnerability. Chances are, if you still have not applied the patch your store will have been probed and compromised by now since there are a handful of POCs out in the wild. So I highly encourage you to make sure the patch is applied (its simple, a single file diff)....

July 7, 2024 · 2 min · 333 words · Me

Flushing Magento 2 Varnish Like a Pro

Flushing Magento 2 cache is simple right? Just click the Orange “Cache Clear” button in the Admin, or run php bin/magento cache:clean from the command line. Speaking to other developers and merchants, this seems to be the way everyone deals with refreshing cached content. Even if its just affecting a single page or product. It does not take a genius to realise flushing the entire Magento cache, means a significantly lower cache hit rate for the short term....

June 4, 2024 · 2 min · 383 words · Me

How to delete spam customer accounts in Magento2

Summary Over the last few years, we’ve noticed an increase in the complexity of spam bots signing up to Magento 2 stores. They used to just spam customer accounts using the same email/email domain likely on ending in .qq.com .ru etc. So it used to be easy to just bulk delete based on the TLD especially for sites that do no ship to China / Russia etc. Whereas the last few years I’m observing them using standard mail providers such as gmail....

May 24, 2024 · 3 min · 598 words · Me

How to install & configure PHP SPX in Warden for Magento 2

PHP-SPX is an free and open source profiling alternative to Blackfire/Tideways etc. The main benefits imo are, its free to use and how simple it is to setup < 60s There is an open discussion within Warden, to install the PHP-SPX profiler into warden core. https://github.com/orgs/wardenenv/discussions/719 In the meantime while we wait for the PR to merge, I’ve created the following shell script to bootstraps the PHP-SPX installation & configuration for the current warden project....

May 23, 2024 · 3 min · 505 words · Me

Anonymizing Magento 2 Databases with Warden

You might find yourself needing to anonymize a database in Warden to either pass off to another developer, or move it forward into ephemeral / staging environments. This is fairly easy to achieve with Smile-SA GDPR Dump. First lets download the resources we need, we will store them in the dev folder as we can exclude this in our deployment pipelines. wget https://github.com/Smile-SA/gdpr-dump/releases/latest/download/gdpr-dump.phar -O dev/gdpr-dump wget https://raw.githubusercontent.com/Smile-SA/gdpr-dump/main/app/config/example.yaml -O dev/gdpr-dump.yaml chmod +x dev/gdpr-dump Next we can edit the yaml to set our correct Magento version and catch any non core tables we might have followed by running the anonymizer script....

May 21, 2024 · 1 min · 126 words · Me

Analyzing a real Magento 2 Stripe CC Scraper Malware Sample

Overview Recently I came across a Magento 2.3.4 store with a stripe specific credit card scraper embedded into the checkout page. The Malware had been injected into the core_config_data table, and was being saved against the shipping/shipping_policy/shipping_policy_content key. The updated_at time of the entry was 2024-04-10 13:27:32 although its worth noting, whilst this may be the time of the initial infection. Since the original entry point has not been patched, an attacker could have simply changed the payload on that date....

May 20, 2024 · 2 min · 421 words · Me

Lights: tobyj

Snowman: alikhalilifar

Tree: ssmkhrj