GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — sqlite: always copy changeset before applying by trivikr · Pull Request #65870 · nodejs/node

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

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@trivikr
sqlite: always copy changeset before applying
1c77ab8
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 <[email protected]>
Assisted-by: codex
@nodejs-github-bot

nodejs-github-bot commented Sep 7, 2026

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/sqlite
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@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 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

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 37 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.
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@geeksilva97

geeksilva97 commented Sep 7, 2026

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?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@trivikr trivikr mentioned this pull request Sep 7, 2026
sqlite: track registered user-defined functions #65880
Closed
@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 reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

geeksilva97
geeksilva97 approved these changes Sep 7, 2026
View reviewed changes
@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
@github-actions github-actions Bot removed 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
@nodejs-github-bot

nodejs-github-bot commented Sep 7, 2026

Copy link
Copy Markdown
Collaborator

CI: https://ci.nodejs.org/job/node-test-pull-request/77161/

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

jasnell
jasnell approved these changes Sep 8, 2026
View reviewed changes
@trivikr trivikr added author ready PRs with CI started, the required approvals, and no outstanding review comments. commit-queue PRs queued for automated landing through the Commit Queue. labels Sep 8, 2026
@nodejs-github-bot
nodejs-github-bot merged commit f9072f3 into nodejs:main Sep 9, 2026
95 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@nodejs-github-bot

nodejs-github-bot commented Sep 9, 2026

Copy link
Copy Markdown
Collaborator

Landed in f9072f3

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@nodejs-github-bot nodejs-github-bot removed the commit-queue PRs queued for automated landing through the Commit Queue. label Sep 9, 2026
aduh95 pushed a commit that referenced this pull request Sep 16, 2026
@trivikr @aduh95
sqlite: always copy changeset before applying
baf112b
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 <[email protected]>
Assisted-by: codex
PR-URL: #65870
Reviewed-By: Edy Silva <[email protected]>
Reviewed-By: James M Snell <[email protected]>
mceachen added a commit to photostructure/node-sqlite that referenced this pull request Sep 18, 2026
@mceachen
fix(sqlite_impl): always copy changeset before applying
73863bf
SQLite reaches JavaScript through a user-defined SQL function in a CHECK
constraint or trigger, not just through an explicit filter or onConflict
callback, so the previous condition left the input buffer detachable
while SQLite was still reading it.

Ports nodejs/node#65870.
@github-actions github-actions Bot mentioned this pull request Sep 20, 2026
2026-09-22, Version 26.10.0 (Current) #66163
Merged
@trivikr
trivikr deleted the sqlite-copy-changeset-before-applying branch September 22, 2026 13:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@jasnell jasnell jasnell approved these changes
@geeksilva97 geeksilva97 geeksilva97 approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

author ready PRs with CI started, the required approvals, and no outstanding review comments. 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.

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

4 participants

@trivikr @nodejs-github-bot @geeksilva97 @jasnell
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.