Repository navigation
fix: prevent sqlite commands from opening live state - #123816
fuller-stack-dev merged 4 commits into
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 14, 2026, 5:17 PM ET / 21:17 UTC. ClawSweeper reviewWhat this changesThe PR prevents gateway-hosted external SQLite commands from opening OpenClaw’s active state directory, including direct, positional Merge readinessKeep open for maintainer approval. The prior SQLite Priority: P1 Review scores
Verification
How this fits togetherGateway-hosted agent exec requests pass through preparation before OpenClaw starts a process. The changed guard preserves parsed command arguments, detects SQLite database targets, and rejects targets inside live OpenClaw state. flowchart LR
A[Agent exec request] --> B[Gateway exec preparation]
B --> C[SQLite target analysis]
C --> D{Target inside active state?}
D -->|Yes| E[Actionable rejection]
D -->|No| F[Start external command]
Decision needed
Why: The code is a focused defense-in-depth guard, but accepting its intentional compatibility change and limited scope is a maintainer security-boundary decision. Before merge
Agent review detailsSecurityNone. PR surfaceSource +228, Tests +172. Total +400 across 4 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Adopt this as a bounded gateway-exec mitigation, retaining private-copy access and the explicit boundary that broader live-state ownership remains tracked by the canonical issue. Do we have a high-confidence way to reproduce the issue? Yes: the added focused test supplies direct and reopen command cases plus a pre-spawn marker check; this read-only review inspected the path but did not execute it. Is this the best way to solve the issue? Yes, as a scoped mitigation: the gateway exec preflight owns the decision to launch an external process and has both the resolved workdir and active state directory available before spawn. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against c12745429af4. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
|
Fixed the SQLite shell reopen bypass in |
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Owner decision: land the scoped Gateway exec guard and accept the intentional compatibility change. Live-state |
|
Merged via squash.
|
* fix: prevent sqlite commands from opening live state * fix: preserve early exec control rejection * fix: guard sqlite shell reopen commands
Related: #101290
What Problem This Solves
Fixes an issue where an agent running external
sqlite3against an active OpenClaw state database could join the live WAL lifecycle outside OpenClaw's SQLite version and ownership guards, risking database corruption.Why This Change Was Made
Gateway-host exec preflight now rejects external
sqlite3commands whose initial database or explicit positional/-cmd.opentarget resolves inside the active OpenClaw state directory. The guard follows command carriers, relative paths, state-directory variables, and symlink aliases; private database copies outside the live state tree remain usable.This is defense in depth for the agent-exec path. It does not claim to close the broader live-state ownership work tracked in #101290 or provide an OS sandbox against deliberately obfuscated arbitrary code.
User Impact
Agents can no longer open live OpenClaw state databases directly with external
sqlite3. They receive an actionable error directing them to OpenClaw commands or a private backup copy, while operators can still inspect copied databases normally.Evidence
3289e08c3005515fb8e49379fd18951ef2530507: a harmlesssqlite3stand-in started against both an isolated active-state path and a private copied path (RED)..openreopened a live database after the initial:memory:target passed preflight (RED).09db2821139b9bffde545d8973df506c847b49be: direct, positional.open, and-cmd .openlive targets were rejected before spawn; all three private-copy controls completed (GREEN).