testing/cross_backend/cell_grant_role.ts

Cross-backend parity suite for role-shaped cell_grants.

The cell CRUD / relations suites exercise only actor-shaped grant principals. This suite covers the role-shaped path and its closed-registry gate — the security-correctness property that the Rust spine previously lacked (it created inert grant rows for any role string). Both spines now validate the role against a closed registry at create.

  • role grant admits a holder; excludes a non-holder — an owner grants {role} on a private cell; an account holding that role can cell_get it (200), an account without it gets the IDOR-mask 404.
  • unknown role rejected at create (security-correctness) — granting a role outside the registry is invalid_params / cell_grant_unknown_role, not a silent inert row.
  • editor-level role grant admits edit — a holder of an editor-level role grant can cell_update the cell's content.

The holder is seeded via extra_accounts under CELL_ROLE_HOLDER_USERNAME holding the suite's role — CELL_EDITOR_ROLE by default, which has no grant path, so it can't be offered and the bootstrap-cradle seed is the only path. Both legs configure that seed and register CELL_EDITOR_ROLE in their role registry; the same membership is in the Rust stub's RoleRegistry (which the cell spec set also reads). A backend with only the builtin roles passes ROLE_KEEPER (no admin reach, so every arm still turns on the grant); ROLE_ADMIN is refused, since an admin reaches every cell whatever its grants.

Cites security.md §Authorization (role-shaped cell-grant validation). Runs both legs via the shared {setup_test} protocol: in-process (auth/cell_grant_role_parity.db.test.ts) + cross-process (cross_backend/spine_suites.cross.test.ts). Gated on capabilities.cell_relations (true on the in-process app and fuz_app's spine presets; a consumer states it like every MountFlag).

view source

Declarations
#

4 declarations

CELL_EDITOR_ROLE
#

CELL_ROLE_HOLDER_USERNAME
#

CellGrantRoleCrossTestOptions
#

testing/cross_backend/cell_grant_role.ts view source

CellGrantRoleCrossTestOptions import type {CellGrantRoleCrossTestOptions} from '@fuzdev/fuz_app/testing/cross_backend/cell_grant_role.js';

inheritance

role?

The role the grants name, which the CELL_ROLE_HOLDER_USERNAME account the setup seeds must hold and the backend's cell role registry must know. Default CELL_EDITOR_ROLE. It must not be ROLE_ADMIN: a global admin views and edits every cell, so the holder arms would pass without the grant — the call throws. ROLE_KEEPER serves a backend with only the builtin roles, since keeper reach is not admin reach.

type string

readonly

describe_cell_grant_role_cross_tests
#

Depends on
#

Imported by
#