Skip to content

Commit 6d61766

Browse files
committed
Added test case for fastify.all
1 parent 8ebbfb1 commit 6d61766

File tree

1 file changed

+7
-0
lines changed
  • javascript/ql/test/query-tests/Security/CWE-094/CodeInjection

1 file changed

+7
-0
lines changed

javascript/ql/test/query-tests/Security/CWE-094/CodeInjection/fastify.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,3 +101,10 @@ fastify.get('/flow-through-reply', async (request, reply) => {
101101
}
102102
return { result: null };
103103
});
104+
105+
fastify.all('/eval', async (request, reply) => {
106+
const userInput = request.query.code; // $ MISSING: Source[js/code-injection]
107+
const result = eval(userInput); // $ MISSING: Alert[js/code-injection]
108+
const replyResult = eval(reply.locals.nestedCode); // $ MISSING: Alert[js/code-injection]
109+
return { method: request.method, result };
110+
});

0 commit comments

Comments
 (0)