loom.core.repository.sqlalchemy.rls.integrity¶
Checks that the guard in the database is one this release of loom shipped, unaltered.
Everything here reads the catalogue, which every role can read, so the
application user runs it at startup, the bootstrap runs it inside its own
transaction and verify runs it with any connection. The catalogue of the
guard is compared, category by category, with the digests pinned for the
revision its functions identify; owners are compared exactly with the guard
schema’s owner, which must also own both event triggers; every grant and every
function setting is compared exactly. Only the configuration row needs a
privileged reader; verify checks it.
Functions
|
|
|
|
|
|
|
|
|
|
|
|
|
Compare every grant and every function setting of the guard exactly. |
|
The policy names the guard creates for a scoped table with |
|
Compare each catalogue category with the revision its functions identify. |
|
Return how the guard |
|
Every guard object must belong to the guard schema's owner, and that to |
|
Refuse to call a guard below |
|
The synchronous |
|
Refuse a guard this release does not know or one below |
|
The released revision whose functions digest is |
|
Everything the application user can check at startup, guard and scoped tables. |
|
Compare every scoped model table with its canonical protection in the catalogue. |
Classes
|
One way the installed guard, or a scoped table, differs from what loom expects. |
|
A synchronous connection, or the bind Alembic hands an operation. |
- class loom.core.repository.sqlalchemy.rls.integrity.Problem(check, subject, expected, actual)[source]¶
Bases:
objectOne way the installed guard, or a scoped table, differs from what loom expects.
- async loom.core.repository.sqlalchemy.rls.integrity.guard_problems(connection, guard, owner, installer=None)[source]¶
Return how the guard
guarddiffers from a released one; empty when it matches.owneris the application schema’s owner role, the only grantee the guard knows. Withinstallerthe guard’s owner must be that role.
- async loom.core.repository.sqlalchemy.rls.integrity.startup_problems(connection, guard, scoped)[source]¶
Everything the application user can check at startup, guard and scoped tables.
- async loom.core.repository.sqlalchemy.rls.integrity.table_problems(connection, guard, schema, scoped)[source]¶
Compare every scoped model table with its canonical protection in the catalogue.
- loom.core.repository.sqlalchemy.rls.integrity.canonical_policies(privileges)[source]¶
The policy names the guard creates for a scoped table with
privileges.
- loom.core.repository.sqlalchemy.rls.integrity.revision_of(functions_digest)[source]¶
The released revision whose functions digest is
functions_digest, if any.
- loom.core.repository.sqlalchemy.rls.integrity.require_revision(number, guard, *, minimum)[source]¶
Refuse a guard this release does not know or one below
minimum.- Raises:
ConfigError – Naming the guard and what to run.
- Parameters:
- Return type:
None
- async loom.core.repository.sqlalchemy.rls.integrity.require_guard_revision(connection, guard, *, minimum=None)[source]¶
Refuse to call a guard below
minimum, by default the minimum compatible revision.- Raises:
ConfigError – When the guard is unknown or its revision is pending.
- Parameters:
- Return type:
None
- class loom.core.repository.sqlalchemy.rls.integrity.SyncExecutor(*args, **kwargs)[source]¶
Bases:
ProtocolA synchronous connection, or the bind Alembic hands an operation.
- loom.core.repository.sqlalchemy.rls.integrity.require_guard_revision_sync(connection, guard, *, minimum=None)[source]¶
The synchronous
require_guard_revision(), for the migration runners.- Raises:
ConfigError – When the guard is unknown or its revision is pending.
- Parameters:
connection (SyncExecutor)
guard (str)
minimum (int | None)
- Return type:
None
- loom.core.repository.sqlalchemy.rls.integrity.catalog_problems(lines, guard)[source]¶
Compare each catalogue category with the revision its functions identify.