A connected service may take its course claims from another service's links (D604) #741

Merged
oliver.maklott merged 1 commit from oidc-client-links-from into main 2026-11-20 21:58:28 +01:00

Why

Limedoc's new Sites pack protects course-only websites with a gate (limedoc-sites-gate), which signs in to Aivopod as its own confidential client. Course and workspace claims are only issued for courses linked to the requesting client (course_links.client_id, ADR 0002 §5), so the gate only ever received the school claim and a site restricted to a course admitted nobody.

What

  • Migration 0121: oidc_clients.links_from (FK to oidc_clients, ON DELETE SET NULL DEFERRABLE, check <> client_id). op_claims_person, op_claims_person_workspaces, op_claims_teacher, op_claims_teacher_workspaces join the links on coalesce(links_from, client_id). Schools, the gate claim aivopod:<client>, superadmins, pseudonymous sub, events and logouts stay the client's own.
  • ops: idp-client-add … --links-from <id>; new idp-client-links-from --id <id> [--links-from <id>] (without the option: back to its own links). One step only (ops:idp.links-from-chain), never itself (ops:idp.links-from-self), unknown source → ops:idp.not-found. remove of a source is refused while a client takes its links (ops:idp.remove-links-source), also with --force. Audited (op.client.links-from); show/list return linksFrom.
  • Archive format 69: the column is deferred (the source may come later); TableFormat.key names the key for deferred updates (client_id here, default id). Upgrade 68 → 69 adds links_from: null.
  • schema.sql, types.ts regenerated; German ops messages; docs: D604, betrieb.md, SPEC, ADR 0002.

Tests

op/claims.test.ts (gate with links_from gets course, team and workspace claims via the source's links, never for a school it doesn't serve; without it only the school claim; self-reference rejected; source deleted → null), ops/idp.test.ts (add/set/clear, show, chain, self, unknown, audit; remove refused then allowed), instance/upgrade.test.ts (68 → 69), full-instance round trip with a gate client sorting before its source. Locally: full @aivopod/api suite 1721 passed, i18n/shared, lint, typecheck, prettier.

apcmd passthrough (idp client add --links-from, idp client links-from set) follows as a separate PR in aivopod/apcmd.

🤖 Generated with Claude Code

https://claude.ai/code/session_01PVUe4eShm8JT4LPt8MJdXT

## Why Limedoc's new **Sites** pack protects course-only websites with a gate (`limedoc-sites-gate`), which signs in to Aivopod as its **own** confidential client. Course and workspace claims are only issued for courses linked to the requesting client (`course_links.client_id`, ADR 0002 §5), so the gate only ever received the school claim and a site restricted to a course admitted nobody. ## What - **Migration 0121:** `oidc_clients.links_from` (FK to `oidc_clients`, `ON DELETE SET NULL DEFERRABLE`, check `<> client_id`). `op_claims_person`, `op_claims_person_workspaces`, `op_claims_teacher`, `op_claims_teacher_workspaces` join the links on `coalesce(links_from, client_id)`. Schools, the gate claim `aivopod:<client>`, superadmins, pseudonymous `sub`, events and logouts stay the client's own. - **ops:** `idp-client-add … --links-from <id>`; new `idp-client-links-from --id <id> [--links-from <id>]` (without the option: back to its own links). One step only (`ops:idp.links-from-chain`), never itself (`ops:idp.links-from-self`), unknown source → `ops:idp.not-found`. `remove` of a source is refused while a client takes its links (`ops:idp.remove-links-source`), also with `--force`. Audited (`op.client.links-from`); `show`/`list` return `linksFrom`. - **Archive format 69:** the column is deferred (the source may come later); `TableFormat.key` names the key for deferred updates (`client_id` here, default `id`). Upgrade 68 → 69 adds `links_from: null`. - `schema.sql`, `types.ts` regenerated; German ops messages; docs: D604, `betrieb.md`, SPEC, ADR 0002. ## Tests `op/claims.test.ts` (gate with `links_from` gets course, team and workspace claims via the source's links, never for a school it doesn't serve; without it only the school claim; self-reference rejected; source deleted → null), `ops/idp.test.ts` (add/set/clear, show, chain, self, unknown, audit; remove refused then allowed), `instance/upgrade.test.ts` (68 → 69), full-instance round trip with a gate client sorting before its source. Locally: full `@aivopod/api` suite 1721 passed, i18n/shared, lint, typecheck, prettier. `apcmd` passthrough (`idp client add --links-from`, `idp client links-from set`) follows as a separate PR in `aivopod/apcmd`. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01PVUe4eShm8JT4LPt8MJdXT
A connected service may take its course and workspace claims from another service's links (D604)
All checks were successful
check / check (pull_request) Successful in 20m59s
e2e / e2e (pull_request) Successful in 25m22s
062a5c4dda
oidc_clients.links_from (migration 0121): the four op_claims_* functions join
course_links and workspace_links on coalesce(links_from, client_id). Schools,
gate claim, superadmins, events and logouts stay the client's own. One step
only; never itself; removing a source is refused while a client names it.
ops: idp-client-add --links-from, idp-client-links-from. Archive format 69
(deferred column set by client_id).

For the Limedoc Sites gate, a separate confidential client that must admit
the students of courses linked to Limedoc.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PVUe4eShm8JT4LPt8MJdXT
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
aivopod/aivopod-app!741
No description provided.