[PR #576] [CLOSED] fix(checkpoint-sqlite): fix invalid SQL syntax on list #862

Closed
opened 2026-02-15 19:16:11 -05:00 by yindo · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/langchain-ai/langgraphjs/pull/576
Author: @benjamincburns
Created: 10/10/2024
Status: Closed

Base: mainHead: fix-sqlitesaver-list-sql-bug


📝 Commits (1)

  • b2c7bb3 fix(checkpoint-sqlite): fix invalid SQL syntax on list

📊 Changes

1 file changed (+18 additions, -4 deletions)

View changed files

📝 libs/checkpoint-sqlite/src/index.ts (+18 -4)

📄 Description

Prior to this change, if no filters (including those defined by config.configurable) were passed to the SqliteSaver.list method, it would throw due to there being a WHERE keyword with an empty predicate list in the prepared SELECT query. This change builds the query iteratively to avoid this error.

This change also fixes a potential (albeit unlikely) SQL injection attack vector in the same query. Prior to this change, the limit value was being directly concatenated into the sql string, rather than being sanitized first.

Found while working on #541, thanks to this test.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/langchain-ai/langgraphjs/pull/576 **Author:** [@benjamincburns](https://github.com/benjamincburns) **Created:** 10/10/2024 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix-sqlitesaver-list-sql-bug` --- ### 📝 Commits (1) - [`b2c7bb3`](https://github.com/langchain-ai/langgraphjs/commit/b2c7bb31c1c38ac334a240f2db33efa1594cd64c) fix(checkpoint-sqlite): fix invalid SQL syntax on list ### 📊 Changes **1 file changed** (+18 additions, -4 deletions) <details> <summary>View changed files</summary> 📝 `libs/checkpoint-sqlite/src/index.ts` (+18 -4) </details> ### 📄 Description Prior to this change, if no filters (including those defined by `config.configurable`) were passed to the `SqliteSaver.list` method, it would throw due to there being a `WHERE` keyword with an empty predicate list in the prepared `SELECT` query. This change builds the query iteratively to avoid this error. This change also fixes a potential (albeit unlikely) SQL injection attack vector in the same query. Prior to this change, the `limit` value was being directly concatenated into the `sql` string, rather than being sanitized first. Found while working on #541, thanks to [this test](https://github.com/benjamincburns/langgraphjs/blob/d95f4aafac23d2f39c12a7c1c0a2f2ede0815ba8/libs/checkpoint-validation/src/tests/spec/list.ts#L148-L170). --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
yindo added the pull-request label 2026-02-15 19:16:11 -05:00
yindo closed this issue 2026-02-15 19:16:11 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langchain-ai/langgraphjs#862