# Local files and SQLite

Select trusted roots, preserve bounded reads and make database/file writes explicit.

Canonical URL: https://opennodeflow.dev/wiki/integration-files/
JSON reference: https://opennodeflow.dev/wiki/integration-files/index.json
Source snapshot: 2026-10-23

Local-file and SQLite utilities execute with the ONF host identity. Configure a deliberate existing rootDirectory and supply relative paths; selecting a root is an operational permission decision, not simply a UI preference.

## File boundaries

Traversal and resolved symlink escapes fail, and ONF's own installed data directory is excluded. Keep the selected root under trusted ownership. Concurrent hostile filesystem replacement is outside this trusted-host tool's boundary. Read bytes and returned output are bounded; a directory listing is metadata, not permission to recursively copy everything.

**Local File Create Exclusive** requires allowWrite:true and runtime $retries:0, an existing parent and a destination that does not already exist. It never overwrites. Cancellation/process failure can leave a partial file, which must be inspected/reconciled before another attempt. A missing receipt does not establish that no bytes were created.

Keep configuration outside production data when creating examples. Use synthetic files in an isolated root; never use secrets, real exports or the runtime database as a test fixture.

## SQLite reads

SQLite uses Node's installed DatabaseSync. The configured database path is relative to the chosen root and must already exist. **SQLite Read Query** opens read-only and accepts SELECT/WITH/EXPLAIN as documented. Other leading commands, including ATTACH, are rejected.

Bind parameters instead of concatenating business input into SQL. Rows are bounded. Big integer results become decimal strings and blobs become Base64 blocks, keeping returned values valid JSON without silent precision loss.

## Explicit transactions

**SQLite Transaction** requires allowWrite:true, runtime $retries:0 and at most 100 parameterized statements. Explicit transaction commands, ATTACH/DETACH and PRAGMA are rejected, including after leading comments. The operation owns its transaction rather than letting statement text silently escape its boundary.

An ordinary exception rolls back. Process loss around COMMIT can leave uncertain completion; reconcile by business keys and actual database readback. A unique constraint or domain idempotency key is more reliable than assuming a timeout rolled back every statement.

SQL remains trusted code. The operation's lexical/transaction restrictions do not turn arbitrary SQL into a hostile multi-tenant sandbox. Give the host only the file permissions it needs.

## Practical verification

Create an isolated scratch database with synthetic rows and a separate file root. Prove a parameterized read, row limit and intentional failing transaction. Confirm unchanged committed data after the failure, then inspect the returned shapes for bigint/blob fields. Test exclusive-file cancellation only in disposable storage.

The source's isolated file/SQLite fixtures demonstrate selected path, bounds and rollback behavior. They do not authorize access to a production database or prove every filesystem race. Continue with the [utility overview](/wiki/integration-utilities/) and exact [catalog references](/wiki/integration-catalog/).

---

## Documentation provenance

- `../OpenNodeFlow-Library/work/core/SETUP.md`
- `../OpenNodeFlow-Library/docs/INTEGRATIONS.md`
- `docs/LIBRARY-UTILITIES.md`

This page describes maintained source, not a live inventory or an authorization to perform actions.
