#526 Harden the desktop app and the .och store against untrusted files
–
- github
- github/openchronology/timeline-app
- github/openchronology/timeline-app#526
- pull request
- state:merged
**Opening untrusted `.och` files:** - **Size limits:** sqlite-rational's functions bound `q_decimal`'s exponent to ±10,000, as the editor's parser does, and each argument to 1 MiB. Past those they return `SQLITE_TOOBIG` instead of failing inside GMP. - **Which functions a file may call:** only `q_is_canonical`, which the store's CHECK constraints need, may be used from a file's own schema. The others are `SQLITE_DIRECTONLY`. - **Columns:** `check_file` refuses tables with generated or hidden columns. - **Core dumps:** `och-convert` sets `RLIMIT_CORE` to 0 and turns off `PR_SET_DUMPABLE`, so a crash never writes a core dump. - **Unchanged:** times stay exact rationals of any size within those limits. **Local files in the desktop app:** - **System thumbnailers:** freedesktop thumbnailers, Quick Look and the Windows Shell now run only on files in folders a timeline was populated from, or for a timeline the user chose to trust at the existing "Open … in its app?" prompt. The app's own decoding and the file manager's existing thumbnails work for any file. - **Opening a file link:** an allowlist replaces the old denylist. The populator's photos, videos and sounds open in their default app, as do PDFs, plain text and office documents. Anything else is revealed in the file manager instead. - **Private files:** - staged documents are created readable only by the user (0600) from the start; - thumbnail scratch folders and the cache are 0700, with thumbnails written 0600. **Upstream:** the change to `vendor/sqlite-rational` should also go to athanclark/sqlite-rational, with `vendor/versions.json` updated to that commit. **Tests:** - **Rust:** - `native-store`: a crafted file is refused without a crash; exponent and size limits; private staged files. - `src-tauri`: thumbnailers run only on chosen files; private cache and scratch folders; the allowlist. - **sqlite-rational:** the extension's own tests. - **`test/files.mjs`:** `och-convert` refuses the crafted file with a 400 and exits normally. - **`test/populate-browser.mjs`:** thumbnails are asked again once a timeline is trusted. - **Passing locally:** `cargo test` for native-store (33) and src-tauri (14), sqlite-rational's `ctest`, `test/files.mjs`, the unit suite, the typecheck, and the populate browser check (run in Chromium). **Docs:** `docs/architecture.md`, `docs/file-populator.md`, the vendored sqlite-rational README. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_011fFY8eruEi1xAkkMBni13B https://github.com/openchronology/timeline-app/pull/526
Related
Open #526 Harden the desktop app and the .och store against untrusted files in the timeline