n39librarian/middleware/utils/passesSQLInjectionCheck.ts

15 lines
433 B
TypeScript
Raw Normal View History

import { Response } from "express";
export const passesSQLInjectionCheck = (input: string): boolean =>
!input.includes("'");
export const checkForThreads = (items: unknown[], res: Response) => {
const containsThread = items
.map((el) => !passesSQLInjectionCheck("" + el))
.find((el) => el);
if (containsThread) {
res.status(400).send("Input may not not include single quotes.");
return containsThread;
}
};