-
Notifications
You must be signed in to change notification settings - Fork 2k
Expand file tree
/
Copy pathMissingRateLimiting.ql
More file actions
28 lines (26 loc) · 979 Bytes
/
MissingRateLimiting.ql
File metadata and controls
28 lines (26 loc) · 979 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
26
27
28
/**
* @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 rhe.(FirstLineOf), "This route handler " + explanation + ", but is not rate-limited.",
reference, referenceLabel