Cairn as an OCM token server: exchange a share's secret for a short-lived access token (#1070 follow-up) #1089

Open
opened 2026-11-03 05:32:40 +00:00 by Cordy · 0 comments
Owner

Problem. Since #1070 (v0.6.393), Nextcloud and ownCloud are expected to read Cairn's federated shares with Basic auth, using the share's secret as the user name, on every request. Front proxies can log that user name. The OCM draft lets the receiver exchange the secret once for a short-lived Bearer token. Nextcloud 35+ does this whenever the sender advertises it; Cairn does not.

Today.

  • Discovery has no exchange-token and no tokenEndPoint.
  • The grant surface accepts only the secret (grantaccess1070.go).
  • Every Basic read is noted once a day per share and instance: INFO ocm: share read with the deprecated Basic form. That line measures how many shares still use Basic.
  • Cairn as a receiver already exchanges tokens (client.go exchangeToken).

Proposal.

  • Advertise exchange-token and tokenEndPoint (/ocm/token).
  • POST /ocm/token: verify the RFC 9421 signature, and require the signer to be the share's own server. Answer {access_token, token_type: Bearer, expires_in}, with errors per draft-07 §10 and no refresh token.
  • Tokens:
    • live 5 to 60 minutes;
    • are bound to one share, its subtree and its permissions;
    • work only on /dav/ocm/;
    • die when the share ends or pauses.
  • A token request goes through the same gates as the secret.
  • Tokens must verify on every instance (#742).
  • Never send must-exchange-token; keep Basic for old-form shares.

Acceptance.

  • Nextcloud 35 reads a share with Bearer after one exchange.
  • Unsigned or other-server exchanges are refused.
  • An ended or paused share's token stops at once.
  • A token for share A does not read share B.
  • Tokens and secrets are never logged.

Refs: #1070, research-1070.md §1.1, §2, §3, §6.1.10 (a).

**Problem.** Since #1070 (v0.6.393), Nextcloud and ownCloud are expected to read Cairn's federated shares with Basic auth, using the share's secret as the user name, on every request. Front proxies can log that user name. The OCM draft lets the receiver exchange the secret once for a short-lived Bearer token. Nextcloud 35+ does this whenever the sender advertises it; Cairn does not. **Today.** - Discovery has no `exchange-token` and no `tokenEndPoint`. - The grant surface accepts only the secret (`grantaccess1070.go`). - Every Basic read is noted once a day per share and instance: INFO `ocm: share read with the deprecated Basic form`. That line measures how many shares still use Basic. - Cairn as a receiver already exchanges tokens (`client.go` `exchangeToken`). **Proposal.** - Advertise `exchange-token` and `tokenEndPoint` (`/ocm/token`). - `POST /ocm/token`: verify the RFC 9421 signature, and require the signer to be the share's own server. Answer `{access_token, token_type: Bearer, expires_in}`, with errors per draft-07 §10 and no refresh token. - Tokens: - live 5 to 60 minutes; - are bound to one share, its subtree and its permissions; - work only on `/dav/ocm/`; - die when the share ends or pauses. - A token request goes through the same gates as the secret. - Tokens must verify on every instance (#742). - Never send `must-exchange-token`; keep Basic for old-form shares. **Acceptance.** - Nextcloud 35 reads a share with Bearer after one exchange. - Unsigned or other-server exchanges are refused. - An ended or paused share's token stops at once. - A token for share A does not read share B. - Tokens and secrets are never logged. Refs: #1070, research-1070.md §1.1, §2, §3, §6.1.10 (a).
Sign in to join this conversation.
No labels
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: Cordy/Cairn#1089
No description provided.