sso: Listmonk and Gramps Web send no PKCE and kanidm enforces it — newsletters and whakapapa sign-in will be refused; ruling needed on relaxing ADR 0196 for two clients #1601

Closed
opened 2026-09-18 19:32:01 +00:00 by ben · 2 comments
Owner

What is wrong

kanidm creates every OAuth2 client in enforced-PKCE mode. Two of the apps spec #1535 put on kanidm OIDC send no PKCE, and neither has a switch to turn it on:

Service App Evidence, read off run 15's kept box (20260918T183606Z)
newsletters Listmonk 6.1.0 the binary carries zero code_challenge_method / code_verifier strings; v6 source builds the URL with cfg.AuthCodeURL(state, oidc.Nonce(nonce)) and exchanges with cfg.Exchange(ctx, code)
whakapapa Gramps Web API 3.13.1 gramps_webapi/auth/oidc.py:394 registers the provider with client_kwargs = {"scope": ...} only

So kanidm will refuse both at the authorize step, exactly as it refused Paperless in run 15: No PKCE code challenge was provided with client in enforced PKCE mode -> invalid_request, and the person sees kanidm's error page. Paperless had a switch (oauth_pkce_enabled, landed e74b1cbb). These two do not. #1539 and #1541 proved the render's commands, never a sign-in (GOTCHAS #252). The door legs have not reached either app's kanidm hop yet (run 15 stopped earlier on harness faults, fixed in e74b1cbb); the next fire will show the refusal live.

Why human

Security posture. ADR 0196: "PKCE S256 required for every client". Every way forward either relaxes that for two clients or takes on a maintenance burden.

Options

kanidm system oauth2 warning-insecure-client-disable-pkce <client> in the newsletters and whakapapa OIDC oneshots.

  • Both are confidential clients: the code is exchanged with a client secret that never leaves the gateway, so an intercepted code is useless without it. That interception is the attack PKCE exists for, and it chiefly threatens public clients.
  • What is given up: PKCE's defence against authorization-code injection (an attacker feeding their own code into a victim's browser session). Both apps carry state; Listmonk also a nonce.
  • Both apps sit behind the community front door, so only a signed-in community member reaches either login at all.
  • Cost: an ADR amending 0196 (per-client exception, named apps, the reason), two render lines, and a test that no OTHER client carries the exception.
  • Small, reversible: drop the line when upstream ships PKCE.

2. Carry a patch for each app

Gramps Web: one line (code_challenge_method: S256 in client_kwargs; authlib keeps the verifier in the session) - but it ships as an upstream container image, so a patch means building and hosting our own image. Listmonk: ~15 lines (store the verifier beside the state cookie, pass it at exchange) as a Nix package override. Keeps ADR 0196 whole; costs a fork of two upstream apps to maintain on every bump, and an upstream PR each.

3. Take both apps off OIDC

Neither supports header-trust auth, so this means the own posture (the app's own login, no community role reaches inside) - which reverses the #1535 ruling for two of the seven services.

Acceptance

  • Ruling recorded (an ADR amending 0196 if option 1).
  • On a roles-proof drive, operator-newsletters, member-newsletters, operator-whakapapa and member-whakapapa are green.
## What is wrong kanidm creates every OAuth2 client in **enforced-PKCE mode**. Two of the apps spec #1535 put on kanidm OIDC send no PKCE, and neither has a switch to turn it on: | Service | App | Evidence, read off run 15's kept box (`20260918T183606Z`) | |---|---|---| | newsletters | Listmonk 6.1.0 | the binary carries zero `code_challenge_method` / `code_verifier` strings; v6 source builds the URL with `cfg.AuthCodeURL(state, oidc.Nonce(nonce))` and exchanges with `cfg.Exchange(ctx, code)` | | whakapapa | Gramps Web API 3.13.1 | `gramps_webapi/auth/oidc.py:394` registers the provider with `client_kwargs = {"scope": ...}` only | So kanidm will refuse both at the authorize step, exactly as it refused Paperless in run 15: `No PKCE code challenge was provided with client in enforced PKCE mode` -> `invalid_request`, and the person sees kanidm's error page. Paperless had a switch (`oauth_pkce_enabled`, landed `e74b1cbb`). These two do not. #1539 and #1541 proved the render's commands, never a sign-in (GOTCHAS #252). The door legs have not reached either app's kanidm hop yet (run 15 stopped earlier on harness faults, fixed in `e74b1cbb`); the next fire will show the refusal live. ## Why human **Security posture.** ADR 0196: "PKCE S256 required for every client". Every way forward either relaxes that for two clients or takes on a maintenance burden. ## Options ### 1. Disable PKCE enforcement on those two kanidm clients (recommended) `kanidm system oauth2 warning-insecure-client-disable-pkce <client>` in the newsletters and whakapapa OIDC oneshots. - Both are **confidential** clients: the code is exchanged with a client secret that never leaves the gateway, so an intercepted code is useless without it. That interception is the attack PKCE exists for, and it chiefly threatens public clients. - What is given up: PKCE's defence against authorization-code **injection** (an attacker feeding their own code into a victim's browser session). Both apps carry `state`; Listmonk also a `nonce`. - Both apps sit behind the community front door, so only a signed-in community member reaches either login at all. - Cost: an ADR amending 0196 (per-client exception, named apps, the reason), two render lines, and a test that no OTHER client carries the exception. - Small, reversible: drop the line when upstream ships PKCE. ### 2. Carry a patch for each app Gramps Web: one line (`code_challenge_method: S256` in `client_kwargs`; authlib keeps the verifier in the session) - but it ships as an upstream container image, so a patch means building and hosting our own image. Listmonk: ~15 lines (store the verifier beside the state cookie, pass it at exchange) as a Nix package override. Keeps ADR 0196 whole; costs a fork of two upstream apps to maintain on every bump, and an upstream PR each. ### 3. Take both apps off OIDC Neither supports header-trust auth, so this means the `own` posture (the app's own login, no community role reaches inside) - which reverses the #1535 ruling for two of the seven services. ## Acceptance - [ ] Ruling recorded (an ADR amending 0196 if option 1). - [ ] On a roles-proof drive, `operator-newsletters`, `member-newsletters`, `operator-whakapapa` and `member-whakapapa` are green.
Author
Owner

Confirmed live (run 15's healer, re-walking newsletters on the still-up box): 441911f0-7e60-44e3-86c7-6d1a542f4568 ERROR … No PKCE code challenge was provided with client in enforced PKCE mode | o2rs.name: "newsletters". Whakapapa had a second, mechanical fault in front of this one (the callback route, #1603, landed 85aa9b92); past it, it meets the same wall. Run 16 is firing without this ruling so archive, surveys and document-archive can be proven meanwhile — expect *-newsletters and *-whakapapa red on PKCE alone.

**Confirmed live** (run 15's healer, re-walking newsletters on the still-up box): `441911f0-7e60-44e3-86c7-6d1a542f4568 ERROR … No PKCE code challenge was provided with client in enforced PKCE mode | o2rs.name: "newsletters"`. Whakapapa had a second, mechanical fault in front of this one (the callback route, #1603, landed `85aa9b92`); past it, it meets the same wall. Run 16 is firing without this ruling so archive, surveys and document-archive can be proven meanwhile — expect `*-newsletters` and `*-whakapapa` red on PKCE alone.
Author
Owner

Ruled by Ben, 2026-09-18, in session: option 1. Recorded as ADR 0254 (amending ADR 0196) and landed on main as c0c8d550: internal/clan/pkceexception.go holds the two slugs and the one place the kanidm command is written; it panics for any other slug, and tests hold the list, the two call sites and both renders. The IDIP bridge is unchanged and not covered — a separate ruling before either app is offered on an IDIP community. Live proof is the #1547 door legs operator|member-newsletters and -whakapapa. Closing.

**Ruled by Ben, 2026-09-18, in session: option 1.** Recorded as ADR 0254 (amending ADR 0196) and landed on main as `c0c8d550`: `internal/clan/pkceexception.go` holds the two slugs and the one place the kanidm command is written; it panics for any other slug, and tests hold the list, the two call sites and both renders. The IDIP bridge is unchanged and not covered — a separate ruling before either app is offered on an IDIP community. Live proof is the #1547 door legs `operator|member-newsletters` and `-whakapapa`. Closing.
ben 2026-09-18 20:29:23 +00:00
Sign in to join this conversation.
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
Matou/idss#1601
No description provided.