mirror of
https://github.com/github/codeql.git
synced 2026-05-05 13:45:19 +02:00
JS: Recognize Fastify per-route rate limiting
This commit is contained in:
@@ -191,3 +191,21 @@ class RouteHandlerLimitedByRateLimiterFlexible extends RateLimitingMiddleware in
|
|||||||
private class FastifyRateLimiter extends RateLimitingMiddleware {
|
private class FastifyRateLimiter extends RateLimitingMiddleware {
|
||||||
FastifyRateLimiter() { this = DataFlow::moduleImport("fastify-rate-limit") }
|
FastifyRateLimiter() { this = DataFlow::moduleImport("fastify-rate-limit") }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An options object with a `rateLimit` config passed to a Fastify shorthand route method,
|
||||||
|
* such as `fastify.post('/path', { config: { rateLimit: { ... } } }, handler)`.
|
||||||
|
*/
|
||||||
|
private class FastifyPerRouteRateLimit extends RateLimitingMiddleware {
|
||||||
|
FastifyPerRouteRateLimit() {
|
||||||
|
exists(Fastify::RouteSetup setup |
|
||||||
|
not setup.getMethodName() = ["route", "addHook"] and
|
||||||
|
setup.getNumArgument() >= 3 and
|
||||||
|
this.flowsTo(setup.getArgument(1))
|
||||||
|
|
|
||||||
|
exists(this.getAPropertySource("config").getAPropertySource("rateLimit"))
|
||||||
|
or
|
||||||
|
exists(this.getAPropertySource("rateLimit"))
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
#select
|
|
||||||
| MissingRateLimiting.js:4:19:8:1 | functio ... ath);\\n} | This route handler performs $@, but is not rate-limited. | MissingRateLimiting.js:7:5:7:22 | res.sendFile(path) | a file system access |
|
| MissingRateLimiting.js:4:19:8:1 | functio ... ath);\\n} | This route handler performs $@, but is not rate-limited. | MissingRateLimiting.js:7:5:7:22 | res.sendFile(path) | a file system access |
|
||||||
| MissingRateLimiting.js:25:19:25:20 | f1 | This route handler performs $@, but is not rate-limited. | MissingRateLimiting.js:13:5:13:22 | res.sendFile(path) | a file system access |
|
| MissingRateLimiting.js:25:19:25:20 | f1 | This route handler performs $@, but is not rate-limited. | MissingRateLimiting.js:13:5:13:22 | res.sendFile(path) | a file system access |
|
||||||
| MissingRateLimiting.js:25:27:25:28 | f3 | This route handler performs $@, but is not rate-limited. | MissingRateLimiting.js:22:5:22:22 | res.sendFile(path) | a file system access |
|
| MissingRateLimiting.js:25:27:25:28 | f3 | This route handler performs $@, but is not rate-limited. | MissingRateLimiting.js:22:5:22:22 | res.sendFile(path) | a file system access |
|
||||||
@@ -10,9 +9,4 @@
|
|||||||
| tst.js:64:25:64:63 | functio ... req); } | This route handler performs $@, but is not rate-limited. | tst.js:64:46:64:60 | verifyUser(req) | authorization |
|
| tst.js:64:25:64:63 | functio ... req); } | This route handler performs $@, but is not rate-limited. | tst.js:64:46:64:60 | verifyUser(req) | authorization |
|
||||||
| tst.js:76:25:76:53 | catchAs ... ndler1) | This route handler performs $@, but is not rate-limited. | tst.js:14:40:14:46 | login() | authorization |
|
| tst.js:76:25:76:53 | catchAs ... ndler1) | This route handler performs $@, but is not rate-limited. | tst.js:14:40:14:46 | login() | authorization |
|
||||||
| tst.js:88:24:88:40 | expensiveHandler1 | This route handler performs $@, but is not rate-limited. | tst.js:14:40:14:46 | login() | authorization |
|
| tst.js:88:24:88:40 | expensiveHandler1 | This route handler performs $@, but is not rate-limited. | tst.js:14:40:14:46 | login() | authorization |
|
||||||
| tst.js:103:4:103:20 | expensiveHandler1 | This route handler performs $@, but is not rate-limited. | tst.js:14:40:14:46 | login() | authorization |
|
|
||||||
| tst.js:110:4:110:20 | expensiveHandler1 | This route handler performs $@, but is not rate-limited. | tst.js:14:40:14:46 | login() | authorization |
|
|
||||||
| tst.js:112:28:112:44 | expensiveHandler1 | This route handler performs $@, but is not rate-limited. | tst.js:14:40:14:46 | login() | authorization |
|
| tst.js:112:28:112:44 | expensiveHandler1 | This route handler performs $@, but is not rate-limited. | tst.js:14:40:14:46 | login() | authorization |
|
||||||
testFailures
|
|
||||||
| tst.js:103:4:103:20 | This route handler performs $@, but is not rate-limited. | Unexpected result: Alert |
|
|
||||||
| tst.js:110:4:110:20 | This route handler performs $@, but is not rate-limited. | Unexpected result: Alert |
|
|
||||||
|
|||||||
Reference in New Issue
Block a user