[web] The web UI: hosts, add/edit with apply progress, undo, history and restore, share links, engine switch, certificates and device installs, signing by hand, settings and tokens; smoke test counts every §4 flow's clicks
This commit is contained in:
@@ -0,0 +1,159 @@
|
||||
# Ianitor Domi web UI: open questions for Mark
|
||||
|
||||
Each has a recommendation. The UI can be built now with the recommended answer behind a typed client;
|
||||
none of these blocks the first screens (Hosts, Add host, Undo, History, Share links on, Tokens).
|
||||
Q1 and Q2 matter most.
|
||||
|
||||
---
|
||||
|
||||
## Q1. Share link on a host where share links are off: 3 clicks or 4?
|
||||
|
||||
**Today (Phase 1 note, ui-api G10):** ⋯ (1) → Share link (2) → "Turn on share links and apply" (3) →
|
||||
wait about 60 s for the apply → Copy link (4). Copy needs its own click because a browser only allows
|
||||
writing to the clipboard within a few seconds of a click, and the apply takes a minute.
|
||||
|
||||
**Proposal: 3 clicks.** Click 3 is **"Turn on share links and copy link"**. In that one click:
|
||||
1. The UI calls `POST /hosts/{h}/share-links {path_prefix, expires_in_s, turn_on: true}`.
|
||||
2. Control mints the link at once (a share token is a stateless HMAC; minting does not need the host's
|
||||
setting to be on), and in the same call queues the apply that sets `share_links = true`. It answers
|
||||
in well under a second with the link and the apply.
|
||||
3. The UI writes the link to the clipboard inside the click (`ClipboardItem` holding the pending
|
||||
response, the pattern Safari requires and Chrome and Firefox accept when the answer comes within a
|
||||
second or two). If a browser still refuses, the dialog shows the link selected with a "Copy link"
|
||||
button, so only that browser takes a 4th click. Test it in Chrome, Firefox and Safari on iOS.
|
||||
4. The dialog says "Copied. The link starts working in about a minute, when the change is kept." and
|
||||
shows the watch. On kept: "Share links are on. The link works now."
|
||||
5. If the apply is reverted or not applied, control stops that link itself (deny list), so it never
|
||||
starts working later, even if share links are turned on another day. The dialog says so.
|
||||
|
||||
Why it is safe: until the apply is kept, edge strips the token on that host and the visitor gets the
|
||||
normal sign-in: nothing is opened early. The link is tied to the apply, so a failed apply leaves no
|
||||
valid link behind. The click still says plainly that it changes the host.
|
||||
|
||||
What it costs: one API change in control (accept `turn_on` on the mint call, mint while off, queue the
|
||||
PATCH, stop the link if that apply ends anything but kept). About a day's work with tests.
|
||||
|
||||
The one rough edge: someone who opens the link within that first minute gets the sign-in page. The
|
||||
dialog's "starts working in about a minute" covers it for the person sending.
|
||||
|
||||
**Recommendation: accept the 3-click design.** If you prefer no API change, the fallback is the
|
||||
current 4-click path, which the UI also supports (the button then reads "Turn on share links" and Copy
|
||||
appears when the apply is kept).
|
||||
|
||||
## Q2. How does the UI prove who it is to control (G14)?
|
||||
|
||||
Control trusts only API tokens today and refuses `Remote-User`. The UI cannot call control until this
|
||||
is decided. Options:
|
||||
- (a) **Edge adds a secret header for the admin host.** The admin host's file sets a request header
|
||||
from a systemd-credential secret (an existing feature); control requires it, then trusts
|
||||
`Remote-User` / `Remote-Name` from Authelia for who did it (history's `actor`, the sidebar's "Signed
|
||||
in as mark"). The browser never holds a token.
|
||||
- (b) Control on a Unix socket only edge can reach, plus (a)'s Remote-User trust.
|
||||
- (c) The UI holds an API token in memory, fetched from a bootstrap endpoint. A token in the browser
|
||||
is the worst of the three.
|
||||
|
||||
**Recommendation: (a) now, (b) in Phase 4 hardening.** Plus `X-Ianitor-UI` as today against CSRF.
|
||||
Also add `site.auth_logout_url` so the UI can show "Sign out".
|
||||
|
||||
## Q3. Engine switch: allowed when Caddy's comparison is not perfect?
|
||||
|
||||
The popover shows "{matched} of {compared} requests matched". What if some differ, or the comparison is
|
||||
old?
|
||||
|
||||
**Recommendation:** allow the switch with the differences listed under "Show details" (the fallback is
|
||||
for emergencies, when Pingora itself may be the problem); refuse only when Caddy's settings were never
|
||||
built (`engine.not_ready`). A switch waits in the same queue as applies, one change at a time.
|
||||
The API (`GET/POST /engine`, ui-api §1.9) is not built; the shape I designed against is in handoff §9.
|
||||
|
||||
## Q4. Share links while Caddy serves (G7)
|
||||
|
||||
Under Caddy no one checks share tokens, so a visitor with a link gets the normal sign-in (fails closed).
|
||||
Options: (a) accept for v1 and say so plainly in the engine popover, the share dialog and Settings
|
||||
(designed, handoff §9.1, §8.2); (b) build the small loopback validator that Caddy calls through
|
||||
`forward_auth`, from the same core code, so links work under both engines.
|
||||
|
||||
**Recommendation: (a) for v1**, because Caddy is the rarely used fallback and the failure is safe;
|
||||
(b) before v1.1's monthly switch rehearsal, since then links would break once a month.
|
||||
|
||||
## Q5. Device certificates: what if Custos cannot approve?
|
||||
|
||||
ROADMAP §4 puts a Custos approval on every device certificate. If Custos is unreachable, or has no
|
||||
approval operation yet (§8.6), nothing can be issued.
|
||||
|
||||
**Recommendation:** a server-side fallback, `sudo ianitor-control pki approve <code>`, shown in the UI
|
||||
with the match code to compare (handoff §13.4). It keeps the "a second factor approves every
|
||||
certificate" rule (shell access on the server), and needs no new secret handling. Alternative: no
|
||||
fallback, issuing waits for Custos.
|
||||
|
||||
## Q6. Intermediate renewal signed by hand: accept the extra steps?
|
||||
|
||||
When Custos cannot sign, the designed fallback (handoff §13.6) is: download the request and a signing
|
||||
settings file, sign on the offline computer with the root, upload the signed certificate. That is about
|
||||
4 clicks plus work away from the UI, against a budget of 1.
|
||||
|
||||
**Recommendation:** accept it as an exception to §4 that applies only while Custos lacks the signing
|
||||
operation, the same way the Phase 3 plan already allows a "temporary manual offline signing step".
|
||||
The exact command is owned by the PKI work (the UI shows what control returns). Confirm the root lives
|
||||
on an offline machine that can run openssl (or tell me what it runs instead).
|
||||
|
||||
## Q7. Device certificate lifetime
|
||||
|
||||
The device board has a placeholder. Phase 3 is to decide and justify it.
|
||||
|
||||
**Recommendation: 1 year (365 days)**, with the row turning "renew soon" 30 days before. Long enough
|
||||
that a family tablet is not a chore; short enough that a lost device's certificate dies within a year
|
||||
even if nobody revokes it. If the intermediate is renewed with the same key each year, existing device
|
||||
certificates keep validating across the renewal; if it is renewed with a new key, devices must be
|
||||
re-issued and the lifetime should not pass the intermediate's end date. Please confirm which renewal
|
||||
(same key or new key) the PKI work will do.
|
||||
|
||||
## Q8. Confirmations for Stop all share links and Revoke token
|
||||
|
||||
Your decision: "Stop is immediate". I read that as: a stopped link stops working at once (no apply).
|
||||
In the UI I kept a single "Stop this link" one click with no confirmation, but put a short inline
|
||||
confirmation on **"Stop all share links"** and on **"Revoke"** for an API token, because both are
|
||||
irreversible and break things beyond one link (other people's links; a script). Neither is in the §4
|
||||
budget.
|
||||
|
||||
**Recommendation: keep these two confirmations.** If you want Stop all to be one click too, say so.
|
||||
|
||||
## Q9. Polling keeps the Authelia session alive
|
||||
|
||||
The main screen polls every 5 s (30 s when hidden). Each poll goes through Authelia, which counts it as
|
||||
activity, so an open tab never reaches the inactivity timeout; only the absolute expiration ends it.
|
||||
|
||||
**Recommendation:** stop polling after 15 minutes in a hidden tab (resume when it is shown), so an
|
||||
unattended tab signs out by inactivity as Authelia intends. A visible tab keeps polling.
|
||||
|
||||
## Q10. Lifetime of new API tokens
|
||||
|
||||
Tokens are made with defaults on click 3, so there is no field for expiry before the token exists.
|
||||
Design: a small "New tokens expire after: 1 year | Never" choice next to the New token button, default
|
||||
1 year, not saved. The default path stays 3 clicks (+1 to copy).
|
||||
|
||||
**Recommendation: accept.** Alternative: always 1 year, and "never" only from the CLI.
|
||||
|
||||
## Q11. Show a chip for hosts open to anyone?
|
||||
|
||||
The board shows "Sign-in first" on protected hosts and nothing on open ones. Being open to anyone is the
|
||||
more important fact to notice.
|
||||
|
||||
**Recommendation:** add a chip "Open to anyone" on hosts with `auth = none`, same quiet chip style (no
|
||||
warning colour, because many open hosts are intended). Small change to the approved board.
|
||||
|
||||
## Q12. Server sentences missing for eight codes
|
||||
|
||||
`file.syntax`, `file.too_large`, `repo.duplicate_file`, `site.field.unknown`, `site.forward_auth`,
|
||||
`site.forward_auth.header`, `site.secret.name`, `site.acme` answer "Something went wrong." from
|
||||
control's messages.rs. The UI writes its own sentence for them (handoff §12.2), but curl users still get
|
||||
the generic one.
|
||||
|
||||
**Recommendation:** add the handoff's sentences to messages.rs in Phase 3, so the UI and the API say the
|
||||
same thing, and drop the UI's copies.
|
||||
|
||||
## Q13. Fonts
|
||||
|
||||
The boards load Cinzel, Cormorant Garamond and Manrope from Google Fonts. On a home server behind
|
||||
Authelia the UI should make no outside requests.
|
||||
|
||||
**Recommendation:** self-host the Latin woff2 files in packages/ui (all OFL). No visual change.
|
||||
Reference in New Issue
Block a user