feat(auth)!: replace id whitelist with unlisted session admission - #222
Merged
Merged
Conversation
Add admission.unlisted_sessions and migrate old whitelist fields into canonical session overlays. Replace WhitelistCheckStage with AdmissionCheckStage after WakingCheck. BREAKING CHANGE: id_whitelist, enable_id_white_list, id_whitelist_log, and wl_ignore_admin_* are removed. Empty or disabled lists become allow. A non-empty enabled list becomes deny plus listed session overlays. Dashboard writes of the old fields fail. WebChat, OneBot notice/request, and provider.manage skip unlisted-session deny. Related: #215 AI-Generated: true Generated-At: 2026-09-17T18:27:57Z
Store and read llm_enabled on session:{platform}:group|private:{id}
instead of unique-session UMO so a group disable applies to every
member. Export session_admission_key_from_event from astrbot.api
because builtin commands cannot import astrbot.core.
Related: #215
AI-Generated: true
Generated-At: 2026-09-17T18:28:10Z
Replace remaining whitelist wording with admission.unlisted_sessions and the AdmissionCheck pipeline stage. Update command help so /session info no longer tells operators to whitelist a group ID. Related: #215 AI-Generated: true Generated-At: 2026-09-17T18:28:16Z
Keep migrated allowlists per config profile instead of a global session_enabled overlay. Dashboard service rules dual-write admission fields onto the canonical session key, unique-session UMOs unwrap to the group id, and LLM status reads that same key. Related: #215 AI-Generated: true Generated-At: 2026-09-17T20:09:12Z
Narrow session_service_config writes so quality pyright accepts the canonical dual-write helper. Log tempfile cleanup failures instead of an empty except. Related: #215 AI-Generated: true Generated-At: 2026-09-17T20:19:47Z
Member
Author
|
Pushed
Local checks: |
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
Replace ID-whitelist admission with
admission.unlisted_sessionsplus canonical session overlays afterWakingCheck. Empty or disabled lists becomeallow; a non-empty enabled list becomesdenyplus listed session overlays. Unique-session/llm disablenow writes the group session key so every member is gated.Related issue
Fixes #215
Related: #212
Behavior
admission.unlisted_sessions=allow. There is noid_whitelist,enable_id_white_list,id_whitelist_log, orwl_ignore_admin_*.allow. A non-empty enabled list becomesdenyand records canonical session keys; startup then writessession_enabled=trueoverlays unless that field is already a bool.session:{platform_id}:group:{id}for each configured platform. Unique-session UMO list entries are not rewritten to group IDs.AdmissionCheckStagesits afterWakingCheckStageand reads overlays on the canonical session key, not unique-session UMO. WebChat, OneBotnotice/request, andprovider.manageon the instance skip unlisted-session deny./llm disableand/llm enablestorellm_enabledonsession:{platform}:group|private:{id}.should_process_llm_requestreads that same key. Old unique-session UMOllm_enabled=falserows are not dual-read.Non-goals
Sender overlays and
/user(#216). Custom-rule sender targets, OpenAPI session APIs, and Dashboard sender pickers (#217). AbsorbingSessionStatusCheckStage. Moving persona, TTS, orsession_enabledoff UMO. Command allow/deny lists, LLM block tools, and restoringadmins_id. Addingadmission.unlisted_sendersas a config knob.Implementation notes
Surgical replacement of
WhitelistCheckStage; composition stays incompose_admission.unlisted_sendersis hard-codedallowuntil A3. Pending overlay keys are persisted in a data-root sidecar before config integrity strips unknown whitelist fields, then applied and deleted. Builtin commands cannot importastrbot.core, sosession_admission_key_from_eventis exported fromastrbot.api. OpenAPI generation is not required: no route or schema contract change. Dashboard custom-rule LLM toggles still save against UMO.Validation
Focused pytest passed (207 tests). Dashboard
pnpm i18n:check, docspnpm run docs:build, andmake check-mdpassed.make checkand the full blocking pytest suite were not run.Compatibility and risk
Breaking config and pipeline change. Operators with a non-empty enabled whitelist get
unlisted_sessions=denyplus listed overlays; operators who relied on empty/disabled lists keep the defaultallow. Unique-session group/llm disablenow applies to the whole group. Existing unique-session UMOllm_enabled=falserows stop taking effect.apply_pending_session_allowsdoes not overwrite an existing boolsession_enabled(includingfalse).session_blockedoverlays still pass this stage;SessionStatusCheckStageremains the command-passthrough owner.Checklist
docs/zh/anddocs/en/.docs/public/openapi.json, and tests change together when routes or schemas change.pyproject.toml,requirements.txt, anduv.locktogether.!and aBREAKING CHANGE:footer.Agent note
Goal: land A2 of #212 / #215 — delete ID-whitelist admission, migrate to
admission.unlisted_sessionsplus canonical session overlays, and point group/llm disableat the canonical session key. Three commits onfeat/unlisted-session-admission:feat(auth)!(config, migration sidecar,AdmissionCheckStage),feat(commands)(/llm+astrbot.apiexport),docs. Checks actually run are listed above; fullmake check/ blocking pytest were not. Residual risk: no dual-read of old unique-session UMO LLM rows; Dashboard custom-rule LLM toggles remain UMO-keyed until #217;unlisted_sendersstays hard-codedallowuntil #216. Tools: OpenCode. This write-up is not the required separate AI-assisted review.