AltimateAI / AltimateAI/altimate-code
data_diff: where_clause grammar validation
- Dominant language
- TypeScript
- Stars
- 811
- Forks
- 134
- Avg merge
- 3d 2h
- Merged PRs (30d)
- 50
Description
Flagged during v0.5.22 release review (Security / Chaos Gremlin persona).
`where_clause` is passed verbatim into generated SQL at `native/connections/data-diff.ts:484` (`WHERE ${whereClause}`) and `:696` (`(${params.where_clause}) AND (${partWhere})`). It is LLM-supplied, gated by `sql_execute_read` permission, but not parsed.
Short-term mitigation shipped in 0.5.22:
- Permission prompt now surfaces the where_clause value (informed consent)
- Tool description explicitly warns it is interpolated verbatim and must not accept untrusted input
Proper fix (this issue):
- Parse the clause with a SQL parser (`sql-parser-cst` or similar) and reject DDL/multi-statement/UNION
- Or whitelist to a safe grammar (comparison ops on column names + literals)
- Keep verbatim mode available behind a config flag for power users
Deferred because: parser integration is meaningful design work; short-term mitigations hold the line.
Contributor guide
Assessment
This issue has not been assessed yet.