Fixes from the Leantime rehearsal: unhealthy apps, signin links and errors

Deploy now waits while an image's own HEALTHCHECK says "starting" and
stops on "unhealthy" with the check and its result, since traefik doesn't
route unhealthy containers (it used to say "Updated"); an update rolls
back, a first install says it stays installed, and a rollback waits until
the old version is routed again. coreapp signin follows a page's one
"Core SSO" or "Authelia" link, prints the app's visible error when it
doesn't end signed in, and has --help. The skill covers 127.0.0.1 among
trusted proxies, the image's HEALTHCHECK, COPY --chmod, $TMPDIR outside
the sandbox, patching an app's OIDC code for userinfo claims, and testing
a new account's first sign-in. PLAN: ID-token claims for Federated.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-12-04 11:33:52 -07:00
co-authored by Claude Opus 5.5
parent cbdf0e5789
commit f4b869decd
8 changed files with 261 additions and 22 deletions
+11 -1
View File
@@ -12,7 +12,11 @@ SKILL.md), and make the Dockerfile fit the Core:
`X-Forwarded-Proto: https` and `X-Forwarded-For`: set the app's "trusted
proxies" to `CORE_PROXY` (so it logs and rate-limits by the real client
address), and turn on its "behind HTTPS" or secure-cookie setting if it
has one, since it sees plain HTTP itself.
has one, since it sees plain HTTP itself. If that setting also refuses
requests from other addresses, add `127.0.0.1`: an image's own
`HEALTHCHECK` runs inside the container, and while Docker calls the
container unhealthy, traefik doesn't route to it (deploy stops and says
so).
- **Keep state in `/data`**: point upload folders, SQLite files and
generated keys there. If the app needs a directory structure under `/data`,
create it at startup (it starts empty).
@@ -71,6 +75,12 @@ SKILL.md), and make the Dockerfile fit the Core:
(end it with `exec` and the upstream entrypoint; call tools as
`/bin/busybox mkdir ...`). Prefer this to a program of your own.
- **Check the image's own `HEALTHCHECK`** (`docker inspect -f
'{{json .Config.Healthcheck}}' <image>`): it decides whether traefik
routes to the app, so it has to pass with the app's Core settings.
- **`COPY --chmod`** into a folder that doesn't exist yet makes that folder
with the same mode, so a `0644` file gets an unreadable parent folder:
copy into an existing folder, or `RUN chmod` afterwards.
- **Run as a non-root user** if the image allows. `/data` is given to
whatever user the image runs as, so this is enough:
+19 -4
View File
@@ -58,7 +58,14 @@ standard-library Python example of the whole flow (`oidc.py`).
(the account's uid, e.g. `coreapp.test`), `preferred_username` (the
email address, which is what people sign in with), `groups`. The ID token
has none of them, so an app that reads the person only from the ID token
gets no email or name: turn on its "use userinfo" setting.
gets no email or name: turn on its "use userinfo" setting. Requesting
fewer scopes doesn't help (without `openid`, userinfo answers 403). If
the app has no such setting, a small patch to its OIDC code that fills
missing claims from userinfo (when its `sub` matches the ID token's) is
fine: keep it as a patch file applied in the Dockerfile, say why in a
comment, and name it in your report, since it's the app's own code. (The
Core could put these claims in the ID token; that's Federated's to
change.)
- `groups` is `null` on today's Cores, not a list: they have two groups,
`admins` and `everybody`, but Authelia's settings don't find them yet
(for Federated to fix). Don't turn on an app's group-to-role mapping:
@@ -119,6 +126,7 @@ says whether it got back to the app signed in. Run it in the app's folder
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 /auth/login # or whose "Sign in with Core SSO" link starts it: followed
jar=$(mktemp) && coreapp signin --cookies "$jar" /login && curl -b "$jar" https://<name>.<domain>/api/me
```
@@ -126,14 +134,21 @@ jar=$(mktemp) && coreapp signin --cookies "$jar" /login && curl -b "$jar" https:
CSRF token) is submitted as a person pressing it would. Forms with fields
to fill (a password form beside the button) are ignored, so a page with
one button and a password form needs nothing more; only with several
buttons, pick one with `--form <action>`. Don't add routes to the app just
for the test.
buttons, pick one with `--form <action>`. Without such a form, its one
link whose text names Core SSO or Authelia is followed. Don't add routes
to the app just for the test.
- With `--cookies`, check what the test account may do: it should land as
a read-only member. Keep the jar's path in one command, as above
(`$TMPDIR` can differ between a sandboxed shell and `coreapp`'s).
- "Signed in" needs the app to have kept the person: if its page offers
sign-in again (its callback failed quietly), `coreapp signin` says "Not
signed in ... offers sign-in again"; `coreapp logs` has the app's reason.
signed in ... offers sign-in again", with the error or notice the app's
page shows; `coreapp logs` may have more.
- Test a brand-new account's first sign-in too, not only the second: apps
often do extra work for a new person (a sample project, onboarding) that
a read-only role isn't allowed. The test account stays in the app after
its first sign-in, so to repeat it, delete its user in the app (as the
app's admin, or in its database with `coreapp shell`) and sign in again.
- 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,