The open alternative to Salesforce, designed for AI.
TypeScript crmcrm-systemcustomergood-first-issuegraphqlhacktoberfestjavascriptmarketingmonoreponestjsopen-sourcepostgresqlreactreactjssalestypescriptweb
// Any new pattern must be reviewed for SQL injection before being allowlisted
const ALLOWED_INDEX_WHERE_CLAUSES = new Set([
'"deletedAt" IS NULL',
'"_isPrivate"',
]);
export const validateAndReturnIndexWhereClause = (
clause: string | null | undefined,
): string | undefined => {
if (!clause) {
return undefined;
}
if (ALLOWED_INDEX_WHERE_CLAUSES.has(clause)) {
return clause;
}
throw new Error(
`Unsupported index WHERE clause: "${clause}". ` +
'Only allowlisted patterns are permitted to prevent SQL injection. ' +
'Add the pattern to ALLOWED_INDEX_WHERE_CLAUSES after security review.',
);
};