Skip to content

Commit 1eb7ea4

Browse files
authored
Fix code scanning alert (#90)
* add ratelimiter to protected route * remove server-side cache from protected route
1 parent c65eeb5 commit 1eb7ea4

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/api/routes/protected.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import { FastifyPluginAsync } from "fastify";
2-
import fastifyCaching from "@fastify/caching";
2+
import rateLimiter from "api/plugins/rateLimiter.js";
33

44
const protectedRoute: FastifyPluginAsync = async (fastify, _options) => {
5-
fastify.register(fastifyCaching, {
6-
privacy: fastifyCaching.privacy.PRIVATE,
7-
serverExpiresIn: 0,
8-
expiresIn: 60 * 60 * 2,
5+
await fastify.register(rateLimiter, {
6+
limit: 15,
7+
duration: 30,
8+
rateLimitIdentifier: "protected",
99
});
1010
fastify.get("/", async (request, reply) => {
1111
const roles = await fastify.authorize(request, reply, []);

0 commit comments

Comments
 (0)