Fixes from porting Supermarket: sign-in buttons, CORE_DOMAIN, skill gaps

An agent ported Supermarket with only the skill. coreapp signin now
presses a sign-in page's button (a form with only hidden fields; --form
picks one), every app gets CORE_DOMAIN, and the skill covers apps that
also run elsewhere, IMAGE_VERSION instead of build args, deriving keys
from APP_SECRET, the first admin, apps with their own client setup, and
that the groups claim is empty on today's Cores.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-12-03 18:22:42 -07:00
co-authored by Claude Opus 5.5
parent da767e2139
commit dcc72fe5da
7 changed files with 196 additions and 24 deletions
+35 -6
View File
@@ -52,7 +52,14 @@ What the Core gives every app:
|---|---|
| `APP_URL` | `https://<name>.<domain>`, the app's public address |
| `APP_SECRET` | 32 random letters and digits, for signing cookies, sessions |
| `IMAGE_VERSION` | The installed version |
| `IMAGE_VERSION` | The installed version (`coreapp deploy` builds with plain `docker build .`, no build args, so read the version from here, not a build-time `VERSION`) |
| `CORE_DOMAIN` | The Core's domain (`<domain>`). Set only on a Core: an app that also runs elsewhere can use it to tell |
`APP_SECRET` isn't hex or base64: an app that wants key bytes (e.g. 32
bytes for encryption) derives them, e.g. SHA-256 of `APP_SECRET`. It
never changes, and it lives only in the app's `.env` on the Core
(`/federated/apps/<name>/.env`, beside `/data`): anything encrypted with
it is unreadable without that file.
plus the ones each need adds (below).
@@ -176,8 +183,14 @@ authorize URL can't show those are right: `coreapp signin` can (see
(a few seconds of 404s from it, which an app checking discovery at startup
may log; it should retry).
- Scopes: `openid profile email groups`. Userinfo gives `sub`,
`preferred_username`, `name`, `email`, `groups` (the person's Core
groups: use them for roles, e.g. admins).
`preferred_username`, `name`, `email`, and `groups`, which is empty on
today's Cores: they have two groups, `admins` and `everybody`, but
Authelia's settings don't find them yet (for Federated to fix). Read `groups`
if the app can use it, but don't depend on it for roles.
- The app's first admin: not "whoever signs in first" (any employee could
be first). Prefer a one-time setup link or code the app prints in its log
(`coreapp logs`, or `coreapp shell '<app's command>'`), then admins it
names in its own settings. Later, the Core's `admins` group.
- Discovery: `$OIDC_ISSUER/.well-known/openid-configuration`. The Core
routes `authelia.<domain>` from inside the app's container to the real
HTTPS endpoint, with a valid certificate, so normal TLS verification works.
@@ -186,7 +199,11 @@ may log; it should retry).
Use the app's own OpenID Connect support or its framework's library where it
has one: most self-hosted apps have "generic OIDC" settings that map onto
these variables. For a standard-library Python example of the whole flow,
these variables. If the app has its own step for setting up its client (an
admin makes a secret in its settings, or pastes a client block into the
identity provider), skip it on the Core: fill its settings from `OIDC_*`,
so sign-in works with no admin step, and don't show those instructions when
the Core gave the client. For a standard-library Python example of the whole flow,
`coreapp new --sso example` makes one (`oidc.py`).
### `email`: sending mail
@@ -260,6 +277,12 @@ and make the Dockerfile fit the Core:
create it at startup (it starts empty).
- **Send mail with `needs = ["email"]`**, if the app sends any (password
resets, notifications): map `SMTP_*` onto its mail settings.
- **If the app also runs elsewhere** (a desktop or another server edition
sharing the Dockerfile), keep those working: choose the Core's behaviour
in the app when `CORE_DOMAIN` is set (the Core's variables become
defaults; the app's own explicit settings still win), not by changing
the Dockerfile's `ENV` or `ENTRYPOINT` for everyone. The Core builds the
`Dockerfile` at the repository's root.
- **Read settings from the environment**, mapping the Core's names to the
app's in an entrypoint script or config file if they differ
(`SECRET_KEY="$APP_SECRET"`, `DATABASE_URL=...`). Set the app's own
@@ -292,7 +315,7 @@ and make the Dockerfile fit the Core:
- **Give it its own `icon.png`**: the project's logo, square, as a PNG
(convert an SVG or ICO; 256x256 is good). The template's is a
placeholder. `coreapp deploy` and `publish` say if it's unusable, not
square or too small; `publish` refuses one the Core can't use.
square or under 80 pixels; `publish` refuses one the Core can't use.
- **Answer on `health`** once ready (a dedicated health endpoint, or `/` if
it returns 2xx-4xx without signing in).
- **One container.** If the upstream project ships a compose file with
@@ -335,9 +358,15 @@ whether it got back to the app signed in:
```bash
coreapp signin # starts at /login
coreapp signin /auth/login # the app's own page that starts sign-in
coreapp signin /signin # a page whose button starts sign-in: pressed
coreapp signin --cookies jar /login && curl -b jar https://<name>.<domain>/api/me
```
A page with a sign-in button (a form with only hidden fields, such as a
CSRF token) is submitted as a person pressing it would; with several such
forms, pick one with `--form <action>`. Don't add routes to the app just for
the test.
For apps whose sign-in starts in the browser's JavaScript (single-page
apps: the page builds the authorize URL itself), `coreapp signin --code`
starts at Authelia with the app's client and stops at the app's callback,
@@ -350,7 +379,7 @@ so don't loop on it.
Still ask the user to sign in once in a browser with their own account
before a release: it checks what a script can't (the app's pages, and a
person in the Core's groups).
real person's account).
### 4. When something fails