Skip to main content

warden

Identity and audit for Python web applications: users, sign-in, invitations, OpenID Connect single sign-on, roles and permissions, API keys, and a tamper-evident audit trail with syslog forwarding.

Status: 0.1.0, the first release. Before 1.0 a minor version may break the public API, and every break is named in the changelog with an upgrade note.

warden is built by Cognisn as the shared identity and audit foundation for its products. It is an embedded library, not a service: an application installs it, passes in its database connection pool and configuration, and mounts warden's FastAPI routers wherever it chooses. warden has no user interface; each application builds its own screens against warden's documented HTTP contract.

What it provides

Identity

  • User lifecycle: invite, activate, suspend and deactivate.
  • Password sign-in with TOTP and recovery codes, with Argon2id hashing.
  • Password policies chosen by role or pinned per user: length, character class and passphrase rules, change-period tiers, history and a minimum age; watch lists of passwords that must not be used (a built-in common-password list, local lists, Have I Been Pwned imports and an optional range lookup), an optional recheck of passwords in use, and a forced change after sign-in when a password is expired or listed.
  • Live password feedback: a policy description a browser can evaluate, a check route for each place a password is set, and a file of rule test cases that proves a client agrees with the server.
  • Passkeys and security keys (WebAuthn): as a second factor beside TOTP, or a passkey on its own, with a passkey_only sign-in method, an emailed registration link and passkey invitations.
  • Invitations and password reset by single-use, expiring emailed links.
  • OpenID Connect single sign-on: authorisation code with PKCE, pre-provisioned accounts only, and local password sign-in kept as the break-glass path.
  • Access tokens and rotating refresh tokens, with reuse detection and an absolute session lifespan.
  • API keys scoped to a subset of permissions.
  • Roles defined by the application as named sets of its own permissions, with FastAPI dependencies to enforce them.

Audit

  • One recording funnel for warden's own events and the application's.
  • A hash-chained, append-only audit trail, with a verification command.
  • Forwarding to a syslog collector (RFC 5424 over UDP, TCP or TLS) that never slows a request.
  • Filtering and export to CSV or NDJSON.
  • Configurable retention, with signed checkpoints that keep the chain verifiable across purges.
  • Signed anchors of the chain's head, which a SIEM keeps and verification checks the database against.

The audit half works on its own, so an application with its own authentication can still use it.

Requirements

  • Python 3.12 or later.
  • PostgreSQL. warden keeps its tables in a dedicated warden schema with its own migration history.
  • FastAPI and psycopg 3, installed with warden.
  • cognisn-konfig for configuration and secrets, installed with warden.

psycopg needs the PostgreSQL client library, libpq. Install the binary build alongside warden (psycopg[binary]) or provide a system libpq.

Installation

pip install cognisn-warden "psycopg[binary]"

The import name is warden. A pre-release, such as 0.1.0rc1, needs pip install --pre cognisn-warden or the exact version.

An application loads its WardenConfig through konfig, runs warden migrate against its database, passes warden its connection pool, and mounts warden's routers under prefixes it chooses. The client-behaviour guide describes what a client of those routes must do, and the HTTP contract documents every route.

Documentation

Sample console

examples/console is a small sample product that mounts warden's routers in FastAPI and exercises them from a plain HTML and JavaScript console: sign-in with TOTP, single sign-on, invitations and password reset (with an in-memory outbox), administration, API keys, and the audit trail with export, verification, anchors and syslog. It shows how a product integrates warden, using only warden's public surface. It is for local development only, not a deployment template, and it is not part of the published package.

Licence

Licensed under the Apache License, Version 2.0. Copyright 2026 Cognisn Pty Ltd. See NOTICE.

Metadata

Release files for cognisn-warden 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cognisn-warden 0.1.0
File Size Uploaded Provenance Actions
cognisn_warden-0.1.0.tar.gz 2.6 MB With provenance Details for cognisn_warden-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for cognisn-warden 0.1.0
File Interpreter ABI Platform Actions
cognisn_warden-0.1.0-py3-none-any.whl Python 3 none any Details for cognisn_warden-0.1.0-py3-none-any.whl

Total release size: 5.0 MB

Release files / cognisn_warden-0.1.0.tar.gz

Download URL cognisn_warden-0.1.0.tar.gz
Size 2.6 MB
Tags Source
SHA-256 checksum
How to use checksums
32601a2b6205a8377714c6fab084a5e77f8146d829b6a666f30cda920687e404
BLAKE2b-256 checksum
How to use checksums
74b9fbd339123e27f173f433a1ef60ec42ef5a9e3aaabcd8692920db3e30a701
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 12, 2026.

Transparency log

Release files / cognisn_warden-0.1.0-py3-none-any.whl

Download URL cognisn_warden-0.1.0-py3-none-any.whl
Size 2.3 MB
Tags Python 3
SHA-256 checksum
How to use checksums
9b36d53c340fe4cd92d8471aedd9906537da0bca714488ea85154e4b8289cd75
BLAKE2b-256 checksum
How to use checksums
72081177698805ba9f6239e43960e016cbb1a6f07cae06b0f05a1998913ae88c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 12, 2026.

Transparency log

Security for cognisn-warden 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for cognisn_warden-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 12, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page