--- status: proposed date: 2026-11-28 ---
ADR 0024: KVT fork, Business Central cards through sleutels.kvt.nl
This record belongs to the KVT fork (KVT-FORK.md), not to upstream.
Context
KVT colleagues paste Business Central links (projects, work orders, contracts, customers, components, items) into chats. Those links open the BC web client and show nothing in the chat itself. Mímir on sleutels.kvt.nl already reads BC with the reader's own rights. The app needs a personal credential for Mímir that is not the Teams or Graph token.
Options for the credential were: reuse the Teams/Graph token (wrong audience, and it would hand a Microsoft token to a KVT server), a shared API key (no per-user rights), or a personal app token from the shared KVT Login through a browser flow.
Options for where that browser flow runs were: the system browser (a second Microsoft sign-in) or the app's own session browser, which is already signed in to Microsoft (ADR 0003).
Options for the message format were: an own card format, or a plain link with readable text.
Decision
- The Login issues a personal, revocable app token (
sat_…, 90 days, scopesmimir.cards asclepius ponos daedalus) through RFC 8252: PKCE S256, a loopback redirect to127.0.0.1, a one-time code. The token sits in the OS keyring (servicerusty-teams.kvt-sleutels), never in SQLite or logs. - Connecting runs in a background tab of the session browser on Linux and macOS. The Login's Entra SSO then passes without asking. The app clicks «Koppelen» on the Login consent page, because the user already pressed «Connect» in Settings. When the page needs the user (account picker, MFA, password) or stalls, the app closes the tab and opens the same link in the system browser. Windows uses the system browser until the WebView2 host can open a plain tab.
- No Teams or Graph token goes to the Login or Mímir.
- A message keeps a plain HTML link with readable text (
Werkorder WO… - description). Official Teams shows a normal link; Rusty Teams shows up to three cards under the text. Details load only when the card is opened, with the reader's own token.
Consequences
- Others see nothing unusual (GUARDRAILS: no own message formats).
- While the background tab passes
login.microsoftonline.com, the session browser briefly reports a login page. The tab is closed after eight seconds on a Microsoft page, so a stuck sign-in cannot keep the Teams login window logic busy. - Chrome strings are English and German (ADR 0008); field labels and values come from Mímir in Dutch.
- A token stays valid until it expires or is revoked (Settings > Disconnect, or «Gekoppelde apps» on the Login). Nothing revokes it automatically when someone leaves.
Addendum: Asclepius, Ponos and Daedalus (same release)
- The same app token also serves Ponos (scope
ponos) and Daedalus (scopedaedalus). Ponos accepts asat_…bearer only for a fixed list of task actions (navigation, list, get, create, status, complete, message), so a stolen token cannot mint API keys or change groups. - «Create Asclepius ticket» needs no token: it opens the existing new-ticket form with
new_titleandnew_descriptionprefilled. The user picks the category and saves in Asclepius, so nothing is filed without them seeing it. - «Create Ponos task» and «My tasks» call Ponos directly; the dialog lists only groups where the user may create tasks.
- The Daedalus planning is a read-only calendar source (
CalendarSource::Ics, calendar «Daedalus»), so the calendar offers no RSVP or delete for it. Daedalus had no ICS subscription to reuse, so a small JSON endpoint was added; itsformat=icsoutput also needs the bearer header, which plain calendar apps cannot send. The endpoint shows only the user's own work orders, without memos or materials. When BC fails, the planning is empty rather than an error. It is on by default and can be turned off in Settings. - The Asclepius embed view and a virtual Asclepius team are not part of this release.
Source
| 1 | --- |
| 2 | status: proposed |
| 3 | date: 2026-11-28 |
| 4 | --- |
| 5 | |
| 6 | # ADR 0024: KVT fork, Business Central cards through sleutels.kvt.nl |
| 7 | |
| 8 | This record belongs to the KVT fork (`KVT-FORK.md`), not to upstream. |
| 9 | |
| 10 | ## Context |
| 11 | |
| 12 | KVT colleagues paste Business Central links (projects, work orders, contracts, customers, components, items) into chats. Those links open the BC web client and show nothing in the chat itself. Mímir on sleutels.kvt.nl already reads BC with the reader's own rights. The app needs a personal credential for Mímir that is not the Teams or Graph token. |
| 13 | |
| 14 | Options for the credential were: reuse the Teams/Graph token (wrong audience, and it would hand a Microsoft token to a KVT server), a shared API key (no per-user rights), or a personal app token from the shared KVT Login through a browser flow. |
| 15 | |
| 16 | Options for where that browser flow runs were: the system browser (a second Microsoft sign-in) or the app's own session browser, which is already signed in to Microsoft (ADR 0003). |
| 17 | |
| 18 | Options for the message format were: an own card format, or a plain link with readable text. |
| 19 | |
| 20 | ## Decision |
| 21 | |
| 22 | - The Login issues a personal, revocable app token (`sat_…`, 90 days, scopes `mimir.cards asclepius ponos daedalus`) through RFC 8252: PKCE S256, a loopback redirect to `127.0.0.1`, a one-time code. The token sits in the OS keyring (service `rusty-teams.kvt-sleutels`), never in SQLite or logs. |
| 23 | - Connecting runs in a background tab of the session browser on Linux and macOS. The Login's Entra SSO then passes without asking. The app clicks «Koppelen» on the Login consent page, because the user already pressed «Connect» in Settings. When the page needs the user (account picker, MFA, password) or stalls, the app closes the tab and opens the same link in the system browser. Windows uses the system browser until the WebView2 host can open a plain tab. |
| 24 | - No Teams or Graph token goes to the Login or Mímir. |
| 25 | - A message keeps a plain HTML link with readable text (`Werkorder WO… - description`). Official Teams shows a normal link; Rusty Teams shows up to three cards under the text. Details load only when the card is opened, with the reader's own token. |
| 26 | |
| 27 | ## Consequences |
| 28 | |
| 29 | - Others see nothing unusual (GUARDRAILS: no own message formats). |
| 30 | - While the background tab passes `login.microsoftonline.com`, the session browser briefly reports a login page. The tab is closed after eight seconds on a Microsoft page, so a stuck sign-in cannot keep the Teams login window logic busy. |
| 31 | - Chrome strings are English and German (ADR 0008); field labels and values come from Mímir in Dutch. |
| 32 | - A token stays valid until it expires or is revoked (Settings > Disconnect, or «Gekoppelde apps» on the Login). Nothing revokes it automatically when someone leaves. |
| 33 | |
| 34 | ## Addendum: Asclepius, Ponos and Daedalus (same release) |
| 35 | |
| 36 | - The same app token also serves Ponos (scope `ponos`) and Daedalus (scope `daedalus`). Ponos accepts a `sat_…` bearer only for a fixed list of task actions (navigation, list, get, create, status, complete, message), so a stolen token cannot mint API keys or change groups. |
| 37 | - «Create Asclepius ticket» needs no token: it opens the existing new-ticket form with `new_title` and `new_description` prefilled. The user picks the category and saves in Asclepius, so nothing is filed without them seeing it. |
| 38 | - «Create Ponos task» and «My tasks» call Ponos directly; the dialog lists only groups where the user may create tasks. |
| 39 | - The Daedalus planning is a read-only calendar source (`CalendarSource::Ics`, calendar «Daedalus»), so the calendar offers no RSVP or delete for it. Daedalus had no ICS subscription to reuse, so a small JSON endpoint was added; its `format=ics` output also needs the bearer header, which plain calendar apps cannot send. The endpoint shows only the user's own work orders, without memos or materials. When BC fails, the planning is empty rather than an error. It is on by default and can be turned off in Settings. |
| 40 | - The Asclepius embed view and a virtual Asclepius team are not part of this release. |