security(plugins): gnn.ts interpolates node ids, depth and identifiers into executed SQL
Author: ruvnetCreated Sep 28, 2026Updated Sep 28, 2026
Found while hardening the sibling attention.ts for the 3.0.0 @claude-flow/plugins release (PR #3530). Same class of bug, not yet fixed.
v3/@claude-flow/plugins/src/integrations/ruvector/gnn.ts builds SQL with template strings:
- Values:
nodeId,sourceand other ids go inside single quotes (WHERE target_id = '${nodeId}', around L2661/2665/2677/2696), andkgoes intoWHERE kh.depth < ${k}(L2670/2675). A string containing'escapes the literal. - Identifiers:
schema,tableName,edgeTableandnodeColumnare interpolated as"${schema}"."${tableName}". The quotes don't help when the value itself contains", andnodeColumn/sqlFunctionare not quoted at all (L574–584).
TypeScript types don't exist at runtime, so any caller passing through untrusted input reaches executed SQL.
Suggested fix: pass values as bind parameters ($1…), or apply the sqlNumber/string-literal escaping from attention.ts. Validate identifiers against ^[A-Za-z_][A-Za-z0-9_]*$ and allowlist sqlFunction. Add a differential test that legitimate input produces byte-identical SQL, plus rejection tests for each field (the pattern is in __tests__/attention-sql-injection.test.ts).
Source: ruvnet/ruflo