Skip to content

[Request]: auth and audit without the store do not refuse a second host (auth also not a network filesystem) #941

Closed

Description

@jimhoyd

Problem or use case

Follow-up from #927. Observed by reading the code on main (eccd51f); not reproduced on two real hosts.

The host check that #936 added for several serving processes lives in the store database: the store_servers lease (hostname plus Linux boot id) and the statfs network-filesystem refusal (packages/store/src/topology.ts). Sites without the store get less:

  • auth (packages/auth/src/auth.ts) opens data/auth.sqlite with WAL and a busy timeout, but it neither reads the filesystem type nor keeps a lease. A site running auth without the store, on two hosts sharing auth.sqlite over NFS/SMB/EFS, activates on both. Better Auth's session and rate-limit tables then rely on WAL and fcntl locking across hosts, which SQLite does not support.
  • audit (packages/audit/src/store.ts) refuses a Linux network filesystem, but keeps no lease. So an audit-only site on two hosts is not refused on macOS or Windows, where the check is skipped, or on a filesystem type missing from the list.

PR #946 documents the gap in docs/STORE.md ("Only the store detects another host") and in the auth and audit READMEs, but nothing enforces it.

Proposed behavior and alternatives

  • auth: refuse a network filesystem with the same statfs list the store and audit use. That is a small change.
  • A host lease that does not depend on the store. Options:
    • a shared helper, used by auth and audit, writing a lease table into their own databases;
    • have core refuse the setup when a site declares any SQLite-backed extension without the store. That seems too coarse.
  • Or leave it documented-only, on the grounds that several hosts are unsupported whichever extension is in use.

Portability: the lease reads /proc/sys/kernel/random/boot_id on Linux and falls back to the hostname elsewhere, as the store's does.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions