Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion gateway/platforms/qqbot/adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -3198,7 +3198,15 @@ def _strip_at_mention(content: str) -> str:
return stripped

def _open_dm_opted_in(self) -> bool:
if os.getenv("GATEWAY_ALLOW_ALL_USERS", "").lower() in {"true", "1", "yes"}:
# GATEWAY_ALLOW_ALL_USERS is authorization config, not a credential,
# but the same profile-isolation rule applies (#72348 class): under
# multiplexing os.environ holds the DEFAULT profile's opt-in, so a
# secondary profile with dm_policy=open must not inherit it. Route
# through the scoped resolver like every other QQ_* read.
if (
_resolve_qq_secret("GATEWAY_ALLOW_ALL_USERS", "").lower()
in {"true", "1", "yes"}
):
return True
return _resolve_qq_secret("QQ_ALLOW_ALL_USERS", "").lower() in {"true", "1", "yes"}

Expand Down
6 changes: 3 additions & 3 deletions plugins/platforms/email/adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -1069,7 +1069,7 @@ def _allow_all_senders() -> bool:
truthy = {"true", "1", "yes"}
return (
_get_secret("EMAIL_ALLOW_ALL_USERS", "").strip().lower() in truthy
or os.getenv("GATEWAY_ALLOW_ALL_USERS", "").strip().lower() in truthy
or _get_secret("GATEWAY_ALLOW_ALL_USERS", "").strip().lower() in truthy
)

@staticmethod
Expand All @@ -1084,7 +1084,7 @@ def _allowlist_in_effect() -> bool:
"""
return bool(
_get_secret("EMAIL_ALLOWED_USERS", "").strip()
or os.getenv("GATEWAY_ALLOWED_USERS", "").strip()
or _get_secret("GATEWAY_ALLOWED_USERS", "").strip()
)

async def _dispatch_message(self, msg_data: Dict[str, Any]) -> None:
Expand All @@ -1108,7 +1108,7 @@ async def _dispatch_message(self, msg_data: Dict[str, Any]) -> None:
allowed_raw = _get_secret("EMAIL_ALLOWED_USERS", "").strip()
if not allowed_raw:
if _get_secret("EMAIL_ALLOW_ALL_USERS", "").strip().lower() not in {"true", "1", "yes"} and (
os.getenv("GATEWAY_ALLOW_ALL_USERS", "").strip().lower() not in {"true", "1", "yes"}
_get_secret("GATEWAY_ALLOW_ALL_USERS", "").strip().lower() not in {"true", "1", "yes"}
):
logger.debug(
"[Email] Dropping sender at dispatch — EMAIL_ALLOWED_USERS is unset "
Expand Down
12 changes: 10 additions & 2 deletions plugins/platforms/teams/adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -1218,8 +1218,16 @@ async def _on_card_action(
# TEAMS_ALLOW_ALL_USERS=true opt-in. Without one of these set, the
# bot silently treated every clicker as authorized — meaning any
# Teams user who could message the bot could approve dangerous commands.
allowed_csv = os.getenv("TEAMS_ALLOWED_USERS", "").strip()
allow_all = os.getenv("TEAMS_ALLOW_ALL_USERS", "").strip().lower() in {"1", "true", "yes"}
# Authorization config must honor the profile secret scope: under
# multiplexing os.environ holds the DEFAULT profile's allowlist /
# opt-in, so a secondary profile must not inherit it (#72348 class).
allowed_csv = str(_get_scoped_secret("TEAMS_ALLOWED_USERS", "") or "").strip()
allow_all = (
str(_get_scoped_secret("TEAMS_ALLOW_ALL_USERS", "") or "")
.strip()
.lower()
in {"1", "true", "yes"}
)

if not allow_all:
if not allowed_csv:
Expand Down
Loading
Loading