Uber Breach and its after shock

There are always two sides of a coin. The same can be applied to technology as well. On one hand, technology has made sure that the entire world is accessible to almost everyone all around…

Smartphone

独家优惠奖金 100% 高达 1 BTC + 180 免费旋转




Avoid Asymmetry in Your Code

Secure Your Node.js Web Application — by Karl Düüna (52 / 78)

👈 Manage How Your Application Uses Memory | TOC | Wrapping Up 👉

Applications are often asymmetric when it comes to client requests. Handling the request is much more resource heavy than making the request. Our Fibonacci example was a good illustration of how it took a long calculation to answer a simple request. Points like these are popular targets for DoS attacks, because by targeting these, attackers can successfully take down a service with limited resources.

You don’t want to be an easy target, so you should protect functions that are asymmetrical by limiting access to those functions. One way is to restrict access to the functions to only authenticated users. This way, you can block users who abuse the functions. Another way is to provide a queue system for guest users, where a request is put in the queue and executed only when sufficient resources are available. There are many ways to set up a queue, and I’ll demonstrate one way using vasync[64] for our Fibonacci example. First, we set up the function and queue:

The route handler checks if our job is running or if we have a result:

Add a comment

Related posts:

Chapter 7 Using Test Doubles as Mocks and Stubs

Does your Rails code suffer from bloat, brittleness, or inaccuracy? Cure these problems with the regular application of test-driven development. You'll use Rails 5.1, Minitest 5, and RSpec 3.6, as well as popular testing libraries such as factory_girl and Cucumber. Updates include Rails 5.1 system tests and Webpack integration.

Explains the Creative Director Position

When it comes to digital marketing trends, strategies, and guides, Larby Amirouche is one of the names that comes on top. He has been in the industry for years and is considered one of the best…

An Essay On Weight Loss

While I am only just over four months in to my official weight loss journey, things are already slowly starting to seem like night and day when comparing today, to back in April or May. Over the past…