Skip to content

PRÆTORE v0.3.3

Choose a tag to compare

@github-actions github-actions released this 04 Nov 02:41
· 425 commits to main since this release
0ce6334

Closes the two known limitations of v0.3.2 in the post-hoc safety ingestion
(G1) for AI-enabled systems: R7, the tenant lock of praetore-safety-ingest
can only be taken by the tenant's registered role (#97, migration 0019), and
L95-1, the socket is set up without following symbolic links (#98). Breaking:
the socket directory needs the sticky bit when it is writable by group or
others. GitHub release with checksums only; nothing is published to
crates.io.

Breaking

  • praetore-safety-ingest refuses a socket directory writable by group or
    others without the sticky bit (L95-1, #98),
    also with
    PRAETORE_SAFETY_SOCKET_GROUP. Before, a group-writable directory (for
    example 0770) was accepted with a socket group; now the ingester does
    not start. Action: chmod 1770 <dir> (with a socket group) or
    chmod 0700 <dir>.

Fixed

  • L95-1 (#98): socket mode and group without following symbolic links.
    praetore-safety-ingest opens the socket directory with O_DIRECTORY | O_NOFOLLOW, checks owner and mode on that descriptor, creates and opens
    its private bind directory relative to it, sets the socket's group with
    fchownat(AT_SYMLINK_NOFOLLOW) and its mode relative to the private
    directory's descriptor after checking the entry is its own socket, and
    renames it into place without replacing an existing entry
    (renameat2(RENAME_NOREPLACE) on Linux, renameatx_np(RENAME_EXCL) on
    macOS). On Linux the mode is set with fchmodat without
    AT_SYMLINK_NOFOLLOW (fchmodat2, Linux 6.6 and later, is not used); the
    entry is checked first, in a directory only the ingester's user can
    write.

  • R7 (#97, migration 0019): the tenant lock of praetore-safety-ingest
    can only be taken by the tenant's registered role.
    It is now a row lock (FOR UPDATE NOWAIT) on the ingester's own row of praetore.safety_ingest_tenants,
    on a second connection, instead of a PostgreSQL advisory lock that any
    login could hold. Migration 0019 adds the lock_anchor column, the only
    one praetore_safety_ingest may UPDATE, and an UPDATE policy limited to
    the session's own registration with WITH CHECK (false), so the row can
    be locked but not changed. Another tenant's role, an unregistered role or
    a role with no grant fails closed. The ingester checks the lock before
    each write and renews it every PRAETORE_SAFETY_LOCK_RENEW_SECONDS
    (default 300: COMMIT; BEGIN; SELECT ... FOR UPDATE NOWAIT), so its
    transaction id is never older than one interval. If the lock is lost or
    a renewal finds it taken, the ingester keeps running, writes nothing and
    retries until it takes the lock again. Reversible with
    docs/rollback/0019-safety-ingest-row-lock.sql (it sets lock_timeout). Stop v0.3.2 ingesters
    before migrating: the old and new locks do not exclude each other.