Skip to content

Preserve SQLite locks during session permission checks - #478

Open
Broccolito wants to merge 1 commit into
mainfrom
codex/pr477-postmerge-sqlite-locks
Open

Broccolito wants to merge 1 commit into
mainfrom
codex/pr477-postmerge-sqlite-locks

Conversation

@Broccolito

@Broccolito Broccolito commented Nov 7, 2026 •

Copy link
Copy Markdown
Collaborator

Permission checks can release a running SQLite connection’s POSIX locks by opening and closing another handle to the same database or sidecar inode. A separate read/write SQLite client can then unlink a live WAL, leaving subsequent session changes unavailable through a new reader or after restart.

Use descriptor-free nofollow permission and ACL operations on macOS, and pinned O_PATH descriptors with procfs metadata operations on Linux. Existing ownership, regular-file, hard-link, symlink, mode and ACL checks remain enforced. Linux fails closed when its procfs descriptor path is unavailable.

The regression keeps a pool live while validating storage, opening a second manager, and closing an independent SQLite reader; it checks WAL identity and later writes after reopening. Existing ACL and outside-file protection tests remain covered.

Validation: all 10 session_storage_security tests pass, including the new cross-process WAL regression and existing ACL/alias protections. just check-everything passes, including strict and baseline clippy, frontend lint, generated OpenAPI, socket inheritance, naming, version and registry guards. A separate controlled reproduction confirms that the regression reader removes a live WAL under the legacy ordinary-handle-close pattern and preserves it without that pattern.

Fresh CLI/daemon live testing kept API and external read/write SQLite readers in agreement before and after later writes. The full gate plan, monitor settings and decision records survived a daemon restart and restored correctly in Electron. Two independent source reviews found no actionable issues.

This branch has not been deployed

No deployments
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.

1 participant