Posts

Next Topic

Understanding the Kubernetes nodes/proxy GET RCE “Vulnerability” (And Why It’s Working as Intended)

When you think of a "security bug," you usually imagine something getting fixed — patches, CVEs, frantic updates… But what if the behavior you're calling a bug is actually working exactly the way the project maintainers intended? That's the situation with an interesting Kubernetes authorization behavior involving the nodes/proxy GET permission. What looks like a Remote Code Execution (RCE) vector is actually a side-effect of how Kubernetes implements authorization for certain API paths — particularly the Kubelet's exec interfaces over WebSockets. Let's unpack what's happening, why it matters, and most importantly: how it works. What Does nodes/proxy GET Actually Allow? Kubernetes Role-Based Access Control (RBAC) permissions are defined with resources and verbs. For example: pods/exec CREATE - permits creating an exec session in a pod pods/log GET - permits reading logs But the nodes/proxy resource is a bit different: it's used t...

Speeding Up Docker Build Times

Image
I n the rapid environment of software development, time is crucial. If you've experienced the frustration of waiting for Docker builds to complete, you're in good company. This article introduces a range of strategies and techniques designed to accelerate Docker builds significantly and empower you to better manage your development workflow. Strategies and Techniques covered Caching image layers Caching app dependencies using cache mount type Using .dockerignore Parallelization (using Docker and using Gradle) Caching Image Layers A highly effective way to speed up your Docker builds is by utilizing Docker layer caching. This feature enables the caching of intermediate build layers, so you don’t need to rebuild them from scratch each time you modify your code. The official Docker documentation offers an excellent guide on this subject. Since Docker cache management is the basis for the upcoming techniques, I suggest reading it thoroughly and even trying out the concepts in a sim...

Function Components vs Class Components in React – With Examples

In React, there are two primary ways to create components: function and class components. Each has its own syntax and use cases, although with the introduction of React Hooks, the gap between them has narrowed significantly. But the selection of appropriate component types is still very crucial for building efficient and maintainable React applications. In this article, we'll explore the foundational differences between function and class components, providing a clear understanding of their strengths and ideal use cases. By understanding these concepts, developers can make informed decisions when constructing React components, ultimately enhancing the structure and functionality of their web applications. What are React Components? In React, components are the building blocks of a user interface. They are reusable, self-contained pieces of code that represent a part of the UI. React allows you to break down your UI into smaller components, which makes it easier to manage and mainta...

Migrations with TypeORM in NestJs

Migrations with TypeORM in NestJs Why Do We Need Migrations in NestJs? NestJs provides an auto-sync feature that automatically updates the database when entity changes occur. Given this, you might wonder why migrations are necessary. The reason is that while auto-sync can be convenient, it can become risky in production environments. When your application is live and contains actual data, direct modifications to the database could lead to issues. This is why relying on synchronization in production is considered unsafe. Advantages of Using Migrations You can control when migrations are applied. Reduces the risk of errors in production environments. Migration files can be automatically generated from entity changes, so you don’t need to manually write them. Disadvantages of Migrations You need to generate and run migration files every time you make changes to your entities. Example Suppose you have an entity named Student : import { BaseEntity , Column , Entity , PrimaryGeneratedColumn...

Circular Dependencies in NestJS and How to Prevent Them

So, you encounter a scenario where you're developing your NestJS server application smoothly, only to be interrupted by an error message like this: [ Nest ] 116557 - 10 /07/2022, 2 :12:40 PM ERROR [ ExceptionHandler ] Nest cannot create the BarModule instance. The module at index [ 0 ] of the BarModule "imports" array is undefined. Potential causes: - A circular dependency between modules. Use forwardRef ( ) to avoid it. Read more: https://docs.nestjs.com/fundamentals/circular-dependency - The module at index [ 0 ] is of type "undefined" . Check your import statements and the type of the module. Scope [ AppModule - > FooModule ] You pause, analyze the situation, and realize that adding a forwardRef to your  BarModule  and  FooModule  imports might resolve the issue, correct? Nest can't resolve dependencies of the FooService ( ? ) . Please make sure that the argument dependency at index [ 0 ] is available in the FooModule context. Potenti...