Invite minting, invitee onboarding, and version footer #42
No reviewers
Labels
No labels
Compat/Breaking
Kind/Bug
Kind/Documentation
Kind/Enhancement
Kind/Feature
Kind/Security
Kind/Testing
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Reviewed
Confirmed
Reviewed
Duplicate
Reviewed
Invalid
Reviewed
Won't Fix
Status
Abandoned
Status
Blocked
Status
Need More Info
No milestone
No assignees
3 participants
Notifications
Due date
No due date set.
Reference
marvin8/xique!42
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/issue-22-invite-minting-onboarding"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #22
Closes #41
Invite minting (admin-only,
/settings) — new Invites section: optional note, 1/7/30-day expiry (7 default), fullhttps://…/invite/{code}URL shown once for copy-paste (rendered directly from the POST so the code never lands in history or access logs), plus a table of outstanding invites for re-copying. Route gated byrequire_admin; section hidden from non-admins.Onboarding — redeeming an invite now signs the new user in immediately (session minted with the existing helpers, cookie set exactly as login does) and lands on
/settingsto connect Jellyfin — no forced second login. Expired/used/unknown invites render a friendly page telling the invitee to ask for a fresh link, replacing the bare JSON 410/404.Footer — every page carries a footer with the running version (from installed distribution metadata), a link to the source, and a link to the docs for that exact version (
{docs_base_url}/{version}/, matching the mike per-version layout). Two new settings:XIQUE_SOURCE_URL,XIQUE_DOCS_BASE_URL(README + docs/config.md updated).Tests: 13 new tryke tests (minting gating/expiry/listing, sign-in on redeem, rendered 404/410 pages, footer); full
uv run noxgreen (9 sessions).Admins can now mint single-use invite links from a new section on /settings: optional note, 1/7/30-day expiry (7 by default), and the full /invite/{code} URL shown for handing to the invitee. Outstanding invites (unused and unexpired) are listed so links can be re-copied without minting duplicates. The route is gated by require_admin and the section is hidden from non-admins.WuMing
Found 1 issue(s). See inline comments below.
@ -467,3 +501,2 @@if user_id is None:raise HTTPException(status_code=status.HTTP_410_GONE, detail="invite no longer usable")return RedirectResponse("/login", status_code=status.HTTP_303_SEE_OTHER)return _render_invite_unavailable(request, "expired", status.HTTP_410_GONE)code [MEDIUM]
When redeem_invite returns None because the invite was already used (but still within its expiry window), the endpoint incorrectly renders the "expired" page instead of "used". The user would see a misleading message. The code should determine the correct reason (used vs. expired) – either by checking the invite state again before the fallback, or by returning "used" when user_id is None.
src/xique/web/routes/auth.py✅ Fixed in commit
52c3055— after a lost claim the route re-fetches the invite and classifies the page from its actual state (used vs expired), with a race-simulation test pinning the used case.WuMing
Found 2 issue(s). See inline comments below.
@ -470,0 +503,4 @@reason = "used" if invite is not None and invite["used_by"] is not None else "expired"return _render_invite_unavailable(request, reason, status.HTTP_410_GONE)request_settings: Settings = request.app.state.settingssession_token = new_session_token()security [MEDIUM]
A09: Security Logging and Monitoring Failures: Successful invite redemption and auto-login is not logged. Log security events (user creation via invite, session issuance) for monitoring.
@ -371,0 +470,4 @@_invite_expiry(int(expires_days)),cleaned_note,)minted_invite_url = f"{str(request.base_url).rstrip('/')}/invite/{code}"security [MEDIUM]
A09: Security Logging and Monitoring Failures: Invite minting success is not logged. Log admin actions (minting code, expiry, note) for audit trails and abuse detection.
src/xique/web/routes/auth.py✅ Fixed in commit
b61c684— successful redemption logs the created username and that a session was issued, at INFO, with a test asserting the coverage. The session token and password are never logged.src/xique/web/routes/auth.py✅ Fixed in commit
b61c684— successful redemption logs the created username and that a session was issued, at INFO, with a test asserting the coverage. The session token and password are never logged.