Piotr ChojnackiandClaude Opus 5.5 b06df51a47 docs: recommend Cloudflare's security-audit skill for the family
A personal, uncommitted install of cloudflare/security-audit-skill (MIT,
reviewed at c1c8a8c), why it fits this platform's trust boundaries, how to run
it, and its limits here. Its findings validator does not run on Windows, and it
never executes target code without a sandbox or touches production. Ends with a
proposed handling of results and one open question: vendor it or not.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-13 12:31:05 +01:00

Atrium

Atrium — the Dredd family's front door: a launcher and marketplace for every dredd-core module, with the administration that decides who is offered what.

Self-hosted and single-tenant, built on dredd-core — the shared substrate this app family installs as a dependency rather than copies.

What it does

Atrium is where people in the organisation find and open the family's applications — the way the app launcher and Marketplace work in Google Workspace — and where an administrator decides who is offered what.

  • The sidebar's Apps section lists the modules you can open. Home has one search box over the modules, At a glance (your numbers and 14-day charts; the platform's for an administrator), your pending access requests and, for an administrator, the platform's state (module counts and health checks). A module is a path on this same origin, so opening one replaces Atrium in this tab by default (a new tab instead is an instance setting).
  • Modules is one place with three tabs. Marketplace lists every module offered on this instance, with its category, lifecycle (live · beta · coming soon) and whether you have it; a module offered to selected people can be requested, and the request lands in the administrators' queue. My requests are your own. Manage (administrators only) is the module catalog: name, mark, address, health address, status, availability and assignments.
  • Administration, in three groups: Access — the access-request queue; People and organization — users and the organization (units and their members); Platform — typed settings, model providers and the audit log.

Availability is the administrator's decision per module: everyone, selected, or off (hidden from the marketplace; administrators still see it). selected means the users assigned directly plus the members of every assigned organizational unit and of every unit below it — assign a module to Legal and Legal's teams get it too. Membership is a permission grant on a unit, resolved through dredd-core's authz, so policy overlays apply.

One platform, one account, one admin pane. The family runs at one origin, one module per path (/atrium, /galena, /sygna, /counsel). A person has ONE identity: they sign in once, in Atrium, and every module resolves the same session. Modules keep their own schema and their own least-privilege roles — database isolation is unchanged — but identity is shared, not duplicated. What a module still owns alone is its domain settings (Galena's storage and encryption, Sygna's rates, Counsel's scoring). Because there is one origin there is no cross-origin handoff to design: no signed assertion, no audience binding, no SameSite dance.

Availability is still only what Atrium offers: it decides whose launcher a module appears in. It is not a lock on the module — a path is guessable — and what actually keeps someone out of a module is that module's own permission grants, so an unassigned person who types the path reaches it and finds it empty.

Two tiers of administration, and two words for them. An administrator is platform-wide: every module, plus the hub. A moderator administers exactly one module and has no permissions outside it. Both are granted here and nowhere else, and the enforcement is the database grant, not a missing screen: a module's runtime role may read seven columns of an account and write three columns of a session row, and holds SELECT and nothing more on the moderator roster — so it can neither create an account, elevate one, mint a credential, nor appoint a moderator of itself. The last administrator can be neither demoted nor deactivated.

It is one setting, IDENTITY_SCHEMA, plus provisioning the neutral schema as the platform admin and Atrium's revision 0004 — and the family deploy kit (deploy/) turns it on by default: deploy/init.sh writes one account for the whole platform into every file, and the first deploy/push.sh builds it from an empty database (--standalone is the explicit opt-out). Empty, Atrium is a standalone install that owns its own accounts — this repository's own single-app quick start below, and the same code, which it must stay. deploy/RUNBOOK-one-account.md is for converting an EXISTING standalone deployment, including exactly what happens to its four admin@example.com rows.

The seed puts the family in the catalog — Galena, Sygna, Counsel Scorecard and Compass (coming soon) — without addresses: an installation decides where it serves its modules, so an administrator sets each address under Modules → Manage and the module then appears in everyone's launcher. On the standard layout that address is this origin plus the module's path (http://<host>/galena) — an ordinary absolute URL, which is why nothing about the address gates changes when the family shares a host.

API

Who Endpoints (under /api/v1)
anyone GET /health · POST /auth/login · POST /auth/logout
any signed-in user GET /auth/me · GET /launcher · GET /marketplace?q=&category= · GET /marketplace/{slug} · POST /marketplace/{slug}/requests · GET /me/access-requests · GET /config · GET /users · POST /me/password · GET/POST /me/tokens · DELETE /me/tokens/{id} · POST /me/modules/{slug}/tokens (an app token for a module — minting lives only here, because no module holds INSERT on session) · the org tree, filtered to units you can read: GET /tree/containers · GET /nodes/{id}/children
administrators POST /users · POST /users/{id}/deactivate|reactivate · POST /users/{id}/administrator (the platform-wide tier; refuses to remove the last one) · GET/POST /admin/modules · GET/PATCH/DELETE /admin/modules/{slug} · GET/POST /admin/modules/{slug}/moderators · DELETE /admin/modules/{slug}/moderators/{user_id} · POST /admin/modules/{slug}/assignments · DELETE /admin/modules/{slug}/assignments/{id} · POST /admin/modules/{slug}/probe · GET /admin/access-requests?status= · POST /admin/access-requests/{id}/approve|decline · GET/PUT /admin/settings · GET /admin/overview · GET /admin/audit?action=
unit managers (and administrators) POST /nodes (a top-level workspace: administrators only) · DELETE /nodes/{id} · GET/PUT /nodes/{id}/grants · DELETE /nodes/{id}/grants/{user_id}

Settings are a closed, typed set (instance_name, welcome_message, support_contact, launcher_open_mode, allow_access_requests, default_availability); a write naming any other key is refused. The health probe is a server-side GET to the address an administrator entered — http(s) only, never follows redirects, one 5-second deadline for the whole exchange, capped read, and returns only the status code, latency and the version field of the family's /api/v1/health JSON. Every probe is audited.

Stack

FastAPI + SQLAlchemy 2 + Alembic + PostgreSQL 16, Argon2id password hashing, server-side cookie sessions, an append-only audit log enforced by database grants, RFC 9457 Problem Details errors, opt-in OpenTelemetry, and a no-build vanilla-JS console (Open Color palette, Tabler icons, light/dark theme, two languages). Shipped with Docker Compose, no reverse proxy: the backend is its own edge. Apache-2.0, and CI refuses any GPL/AGPL/SSPL dependency in Atrium itself. The deploy kit can also run Compass, whose analysis engine is AGPL-3.0 in a separate process — see CREDITS.md.

dredd-core

Identity and sessions, authentication, the access-control resolver, the org tree, the audit writer, the security primitives, the shared enums and error types, and the engine/session factories all come from one installed package. backend/requirements.txt pins it by tag:

dredd-core @ git+https://github.com/Alpaq92/dredd-core@v0.21.0

The app-side files that used to hold that code (services/auth.py, services/authz.py, models/__init__.py, security.py, errors.py, …) are now thin shims: they re-export from dredd_core so every call site keeps its import path, and they hold only what is genuinely this app's — the atrium_pat_ token prefix, the atrium_session cookie, the settings fed into core's auth policy. Fixing shared behaviour means changing dredd-core, tagging a release and moving the pin here — never patching a shim.

dredd-core ships models, not migrations: importing it registers its tables on the shared metadata, and this repo owns its own 0001 (native enum types are created first, then create_all). A core upgrade that changes the schema needs a new revision here.

It is a private repository. Local installs use your own GitHub credentials; CI authenticates with a DREDD_CORE_TOKEN repository secret (a fine-grained PAT with read access to Alpaq92/dredd-core), which the workflow injects before pip install. Without it, the install step fails with an authentication error.

Atrium shares that code with its siblings, and — where the platform is switched on — one identity store with them too. What stays separate is the domain data: locally each app has its own database, and in the family's shared managed database its own schema and its own least-privilege roles, which no other app's role can read. Database isolation is unchanged by single sign-on. Exactly three tables are shared — app_user, session and module_permission, which is dredd_core.identity.SHARED_IDENTITY_TABLES — they live in a neutral schema rather than Atrium's (so a module's USAGE opens onto a list a person can read, not onto the whole marketplace), and they are the hub's to write. Everything else, app_setting and audit_log included, stays per app: a module's settings and its evidence trail remain its own.

Quick start

cp .env.example .env          # then set the three DB passwords
DREDD_CORE_TOKEN=github_pat_... docker compose up -d --build  # postgres -> migrate(+seed) -> backend on :80

Building the image needs DREDD_CORE_TOKEN (a read-only fine-grained PAT for Alpaq92/dredd-core) in your shell — compose hands it to the build as a BuildKit secret, so it never lands in an image layer. Don't put it in .env: every container loads that file at runtime. CI's compose-smoke job runs exactly this stack on every push.

Open http://localhost (it redirects to /atrium/) and sign in with BOOTSTRAP_ADMIN_EMAIL / BOOTSTRAP_ADMIN_PASSWORD.

Windows: write .env without a BOM — [System.IO.File]::WriteAllText("$PWD\.env", (Get-Content .env.example -Raw)). PowerShell's Out-File -Encoding utf8 adds one, and pydantic-settings folds it into the first key name, which produces a baffling "field required" error at startup.

Development

cd backend
python -m venv .venv && . .venv/Scripts/activate   # or: source .venv/bin/activate
pip install -r requirements-dev.txt      # pulls dredd-core from GitHub — needs repo access

pytest                                  # DB-free unit tests
alembic upgrade head --sql              # inspect the DDL without a database
python scripts/license_gate.py          # no GPL/AGPL/SSPL
python scripts/deploy_check.py          # stack-definition coherence
node --check ../frontend/app.js         # the console has no build step, so this is the check

The API is served under /api/v1, with OpenAPI docs at /api/v1/docs — relative to wherever the app is mounted. The image runs the front door (backend/app/frontdoor.py, uvicorn app.frontdoor:outer), standalone and on the platform alike: / redirects to /atrium/, Atrium itself is mounted at /atrium (so the API is /atrium/api/v1), and on the platform every other module path (/galena, /sygna, /counsel, /compass, /insider) is streamed to that module's backend from the fixed FRONTDOOR_UPSTREAMS map. Standalone that map is empty and those paths answer 404. The front door refuses encoded separators and dot segments, replaces any inbound X-Forwarded-*, caps uploads at 100 MB and answers 502/504 as Problem Details. ROOT_PATH must be empty or /atrium: the mount sets the prefix in-process. uvicorn app.main:app alone (dev) serves Atrium at the root. The console needs nothing either way: its assets are document-relative and it derives its API base from document.baseURI.

Deploying on a managed PostgreSQL provider

The family can share one managed database — one PostgreSQL 17 database on a managed provider — with Atrium as the hub and Galena, Sygna and Counsel Scorecard as its modules. The provider hosts only the database: the backend still runs on your server with the same Compose stack, plus an override:

DREDD_CORE_TOKEN=github_pat_...   docker compose -f docker-compose.yml -f docker-compose.managed-db.yml up -d --build
  • Atrium's own schema, atrium, owned by atrium_migrator; the backend logs in only as atrium_app (DB_APP_ROLE=atrium_app). Role names carry the app because they are cluster-wide.
  • Provisioning is dredd-core's routine: python -m dredd_core.managed provision from a shell, or the rendered db/managed/provision.sql in the provider's SQL editor.
  • Connections use session-mode pooling on port 5432 (the user is <role>.<tenant> where the provider's pooler needs the tenant in the user name) with ?sslmode=verify-full&sslrootcert=/run/certs/db-ca.crt — the provider's root CA, which the override mounts from MANAGED_DB_CA_FILE. Every engine is built by make_engine, which verifies TLS, and Settings refuse any database host that is not local (localhost, postgres, a DB_LOCAL_HOSTS entry) without verify-full. DB_POOL_SIZE / DB_MAX_OVERFLOW size the pool, because four apps share the database's connection limit.
  • Verify with python -m dredd_core.managed check --expect-schema atrium --app-role atrium_app --migrator-role atrium_migrator --require-tls — schema, owners, append-only audit, isolation from the other apps' schemas, and nothing for the provider's API roles. Through a pooler, --require-tls can fail on the pooler's own link to Postgres; the runbook's section 4 says how to read that.

Runbook: db/managed/README.md — the project-wide steps for any provider (the root CA, keeping the schemas out of an auto-generated API, SSL enforcement and network restrictions, connections, backups and restore) and Atrium's part (provisioning, .env, migrate, check, restore specifics). The family deploy kit in deploy/ runs all four apps on one server, with its own Postgres or a managed one, as one platform with one account by default. python backend/scripts/deploy_check.py checks the .env before you start.

Security model

Two Postgres roles do the heavy lifting. migrator owns DDL and is used only by Alembic; app is the runtime role and holds DML only. The migration then revokes UPDATE/DELETE on audit_log from app, which is what makes the audit log evidence rather than a convenience: a compromised application cannot rewrite its own history, because the database will not let it.

Only the backend is published to the host (:80) — Postgres is expose-only. There is no reverse proxy in front, so uvicorn trusts no forwarded header (--no-proxy-headers): the peer address is the client, and that is what the audit log records. HTTPS is your own terminator in front for now.

Writes that ride on the ambient cookie must be same-origin (deps.refuse_cross_site_write, one app-wide dependency). Note what that does and does not mean once the family shares an origin: a page at /galena is same-origin with /atrium, so both of the guard's signals pass and it no longer separates modules — it still blocks genuinely foreign sites, and what keeps one console's script out of another module's API is each module's own Content-Security-Policy. Which is also why CORS_ALLOW_ORIGINS stays empty: a listed origin is trusted outright and bypasses both signals.

Access control lives in exactly one module, dredd_core.authz, re-exported as backend/app/services/authz.py. No access returns 404, not 403: a 403 confirms that the record the caller may not see exists. A module switched off is a 404 to everyone but administrators for the same reason.

Module addresses reach an href, so they are checked three times: the service accepts only http(s) without credentials in the authority, a database CHECK refuses anything else, and the console renders only http(s) links.

Project layout

Path What
backend/app/models/ marketplace (module, module_assignment, access_request); core's are re-exported
backend/app/services/ every domain rule and all SQL; auth/authz/audit are core shims
backend/app/routers/ HTTP shape, validation, authz calls — no SQL
backend/app/integrations/ outbound HTTP — the module health probe (stdlib http.client)
backend/alembic/ 0001 enum types → create_all → grants; 0002 the marketplace (idempotent); 0003 runtime grants for DB_APP_ROLE (fails loudly)
backend/scripts/ license gate, deploy pre-flight
frontend/ the console: index.html + app.css + app.js, no bundler
db/init/ least-privilege role creation, run once by Postgres
db/managed/ a managed PostgreSQL provider: the rendered provision.sql and the runbook
docker-compose.managed-db.yml the Compose override for a managed database

License

Apache-2.0. See CREDITS.md for dependencies and design credits.

S
Description
No description provided
Readme
3.5 MiB
Languages
Python 61.2%
JavaScript 25.8%
Shell 8.4%
CSS 3.3%
PLpgSQL 0.9%
Other 0.4%