Recently, in one of my projects, I got affected by a supply chain attack called Shai-Hulud that targeted npm packages. The interesting fact is that it happened to me in a PHP project. That’s why I decided to write about my experience and lessons learned. What is Shai-Hulud? Shai-Hulud is an npm supply-chain attack “worm” that compromises JavaScript/Node.js projects by getting malicious code ...
Recently, I encountered an interesting case of a Remote Code Execution (RCE) vulnerability that was caused by an innocent cache mechanism. We had some code that was invoked in the middleware, before the actual endpoint was invoked. There was a need to save data somewhere that was needed in both the middleware and the actual endpoint logic. This data had only a request lifetime, so saving it in ...
Some time ago, I was working on improving the performance of slow statistics. The problem was that our database contained billions of rows, making data retrieval slow, even for the last seven days. From a product perspective, we needed to display data for at least 30 days and in real-time. All the data was stored in MySQL without partitioning, so we had to find a better solution. Simply using...
Many companies use a microservices architecture. It has many advantages, but it also has some disadvantages. One of them is that the whole system becomes more complex, and end-to-end (E2E) testing may not be a scalable approach. In the case of a few services, this is not a problem, as we can start all services and run E2E tests. However, when dealing with tens or more services, this becomes a...
In most projects, there is a need to interact with some kind of database. There is an approach that we have a layer called repository which is responsible for saving and retrieving data from the database. Usually, we write an integration test for the repository, and to make the rest of the tests faster we use an in-memory implementation of that repository. It’s a basic concept, and almost ev...