Skip to content

fix(sqlite): reject runtimes vulnerable to WAL corruption - #106065

Merged
vincentkoc merged 4 commits into
mainfrom
fix/sqlite-gateway-ownership
Jul 13, 2026
Merged

vincentkoc merged 4 commits into
mainfrom
fix/sqlite-gateway-ownership

Conversation

@vincentkoc

@vincentkoc vincentkoc commented Jul 13, 2026 •

Copy link
Copy Markdown
Member

Related: #101290

What Problem This Solves

Fixes an issue where users running OpenClaw on Node releases with a vulnerable SQLite build could expose WAL-mode state databases to an upstream WAL-reset corruption bug during concurrent writes and checkpoints.

Why This Change Was Made

OpenClaw now requires official Node releases that include a patched SQLite version, verifies the loaded sqlite_version() at runtime, and keeps gateway/daemon execution on Node. Installers, worker bootstrap, service migration, package metadata, CI, and documentation all enforce the same supported ranges: Node 22.22.3+, 24.15.0+, or 25.9.0+.

The stateful guard checks the actual loaded SQLite library instead of trusting Node version or compile-time metadata, so downstream, custom, and --shared-sqlite Node builds fail closed when their runtime library is unsafe. Metadata-only CLI commands do not eagerly initialize SQLite.

User Impact

OpenClaw refuses to open state databases under runtimes vulnerable to the WAL-reset bug and prints an actionable upgrade message. Fresh installs and daemon migrations select a safe Node runtime, while Bun remains supported as a package/script runner rather than the stateful OpenClaw runtime.

Evidence

  • Blacksmith Testbox through Crabbox: tbx_01kxcxbvv88achex8758k48h43, Actions run 29225126402.
  • Exact validation runtime: Node 24.15.0, SQLite 3.51.3.
  • Final installer/runtime slice: 51 passing tests across PowerShell install, runtime guard, and SQLite guard.
  • Broader touched-surface slice: 8 Vitest projects, 487 passing tests, 1 expected skip.
  • Full build passed under Node 24.15.0 / SQLite 3.51.3.
  • Fresh Testbox tbx_01kxczr2bnybcfxbwzhyhns3pe, Actions run 29226814949: 157 passing tests, 1 expected skip; CLI startup build and bootstrap import guard passed.
  • Node 24.15 startup memory passed: plugins list --json used 388.0 MB RSS against the measured 400 MB Linux ceiling.
  • Real Bun 1.3.13 and 1.3.14 launcher checks reject unsupported node:sqlite execution with the expected upgrade guidance.
  • Cross-platform proof passed on macOS arm64, Linux x64, Docker Debian, Alpine/musl, AWS Graviton arm64, Apple VM arm64, Windows x64, WSL2, and ARM32 emulation.
  • Snapshot/restore stress completed 100 concurrent restore cycles over 9.16 million rows with exact digest equality and a peak WAL around 121 MB.
  • Final autoreview clean at 0.87 confidence after direct Node source review of shared-SQLite behavior.

Known platform gap: the available native Windows ARM64 VM was unresponsive; Windows x64 and WSL2 validation passed.

@vincentkoc vincentkoc self-assigned this Jul 13, 2026
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation channel: whatsapp-web Channel integration: whatsapp-web app: macos App: macos gateway Gateway runtime cli CLI command changes scripts Repository scripts commands Command implementations plugin: file-transfer size: XL maintainer Maintainer-authored PR labels Jul 13, 2026
@vincentkoc
vincentkoc marked this pull request as ready for review July 13, 2026 05:25
@vincentkoc
vincentkoc requested a review from a team as a code owner July 13, 2026 05:25
@github-actions

Copy link
Copy Markdown
Contributor

Dependency Guard

This PR changes dependency-related files. Maintainers should confirm these changes are intentional.

Changed files:

  • npm-shrinkwrap.json
  • package.json

Maintainer follow-up:

  • Review whether the dependency changes are intentional.
  • Inspect resolved package deltas when lockfile, shrinkwrap, or workspace dependency policy changes are present.
  • Treat package-lock.json and npm-shrinkwrap.json diffs as security-review surfaces.
  • Run pnpm deps:changes:report -- --base-ref origin/main --markdown /tmp/dependency-changes.md --json /tmp/dependency-changes.json locally for detailed release-style evidence.

@github-actions github-actions Bot added the dependencies-changed PR changes dependency-related files label Jul 13, 2026
@github-actions

github-actions Bot commented Jul 13, 2026 •

Copy link
Copy Markdown
Contributor

Dependency graph changes noted

This PR includes dependency graph changes. The dependency guard is informational because the PR author is a repository admin or a member of @openclaw/openclaw-secops.

  • Current SHA: 7bcefb5ff964f75a6fd3ac9d80bcffbf619a87c7
  • Trusted actor: @vincentkoc
  • Trusted role: pull request author; openclaw-secops

Security review is still recommended before merge when the dependency graph change is intentional.

@vincentkoc vincentkoc closed this Jul 13, 2026
@vincentkoc vincentkoc reopened this Jul 13, 2026
@vincentkoc
vincentkoc force-pushed the fix/sqlite-gateway-ownership branch from d0d7251 to 7bcefb5 Compare July 13, 2026 05:31
@vincentkoc

Copy link
Copy Markdown
Member Author

Land-ready proof for 865c6c0bdb3b1ae3fb09f50a08ca6c9f778fe05c:

  • Repo-native prepare gate passed in hosted exact/recent-rebase mode: OPENCLAW_TESTBOX=1 scripts/pr prepare-run 106065.
  • Exact-head CI passed: run 29227349515.
  • Exact-head Blacksmith Testbox passed: run 29227349517.
  • Exact-head ARM Testbox passed: run 29227349502.
  • Exact-head build artifacts and startup-memory gate passed: run 29227349521.
  • Installer sync passed on Windows, macOS, and Linux/Docker: run 29227349514.
  • Fresh direct Testbox tbx_01kxczr2bnybcfxbwzhyhns3pe, Actions run 29226814949: 157 tests passed, 1 expected skip; CLI startup build and bootstrap import guard passed.
  • Node 24.15 startup memory passed with plugins list --json at 388.0 MB RSS against the measured 400 MB Linux ceiling.
  • Final autoreview clean at 0.87 after direct Node source review confirmed that --shared-sqlite builds require loaded-library sqlite_version() validation.

Several ancillary detector/CodeQL jobs failed while the GitHub App installation was rate-limited; the authoritative full CI and hosted Testbox gates passed. Known platform gap remains native Windows ARM64 because the available VM was unresponsive; Windows x64 and WSL2 passed.

@vincentkoc
vincentkoc merged commit f33ab24 into main Jul 13, 2026
111 of 125 checks passed
@vincentkoc
vincentkoc deleted the fix/sqlite-gateway-ownership branch July 13, 2026 05:59
@vincentkoc

Copy link
Copy Markdown
Member Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jul 13, 2026
…06065)

* fix(sqlite): require WAL-reset-safe Node runtime

* docs(sqlite): document safe Node runtime floor

* fix(sqlite): defer runtime library validation until use

* fix(ci): align startup memory with Node 24.15
vincentkoc added a commit that referenced this pull request Jul 13, 2026
* fix(sqlite): require WAL-reset-safe Node runtime

* docs(sqlite): document safe Node runtime floor

* fix(sqlite): defer runtime library validation until use

* fix(ci): align startup memory with Node 24.15
zooqueen pushed a commit to zooqueen/openclaw that referenced this pull request Sep 11, 2026
…06065)

* fix(sqlite): require WAL-reset-safe Node runtime

* docs(sqlite): document safe Node runtime floor

* fix(sqlite): defer runtime library validation until use

* fix(ci): align startup memory with Node 24.15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: macos App: macos channel: whatsapp-web Channel integration: whatsapp-web cli CLI command changes commands Command implementations dependencies-changed PR changes dependency-related files docs Improvements or additions to documentation gateway Gateway runtime maintainer Maintainer-authored PR plugin: file-transfer scripts Repository scripts size: XL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant