Skip to content

[Auth] Add app keys to act on behalf of users - #313

Merged
tchapi merged 9 commits into
mainfrom
app-keys
Oct 24, 2026
Merged

tchapi merged 9 commits into
mainfrom
app-keys

Conversation

@tchapi

@tchapi tchapi commented Oct 23, 2026

Copy link
Copy Markdown
Owner

A service that already authenticated the user elsewhere (SSO in front of a webmail, a scheduler like cal.com) should not have to hold the user's password to read and write their calendars and address books. An admin now creates an app key (dashboard or davis:app-key:create), scoped to some users or all of them, and the service logs in over Basic as <login>*<app_id> with the key's secret — Dovecot style, because DAV clients only speak Basic.

Handled in AbstractAuth above the Basic, IMAP and LDAP backends, so it works with every AUTH_METHOD. The key path never reaches the backend: a wrong secret is refused outright, and a *suffix that is not an app id is passed to the backend as is. No auto-creation on this path. Secrets are shown once and stored hashed; keys can be revoked or given an expiry.

Related: #183 (admin-defined keys, not user self-service)

tchapi pushed a commit to tchapi/postel that referenced this pull request Oct 23, 2026
The backend logs into Davis as "<login>*<app id>" with the key's secret
(tchapi/davis#313), like the Dovecot master user, and keeps a copy of the
address books in SQLite. Autocomplete reads that copy: a CardDAV request
costs ~170 ms on Davis.

- the first search fills the cache, then at most every five minutes and
  after the response, one PROPFIND compares the sync tokens and a changed
  book is fetched again whole
- a book is fetched before anything is dropped, and Davis being away or the
  key refused leaves the cache as it was
- matching ignores case and accents, a word starting with the query ranks
  first
- no Davis configured means no suggestions, nothing else changes

The dev Davis runs the app keys branch until it is released, see
dev/davis/compose.yaml.
@tchapi tchapi self-assigned this Oct 24, 2026
@tchapi tchapi added the enhancement New feature or request label Oct 24, 2026
@tchapi
tchapi enabled auto-merge (squash) October 24, 2026 15:39
@tchapi
tchapi merged commit 4e1675b into main Oct 24, 2026
19 checks passed
@tchapi
tchapi deleted the app-keys branch October 24, 2026 15:49
tchapi pushed a commit to tchapi/postel that referenced this pull request Oct 24, 2026
The backend logs into Davis as "<login>*<app id>" with the key's secret
(tchapi/davis#313), like the Dovecot master user, and keeps a copy of the
address books in SQLite. Autocomplete reads that copy: a CardDAV request
costs ~170 ms on Davis.

- the first search fills the cache, then at most every five minutes and
  after the response, one PROPFIND compares the sync tokens and a changed
  book is fetched again whole
- a book is fetched before anything is dropped, and Davis being away or the
  key refused leaves the cache as it was
- matching ignores case and accents, a word starting with the query ranks
  first
- no Davis configured means no suggestions, nothing else changes

The dev Davis runs the app keys branch until it is released, see
dev/davis/compose.yaml.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant