-
Notifications
You must be signed in to change notification settings - Fork 2k
Expand file tree
/
Copy pathMissingRateLimiting.ql
More file actions
25 lines (23 loc) · 983 Bytes
/
MissingRateLimiting.ql
File metadata and controls
25 lines (23 loc) · 983 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
/**
* @name Missing rate limiting
* @description An HTTP request handler that performs expensive operations without
* restricting the rate at which operations can be carried out is vulnerable
* to denial-of-service attacks.
* @kind problem
* @problem.severity error
* @precision high
* @id js/missing-rate-limiting
* @tags security
* external/cwe/cwe-770
* external/cwe/cwe-307
* external/cwe/cwe-400
*/
import javascript
import semmle.javascript.security.dataflow.MissingRateLimiting
import semmle.javascript.RestrictedLocations
from ExpensiveRouteHandler r, Express::RouteHandlerExpr rhe,
string explanation, DataFlow::Node reference, string referenceLabel
where r = rhe.getBody() and
r.explain(explanation, reference, referenceLabel) and
not rhe instanceof RateLimitedRouteHandlerExpr
select (FirstLineOf)rhe, "This route handler " + explanation + ", but is not rate-limited.", reference, referenceLabel