feat: support passwordless desktop sessions - #9585
Merged
Merged
Conversation
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
astrbot-docs | 48b5384 | Commit Preview URL Branch Preview URL |
Aug 07 2026, 07:51 AM |
Soulter
marked this pull request as ready for review
August 7, 2026 09:15
Contributor
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- In
AuthService.desktop_sessionyou’re checkingis_desktop_session_auth_enabledandis_loopback_client_hostbefore callingverify_desktop_session_secret, which repeats those checks internally; consider consolidating the checks into one place (either indesktop_sessionor inverify_desktop_session_secret) to avoid drift and simplify reasoning about the security boundary. - Given that
auth_sourceis now a typed value in JWTs (e.g., "password" vs "desktop"), it may be worth centralizing those strings as constants or an enum-like structure to avoid typos and make future sources (e.g., SSO) easier to add consistently.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- In `AuthService.desktop_session` you’re checking `is_desktop_session_auth_enabled` and `is_loopback_client_host` before calling `verify_desktop_session_secret`, which repeats those checks internally; consider consolidating the checks into one place (either in `desktop_session` or in `verify_desktop_session_secret`) to avoid drift and simplify reasoning about the security boundary.
- Given that `auth_source` is now a typed value in JWTs (e.g., "password" vs "desktop"), it may be worth centralizing those strings as constants or an enum-like structure to avoid typos and make future sources (e.g., SSO) easier to add consistently.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
POST /api/v1/auth/desktop-sessionendpoint for desktop-managed runtimesWhy
The desktop WebUI can require a random initial password before the user has access to logs, and an expired dashboard JWT can leave users unable to recover if they no longer know that password. The desktop client already owns and launches the local backend, so it can safely establish a local session without exposing a general password bypass.
Security boundaries
ASTRBOT_DESKTOP_MANAGED=1and a session secret are both presentCompanion desktop PR
AstrBotDevs/AstrBot-desktop#166
Validation
uv run ruff format .uv run ruff check .uv run pytest tests/test_desktop_runtime.py tests/test_dashboard.py -k desktop_session -q(7 passed)pnpm typecheckSummary by Sourcery
Add passwordless desktop session authentication for desktop-managed backends, issuing short-lived dashboard JWTs only for loopback clients when a per-process session secret is configured, while keeping existing password-based login unchanged.
New Features:
Enhancements:
Tests: