Skip to content

Commit e8e7e3a

Browse files
authored
Update 3-ssdlc.livemd
Updates to the Rate Limiting Section In ESCT: Part 3 - Secure SDLC Concepts Elixir Sec Coding Training - Improve Rate-Limiting Lesson (issue erlef#24)
1 parent b44ddc0 commit e8e7e3a

File tree

1 file changed

+31
-1
lines changed

1 file changed

+31
-1
lines changed

Diff for: modules/3-ssdlc.livemd

+31-1
Original file line numberDiff line numberDiff line change
@@ -57,14 +57,40 @@ Additionally, thought can be put into how you architect data flows with regards
5757

5858
### Description
5959

60-
Rate limiting restricts the number of requests that can be allowed in a certain time frame on a specific resource. Rate limiting can be implemented to protect against a variety of attacks or abuses:
60+
While performing their designed operations, applications send traffic across networks, make client requests, generate server responses, and consume processing and memory capacity from the computing machines on which they are hosted. They often have components, like APIs that interact with data sources and services. Modern applications have a lot of things happening.
61+
62+
When building an application, it is necessary to consider approaches to manage the access and use of all relevant internal and external resources involved in the context of the application. This will help ensure the continued availablilty of the application and it's functionality for all legitimate users and entities. This is particularly important for applications that run critical infrastructure and other key services organizations rely on for business operations.
63+
64+
When resources are not well managed, applications become vulnerable to negative impacts in performance, unintentional service failures, and denial of service attacks, in which a malicious actor takes advantage of resource limitations to intentionally overwhelm and crash a system.
65+
66+
Implementing rate limiting is one security best practice that can help mitigate the ability of unlimited, undefined, or uncontrolled application input, to intentionally or inadvertently exahaust vital resources across all levels of application's context.
67+
68+
### Implementation Approaches
69+
There are multiple approaches to implementing rate limiting within an application and in general the approach is based on at least one of the following problematic scenarios:
70+
71+
* Malicious actor-generated abusive traffic designed to force the application into a compromised state
72+
* Malicious or legitimate users perform large load activites that requires significant processing power
73+
* Malicious or legitimate users sending large number of queries, often repeatedly to the service
74+
* Malicious or legitimate users sending large number of queries in a narrow timeframe
75+
76+
Rate limiting can be implemented to protect against a variety of attacks or abuses:
6177

6278
* Preventing Denial Of Service attacks (limiting the number of calls to expensive endpoints)
6379
* Limiting brute force attempts (such as on one time codes and passwords)
6480
* Programmatic abuse of services
6581

6682
### Prevention
6783

84+
Per OWASP, consider limits on the following (please see Rate Limiting References below):
85+
86+
* Execution timeouts
87+
* Max allocable memory
88+
* Number of file descriptors
89+
* Number of processes
90+
* Request payload size (e.g., uploads)
91+
* Number of requests per client/resource
92+
* Number of records per page to return in a single request response
93+
6894
When rate limiting a new action, begin by asking these questions:
6995

7096
* "What are the maximum number of calls to my action that a reasonable non-malicious user would feasibly make in a given time period?"
@@ -75,6 +101,10 @@ If the answer to one or more of those questions is yes, consider putting a limit
75101

76102
More often than not, rate limiting should be as specific as possible. For instance, it is better to add rate limiting on a single GraphQL type than to add a generic limit to the entire /GraphQL endpoint.
77103

104+
### Rate Limiting References
105+
(https://cheatsheetseries.owasp.org/cheatsheets/GraphQL_Cheat_Sheet.html#rate-limiting)
106+
(https://github.com/OWASP/API-Security/blob/master/2019/en/src/0xa4-lack-of-resources-and-rate-limiting.md)
107+
78108
## Principle of Least Privilege
79109

80110
Sometimes known as the Principle of Minimal Privilege or the Principle of Least Authority, the Principle of Least Privilege (PoLP) means that every entity* is only strictly given the essential privileges needed to perform its requirement.

0 commit comments

Comments
 (0)