persistant 0.19.0

A thin persistence layer over Apache OpenDAL for blobs and records by key: declared capabilities, atomic replace, typed records, and a blocking facade for synchronous callers.
Documentation
# Security policy

## Reporting a vulnerability

Please report suspected vulnerabilities privately through GitHub's private vulnerability reporting for
this repository: <https://github.com/ciresnave/PersistAnt/security/advisories/new>
(the **Security** tab, then **Report a vulnerability**).

Please do not open a public issue or pull request for a suspected vulnerability.

Include the version (`persistant` x.y.z), what you did, what you expected, and what happened. You can
expect an acknowledgement; this is a small project, so please allow some days for a first reply.

## What is and is not protected

Read from the code and the recorded matrix. A capability is claimed only where `matrix/*.tsv` has a row for it.

**Not a goal.** PersistAnt is a library inside your process. It does not authenticate or authorise your users, and it
does not defend against code in the same process, an administrator or root on the machine, or whoever runs the
database server.

### Network (PostgreSQL, MySQL, MariaDB)

- `connect`, `connect_secret`, the registry (`open_named`) and `persistant-migrate`: a URL that names no mode requires
  TLS. A mode written in the URL (`sslmode`, `ssl-mode`) is obeyed as written, so `prefer` lets whoever sits between you
  and the server remove TLS without a sign. `PGSSLMODE` is honoured for PostgreSQL. A Unix socket is left as it is.
- `connect_with` takes a typed `TlsPolicy` that overrides the URL. Its default is `Require`.
- **`Require` does not check the server's certificate**: it stops eavesdropping, not an impostor server. Over an
  untrusted network use `VerifyFull` (`?sslmode=verify-full`, MySQL `?ssl-mode=VERIFY_IDENTITY`).
- `from_pool` takes your pool as you configured it; nothing is added.
- `connection_is_encrypted()` asks the server what the connection really is.
- TLS for OpenDAL services is OpenDAL's; this project does not test it.

### Secrets in memory, logs and errors

- `ConnectionSecret` and `Redacted` print as `<redacted>`, and an `Endpoint` URL has its credentials, query values and
  fragment redacted in `Debug`. The text is an ordinary `String`: it is **not zeroed** when dropped, and it can reach swap
  or a core dump. An environment variable is readable by whatever can read the process environment.
- A plain `&str` URL passed to `connect` is yours to keep out of logs.
- **Errors can carry your data.** `RelError::server_error()` and the `Debug` form hold the server's message and detail,
  which on PostgreSQL can quote row values (for example the key of a unique violation). Other driver error text is passed
  through unfiltered. Do not show these to untrusted users.
- The `persist` tracing spans carry the kind, backend, operation, capability and outcome, not keys or values. sqlx and
  OpenDAL log on their own account; configure those separately.

### Files

- New SQLite databases and, with `OpendalBlob::owner_only()`, new `fs` blob files are readable by their owner only
  (`0600`; a protected ACL on Windows). A file that already exists keeps its permissions. The `fs` driver without
  `owner_only()` follows the umask or the directory's ACL.
- On Windows, directories are not restricted, and the rollback journal of a plain SQLite open inherits the directory's ACL:
  restrict the directory too.

### Plaintext at rest

- **Nothing is encrypted by PersistAnt.** `storage.no_plaintext_at_rest` is off: on `fs` a canary is found raw (SQLite
  files are not yet searched). Encrypt before writing, or use an encrypted volume.

### Erasure

- A plain delete promises only that the key is gone.
- `delete_erased` means "contents overwritten", not "gone from the disk". On `sqlite` and `sqlite-full`, fragments of
  earlier writes were measured to remain; `sqlite-secure` left none in the same test. PostgreSQL, MySQL and MariaDB keep
  deleted tuples until vacuum or purge. Logs, backups, snapshots, copy-on-write file systems and SSD wear levelling can
  keep copies on any backend. Details and measurements: "Limits" in `README.md`.

### SQL

- Parameters are bound. SQL text you pass is run as given: never build it from untrusted input.

## Scope

PersistAnt is a thin layer over [Apache OpenDAL](https://opendal.apache.org/). Reports about the layer's
own behaviour (for example an atomic replace that is not atomic, a capability check that accepts a backend
it should refuse, or a record read that accepts data of the wrong kind or schema) are in scope. Defects in
OpenDAL itself should be reported to that project; tell us as well if PersistAnt's use of it makes the
defect worse.

## Supported versions

The latest release line receives security fixes. An older line receives a backport when the backport is small. When it is not, we do not attempt it: the advisory says that line is not fixed and recommends upgrading. No support period is promised.