14 lines
433 B
TypeScript
14 lines
433 B
TypeScript
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;
|
|
}
|
|
};
|