mirror of
https://github.com/ruvnet/ruflo.git
synced 2026-11-23 21:59:14 +09:00
BaseGNNLayer.toSQL, GraphOperations' kHopNeighborsSQL/shortestPathSQL/ pageRankSQL/communityDetectionSQL, and GNNSQLGenerator's static SQL builders interpolated schema/table/column identifiers and node id/ algorithm string values directly into executed SQL. TypeScript types are erased at runtime, so any caller passing through untrusted input reached executed SQL (CWE-89). Adds sqlIdent/sqlLiteral/sqlNumber/sqlInt/sqlJson/sqlParamPrefix helpers mirroring attention.ts's existing sqlNumber/sqlBool hardening (PR #3530): identifiers are validated against ^[A-Za-z_][A-Za-z0-9_]*$ and quoted, string values are single-quote-escaped, numeric params are validated finite/integer, and JSON config blobs are escaped before embedding in a jsonb literal (a `'` inside a config value could previously break out of the surrounding SQL string). Adds __tests__/gnn-sql-injection.test.ts (24 tests, mirroring the existing attention-sql-injection.test.ts pattern): byte-identical SQL for legitimate input, and a TypeError for each malicious identifier/ value/numeric field. Verified baseline-fails/candidate-passes via stash isolation (22/25 new tests fail against the unpatched file, all pass against the fix). Full plugins suite: 473 passed/3 skipped both before and after, tsc --noEmit clean. Fixes #3531