Skip to content

hessra_authz

Biscuit-token authorization helpers plus key and service-chain management inside PostgreSQL.

hessra_authz · Biscuit-token authorization helpers plus key and service-chain management inside PostgreSQL.

Overview

IDExtensionPackageVersionCategoryLicenseLanguage
100942hessra_authzhessra_authz0.3.2SECApache-2.0Rust

PostgreSQL · 13, 14, 15, 16, 17

Usage

Sources:

hessra_authz verifies Biscuit authorization tokens locally inside PostgreSQL. It stores named public keys and service-chain definitions, then checks a token’s subject, resource, and operation without contacting an authorization service at verification time.

Key Management and Verification

Create the extension, register a real PEM public key, and verify a real Biscuit token. The example uses psql variables so credentials are not embedded in SQL history.

CREATE EXTENSION hessra_authz;

SELECT add_public_key('issuer', :'issuer_public_key_pem', true);

SELECT verify_token_with_stored_key(
  :'biscuit_token',
  'issuer',
  'alice',
  'invoice/42',
  'read'
);

Public-key management functions are add_public_key, get_public_key, update_public_key, and delete_public_key. Service-chain management uses add_service_chain, get_service_chain, update_service_chain, and delete_service_chain. Direct verification functions accept a PEM key, while the convenience functions read a named or default key from extension-managed tables.

Caveats

  • Current source defines five arguments for verify_token and verify_token_with_stored_key; the reviewed README examples include an obsolete sixth NULL argument. Follow the source/API generated by your installed build.
  • Verification returns SQL void on success and raises an error on denial or malformed input; it does not return a Boolean. An RLS policy using an IS NULL test therefore aborts denied statements instead of evaluating to false.
  • The control file marks version 0.3.2 as superuser-only to install, untrusted, and non-relocatable. The Cargo build features cover PostgreSQL 13 through 17 even though the README says PostgreSQL 12 or newer.
  • Key and service-chain management functions mutate shared extension tables, and upstream defines no application-role policy. Review ownership and revoke EXECUTE or table privileges from roles that must not change authorization configuration.

Table reader