Skip to content

fix(sqlite3): uprev to @vscode/sqlite3 and fix CVEs - #18117

Merged
WikiRik merged 13 commits into
sequelize:mainfrom
nav-sdi:nsdi/deps/sqlite3
Feb 27, 2026
Merged

WikiRik merged 13 commits into
sequelize:mainfrom
nav-sdi:nsdi/deps/sqlite3

Conversation

@nav-sdi

@nav-sdi nav-sdi commented Feb 12, 2026 •

Copy link
Copy Markdown
Contributor

Pull Request Checklist

  • Have you added new tests to prevent regressions? - N/A
  • If a documentation update is necessary, have you opened a PR to the documentation repository?
    • Anyone ToDo later if change accepted
  • Did you update the typescript typings accordingly (if applicable)? - N/A
  • Does the description below contain a link to an existing issue (Closes #[issue]) or a description of the issue you are solving?
  • Does the name of your PR follow our conventions?

Description of Changes

Three commits, allowing you to chose the level of change:

  • Including a SpectreMitigation flag (Pre-requisite: MSVC v14x - VS 202x C++ x64/x86 Spectre‑mitigated Visual Studio libs)
  • With a patch file to not use SpectreMitigation
  • Full migration to @vscode/sqlite3 which requires some connection-manager.ts changes

List of Breaking Changes

Optional pre-requisite: MSVC v14x - VS 202x C++ x64/x86 Spectre‑mitigated Visual Studio libs installed, if not using the yarn patch file and want the SpectreMitigations.

Summary by CodeRabbit

  • Chores

    • Updated sqlite3 runtime to a patched VS Code variant for improved compatibility.
    • Enhanced Windows CI to install Spectre-mitigated MSVC components for more secure test runs.
  • Tests

    • Made error message assertions more flexible (regex-based) to improve reliability across sqlite3 variants.

@nav-sdi
nav-sdi requested a review from a team as a code owner February 12, 2026 00:36
@nav-sdi
nav-sdi requested review from WikiRik and sdepold February 12, 2026 00:36
@coderabbitai

coderabbitai Bot commented Feb 12, 2026 •

Copy link
Copy Markdown
Contributor

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Replaces the sqlite3 runtime dependency with the VSCode-maintained fork, relaxes sqlite3 error-message assertions in integration tests to regex matching, and adds a Windows CI step to install Spectre-mitigated MSVC libraries.

Changes

Cohort / File(s) Summary
Dependency Update
packages/sqlite3/package.json
Replaces sqlite3 dependency value from ^5.1.7 to npm:@vscode/sqlite3@^5.1.12-vscode, switching runtime resolution to the VSCode fork.
Test Assertion Updates
packages/core/test/integration/error.test.ts
Replaces exact sqlite3 error-message equality assertions with regex-based matches (e.g., /SQLITE_CONSTRAINT.*: .../) and adds inline comments referencing the related Sequelize change to cover both sqlite3 variants.
CI Windows Configuration
.github/workflows/ci.yml
Adds a PowerShell step in the Windows test job to modify the VS 2022 install and add Microsoft.VisualStudio.Component.VC.SpectreMitigated (quiet, no restart, wait) before dependency installation/build steps.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Poem

🐰 I swapped an old nut for one that's new,
A fork from VSCode snug and true,
Errors now match with flexible rhyme,
Windows gains Spectre safety in time,
Hop, hop—tests pass, and I munch on thyme. 🥕

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: upgrading sqlite3 to @vscode/sqlite3 to fix CVEs, which aligns with all file modifications.
Linked Issues check ✅ Passed The PR addresses the core requirement from issue #18111 by replacing deprecated node-sqlite3 with @vscode/sqlite3, a maintained alternative that mitigates security risks.
Out of Scope Changes check ✅ Passed All changes are directly scoped to the sqlite3 upgrade: dependency version bump, error message assertion updates for compatibility, and Windows build infrastructure for Spectre mitigation.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Tip

Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs).
Share your feedback on Discord.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@nav-sdi

nav-sdi commented Feb 14, 2026

Copy link
Copy Markdown
Contributor Author

hey team, what do you think of this interim solution until better-sqlite3 is completed?

@sequelize-bot sequelize-bot Bot added the conflicted This PR has merge conflicts and will not be present in the list of PRs to review label Feb 15, 2026

@WikiRik WikiRik left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, but I'm interested to see if we can do without the patch. And I have a question for something I'm not 100% sure about (and this is a quick review so I didn't dive into the codebase myself)

@sequelize-bot sequelize-bot Bot removed the conflicted This PR has merge conflicts and will not be present in the list of PRs to review label Feb 20, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.github/workflows/ci.yml:
- Around line 133-136: Update the "Install MSVC Spectre-mitigated libraries"
step to (1) use the correct Spectre component IDs
(Microsoft.VisualStudio.Component.VC.Runtimes.x86.x64.Spectre and
Microsoft.VisualStudio.Component.VC.Runtimes.ARM64.Spectre) instead of
Microsoft.VisualStudio.Component.VC.SpectreMitigated, (2) locate Visual Studio
dynamically with vswhere.exe to compute the --installPath rather than using the
hard-coded "C:\Program Files\Microsoft Visual Studio\2022\Enterprise", and (3)
treat installer exit code 3010 (ERROR_SUCCESS_REBOOT_REQUIRED) as success
(map/translate 3010 to exit code 0 or ignore it) so the pwsh step does not fail
CI when a reboot is required.

In `@packages/core/test/integration/error.test.ts`:
- Around line 679-683: The assertion using
expect(error.cause.message).match(...) is missing the chained `.to.` used
throughout this test file; update the expression in error.test.ts so the call
becomes expect(error.cause.message).to.match(...), keeping the same regex and
leaving the surrounding test and variable names (expect, error.cause.message,
.match) intact for consistency with other assertions like those at lines with
expect(...).to.match(...).

Comment thread .github/workflows/ci.yml Resolved
stefan ipate and others added 5 commits February 20, 2026 16:06
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
@nav-sdi
nav-sdi requested a review from WikiRik February 20, 2026 22:08
@nav-sdi

nav-sdi commented Feb 24, 2026

Copy link
Copy Markdown
Contributor Author

Cleaned up, commented, and ready to merge. Reverting to old sqlite3 means updating packages/sqlite3/package.json and thus yarn.lock. Tests shall work with both.

@WikiRik
WikiRik enabled auto-merge (squash) February 27, 2026 09:14
@WikiRik
WikiRik merged commit 9cff359 into sequelize:main Feb 27, 2026
52 checks passed
@coderabbitai coderabbitai Bot mentioned this pull request Apr 6, 2026
5 tasks
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.

node-sqlite3 is deprecated, see https://github.com/TryGhost/node-sqlite3

2 participants