Skip to content

sqlite: always copy changeset before applying - #65870

Open
trivikr wants to merge 1 commit into
nodejs:mainfrom
trivikr:sqlite-copy-changeset-before-applying
Open

sqlite: always copy changeset before applying#65870
trivikr wants to merge 1 commit into
nodejs:mainfrom
trivikr:sqlite-copy-changeset-before-applying

Conversation

@trivikr

@trivikr trivikr commented Sep 7, 2026

Copy link
Copy Markdown
Member

Refs: #65286 (comment)

SQLite can invoke JavaScript through user-defined SQL functions while applying a changeset, even when no filter or conflict callback is set. Copy non-empty changesets unconditionally so JavaScript cannot detach or modify the input while SQLite is still reading it.


Assisted-by: codex

SQLite can invoke JavaScript through user-defined SQL functions while
applying a changeset, even when no filter or conflict callback is set.
Copy non-empty changesets unconditionally so JavaScript cannot detach
or modify the input while SQLite is still reading it.

Signed-off-by: Kamat, Trivikram <16024985+trivikr@users.noreply.github.com>
Assisted-by: codex
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/sqlite

@nodejs-github-bot nodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. needs-ci PRs that need a full CI run. sqlite Issues and PRs related to the SQLite subsystem. labels Sep 7, 2026
@trivikr
trivikr requested a review from geeksilva97 September 7, 2026 01:16
@trivikr trivikr added the request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. label Sep 7, 2026
@codecov

codecov Bot commented Sep 7, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 90.18%. Comparing base (695f01f) to head (1c77ab8).
⚠️ Report is 18 commits behind head on main.

Files with missing lines Patch % Lines
src/node_sqlite.cc 0.00% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #65870      +/-   ##
==========================================
- Coverage   90.19%   90.18%   -0.01%     
==========================================
  Files         771      771              
  Lines      264628   264627       -1     
  Branches    50237    50235       -2     
==========================================
- Hits       238683   238658      -25     
- Misses      16953    16960       +7     
- Partials     8992     9009      +17     
Files with missing lines Coverage Δ
src/node_sqlite.cc 82.13% <0.00%> (-0.08%) ⬇️

... and 21 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@geeksilva97

Copy link
Copy Markdown
Contributor

It seems the same as Matteo did in his first implementation. If we're on this endeavor, I'd rather have track of all the user defined functions and prevent them being called on all the surfaces.

WDYT?

@trivikr

trivikr commented Sep 7, 2026

Copy link
Copy Markdown
Member Author

I'd rather have track of all the user defined functions and prevent them being called on all the surfaces.

Created #65880 to track registered user-defined functions separately.

Can we keep this PR focused on protecting the changeset buffer while preserving existing SQL function behavior?

@geeksilva97 geeksilva97 added request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. and removed request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. labels Sep 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

c++ Issues and PRs that require attention from people who are familiar with C++. needs-ci PRs that need a full CI run. request-ci Add this label to start a Jenkins CI on a PR. Only starts once the PR has an approving review. sqlite Issues and PRs related to the SQLite subsystem.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants