PostGraphile v5 plugin for validating SQL expressions before they reach the database. v2.14.0 — stable release with weekly updates. Enforces whitelist allow/block rules on SQL AST nodes, preventing SQL injection and unsafe queries in PostGraphile schemas. Differentiator: works at the AST level (not text regex) for precise, composable security rules; integrates with grafast and graphile-build-pg execution pipeline.
npm install graphile-sql-expression-validatorNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Creates a PostGraphile plugin that whitelists SQL expression types, blocking DELETE statements and only allowing SELECT.
Upgrade PostGraphile to v5 and install peer dependencies grafast@1.0.2, graphile-build@5.0.2, graphile-build-pg@5.0.2, graphile-config@1.0.1, graphql@16.13.0.
Convert to ESM (use import/export) or use dynamic import().
Replace SQLValidatorFactory with NODE_VALIDATOR_FACTORY in makeNodeValidatorPlugin config.
If per-resolver rules are needed, consider using PostGraphile's makeExtendSchemaPlugin with custom validation logic.
Ensure parameterized queries are used and that grafast's value escaping is enabled.
Run npm install graphile-sql-expression-validator@^2.14.0
Change to import { makeNodeValidatorPlugin } from 'graphile-sql-expression-validator'Use NODE_VALIDATOR_FACTORY instead.
Use import statements or set type: module in package.json.