Skip to content

fix: deny passing Buffer columns to SQLite JSON helpers#1698

Open
hwisu wants to merge 3 commits intokysely-org:masterfrom
hwisu:fix/how-sqlite-dialect-handle-bitarray-in-json
Open

fix: deny passing Buffer columns to SQLite JSON helpers#1698
hwisu wants to merge 3 commits intokysely-org:masterfrom
hwisu:fix/how-sqlite-dialect-handle-bitarray-in-json

Conversation

@hwisu
Copy link
Copy Markdown
Contributor

@hwisu hwisu commented Feb 4, 2026

Closes #1687

Howdy 🖖,

This PR adds compile-time type checks to SQLite JSON helpers (jsonArrayFrom, jsonObjectFrom, jsonBuildObject) to reject Buffer/Uint8Array columns.

Passing binary values to JSON functions throws SqliteError: JSON cannot hold BLOB values. This change catches common cases at compile time, avoiding the runtime error when using these helpers.

Changes

  • Added HasUint8Array<T> and ObjectHasUint8ArrayProperty<O> type utilities
  • SQLite JSON helpers now return KyselyTypeError when binary columns are detected
  • Error message includes workarounds: eb.cast(column, "text") or sql`hex(column)`

@vercel
Copy link
Copy Markdown

vercel bot commented Feb 4, 2026

@hwisu is attempting to deploy a commit to the Kysely Team Team on Vercel.

A member of the Team first needs to authorize it.

- Added HasUint8Array<T> and ObjectHasUint8ArrayProperty<O> type utilities
- SQLite JSON helpers now return KyselyTypeError when binary columns are detected
- Error message includes workarounds: eb.cast<string>(column, "text") or sql<string>`hex(column)`
@hwisu hwisu force-pushed the fix/how-sqlite-dialect-handle-bitarray-in-json branch from 3b148d7 to d61611b Compare February 26, 2026 05:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Deny passing Buffer columns to SQLite JSON helpers.

1 participant