docs: four env vars control the dashboard bind address, none of them documented - #10095
Open
xizhuomengcontin wants to merge 1 commit into
Open
xizhuomengcontin wants to merge 1 commit into
xizhuomengcontin wants to merge 1 commit into
Conversation
Contributor
There was a problem hiding this comment.
Hey - I've found 1 issue
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="astrbot/dashboard/server.py" line_range="519" />
<code_context>
+ # then the ASTRBOT_-prefixed one -- so DASHBOARD_HOST wins over ASTRBOT_DASHBOARD_HOST if
+ # both are set. Unset everywhere, the dashboard binds 0.0.0.0:6185, i.e. every interface.
+ #
+ # The host chain is also read by AuthService.can_skip_default_password_auth, which only
+ # allows that skip when the resolved host is 127.0.0.1, localhost or ::1. So these
+ # variables decide where the dashboard listens and, indirectly, whether the default
+ # password gate can be waived.
port = (
os.environ.get("DASHBOARD_PORT")
</code_context>
<issue_to_address>
**nitpick:** The comment implies that all four bind-address variables can indirectly determine whether the default-password gate is waived, but AuthService reads only DASHBOARD_HOST and ASTRBOT_DASHBOARD_HOST; changing either port variable cannot affect that authentication decision.
**Suggested fix:** Say that the host variables, rather than all four variables, also influence the default-password gate.
```suggestion
# host variables decide where the dashboard listens and, indirectly, whether the default
```
</issue_to_address>Sourcery assessment
Approved.
| # | ||
| # The host chain is also read by AuthService.can_skip_default_password_auth, which only | ||
| # allows that skip when the resolved host is 127.0.0.1, localhost or ::1. So these | ||
| # variables decide where the dashboard listens and, indirectly, whether the default |
Contributor
There was a problem hiding this comment.
nitpick: The comment implies that all four bind-address variables can indirectly determine whether the default-password gate is waived, but AuthService reads only DASHBOARD_HOST and ASTRBOT_DASHBOARD_HOST; changing either port variable cannot affect that authentication decision.
Suggested fix: Say that the host variables, rather than all four variables, also influence the default-password gate.
Suggested change
| # variables decide where the dashboard listens and, indirectly, whether the default | |
| # host variables decide where the dashboard listens and, indirectly, whether the default |
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.
What
A comment at the dashboard's host/port resolution, naming the four environment variables it reads and what they interact with. Comment only — no code touched.
Why
astrbot/dashboard/server.py:513-522readsDASHBOARD_PORT,ASTRBOT_DASHBOARD_PORT,DASHBOARD_HOSTandASTRBOT_DASHBOARD_HOST. A repo-wide search finds none of the four in any.md,.yml,.envor example file. The only dashboard variable written down anywhere isASTRBOT_DASHBOARD_INITIAL_PASSWORD, and only inchangelogs/v4.24.5.md.Three things are not guessable from the code without reading it twice:
DASHBOARD_HOSTbeatsASTRBOT_DASHBOARD_HOST. Someone who sets only the prefixed name in a container that already exports the unprefixed one will not get what they set.dashboard.hostis overridden by either variable, so editing the config file has no effect while the variable is present.0.0.0.0:6185— every interface, not loopback.The interaction worth flagging
astrbot/dashboard/services/auth_service.py:485-490resolves the host through the same chain to decide whether the default-password gate may be skipped:So the same variable that moves the listener also feeds an authentication decision. The comment says so, because someone changing a bind address should know it is load-bearing elsewhere.
To be clear, I am not reporting a vulnerability. I checked before writing this:
LOCAL_DASHBOARD_HOSTSis{"127.0.0.1", "localhost", "::1"}(auth_service.py:86), so the skip only applies to loopback."0.0.0.0"inserver.py,""inauth_service.py— and that divergence fails closed:""is not in the set, so with nothing configured the gate is not skipped.ASTRBOT_DASHBOARD_SKIP_DEFAULT_PASSWORD_AUTH(auth_service.py:84).All three of those are the right behaviour. I mention them so a reviewer does not have to re-derive them to be sure this PR is not fixing something silently.
Scope
One comment block in one file. No behaviour, no defaults, no new variable. Happy to shorten it, translate it, or move the content to a docs page instead if you would rather it lived there.
Summary by Sourcery
Enhancements: