Skip to content

Step 5: type the unscoped database doors narrowly and fence their callers #59

Open

Description

@leandrotcawork

Found by the step 5 whole review (Sonnet, finding 6), triaged Issue futura (delivery L12); left out of the closing push for time.

Database.installation and libraryInstallation hand out the same CommandTx as a scoped command. So "opening a transaction without a scope does not compile" (criterion 7, database.check.ts) holds only for read, command and libraryCommand.

Today's callers:

  • platform/database.ts: the migration and login checks.
  • status/status.ts: now installationRead for the read.
  • identity/first-person.ts.
  • Several tests.

In phase 1 these doors reach every company row through runtime_transition. Phase 2 (PR 55) closes them in the database.

Trigger: before a second caller of an unscoped door appears outside platform, status and first-person.

Direction:

  • Narrow installation to the type its callers need (execute plus hub.starts).
  • Add a dependency-cruiser rule that only platform, status and first-person may name installation or libraryInstallation.

Activity

  1. leandrotcawork commented on Oct 17, 2026

    @leandrotcawork
    CollaboratorAuthor

    From the step 5 second delta check: hub_invitation also holds a table-wide INSERT on auth."user" (PR 53). The password command creates the person, so INSERT is needed. But a forgotten column list in the link scope could insert a person with any role, admin included, because the INSERT grant covers every column. Narrow it with the doors here: a column-level INSERT (id, name, email, email_verified, created_at, updated_at), or a row policy WITH CHECK (role is null or role = 'user') on the link scope's insert.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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