IF Commons GitHub

sql/cli/scope

Written to: 1 requirement: 1 proved, 0 partly, 0 failing, 0 with no test recorded. 0046-arcactl FR-012

arcactl scope (commons data 0046-arcactl FR-012): the statement that sets a sealed scope, made by the issuer that holds the key. A policy of a sealed table trusts a scope only with its mark (0009-sql-features FR-019), so a person at psql or DBeaver, or a service that has authenticated a caller, cannot simply SET a tenant: they run what this prints. --tenant a,b is a list of tenants (reach set), --subtree T is a tenant and every tenant beneath it, read from the tenant table (the one command of this file that connects), and --all is the wildcard of a platform operator. The key is read from ARCA_SEAL_KEY (or the file ARCA_SEAL_KEY_FILE names) and is never an argument; what is printed holds a mark, never the key.

Source: commons/data/sql/cli/scope.ts

0 of 3 exports are imported by a test of the run. A test that imports an export may not call it or check what it returns.

SCOPE_USAGEconstno test imports it
const SCOPE_USAGE: "usage: arcactl scope (--tenant ID[,ID...] | --subtree ID | --all) [--name tenant] [--prefix app] [--… (972 characters)
const SCOPE_USAGE: "usage: arcactl scope (--tenant ID[,ID...] | --subtree ID | --all) [--name tenant] [--prefix app] [--local] [--schema arca] [--json]\n\n  --tenant a,b     the tenants the scope reaches (one is the plain scope of a tenant)\n  --subtree T      the tenant T and every tenant beneath it, read from the tenant table (connects: ARCA_DATABASE_URL or libpq's environment)\n  --all            every tenant: the wildcard of a platform operator (the policies must have been made with --reach set --wildcard)\n  --name <n>       the scope's name, as in security.scope (default tenant)\n  --prefix <p>     the prefix of the setting (default app)\n  --local          for the transaction only (default: the session, which is what a tool in autocommit needs)\n  --schema <s>     the schema of the tenant table, for --subtree (default arca)\n  --json           machine-readable output\n\nThe key comes from ARCA_SEAL_KEY (or ARCA_SEAL_KEY_FILE), never from an argument."

The usage of arcactl scope, shown with a refusal.

scopeCommandfunctionno test imports it
function scopeCommand(given: readonly string[], io: Io): Promise<Outcome>

Runs arcactl scope.

ParameterWhat it is
giventhe arguments after the command
iothe environment, and how a connection is made
subtreefunctionno test imports it
function subtree(connection: Connection, schema: string, root: string): Promise<readonly string[]>

The tenants of a subtree: the tenant and every tenant beneath it, by the parent relationship of the tenancy model.

Titles, headings, exports, tables, columns and requirements. Esc closes.