Repository navigation
fix(msteams): keep unresolved allowlists restrictive instead of collapsing to open - #184989
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. What this changesPreserves unresolved Teams allowlists as restrictive in-memory projections instead of allowing unrestricted routes or DM-list fallback. Example: groupAllowFrom is ["Bob Builder"], name resolution fails, and the DM allowlist is ["*"].
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review This PR fixes a current Teams authorization defect, and no actionable patch defect remains; keep it open through its draft and CI workflow. Priority: P1 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherThe Teams plugin projects operator settings at startup, then supplies sender and team/channel policies to inbound admission and dispatch authorization. flowchart TD
A[Stored Teams settings] --> B[Startup ID projection]
C[Graph resolution] --> B
B --> D[Account scoped runtime config]
E[Incoming Teams activity] --> F[Sender and route authorization]
D --> F
F --> G[Agent dispatch or rejection]
Technical reviewBest possible solution: Keep configuredness in the existing Teams projection while preserving stable IDs, explicit wildcards, genuinely empty-list fallback, and stored settings. Do we have a high-confidence way to reproduce the issue? Current-main projection and policy source establish the fail-open path, corroborated by supplied pre-fix Gateway and v2026.10.7 traces; this review executed no target code. Is this the best way to solve the issue? The fix belongs at the Teams projection boundary because shared gates correctly treat genuinely unset lists as unset, and the new marker preserves that distinction without changing public configuration. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 50b9e88fd3c3. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +79, Tests +204. Total +283 across 5 files. Added test files: 0. View PR surface stats
Review metrics
LabelsLabel changes:
Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (7 earlier review cycles)
Reviewed October 26, 2026, 8:07 PM ET / October 27, 2026, 00:07 UTC (Revision 8). |
|
🦞👀 Re-review progress:
|
|
🦞👀 Re-review progress:
|
|
🦞👀 Re-review progress:
|
|
🦞👀 Re-review progress:
|
|
🦞👀 Re-review progress:
|
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
Merge recordSummary: Fixes a Microsoft Teams authorization defect where a configured Decision Reason for Merge: Merged because the fix has real Gateway proof (names-only Compatibility Checks Done: Stable-ID allowlist control scenario behaves identically before and after; a stored config is byte-identical across an in-place plugin upgrade on a clean VM running v2026.10.7, and the Teams provider starts and connects; full |
…psing to open (openclaw#184989) * fix(msteams): keep unresolved allowlists restrictive instead of collapsing to open * fix(msteams): use a non-access-group deny marker for unresolved sender allowlists * test(msteams): drop marker-representation test covered by handler regression * test(msteams): drop projection-plus-route cases duplicated by handler admission table
…psing to open (#184989) * fix(msteams): keep unresolved allowlists restrictive instead of collapsing to open * fix(msteams): use a non-access-group deny marker for unresolved sender allowlists * test(msteams): drop marker-representation test covered by handler regression * test(msteams): drop projection-plus-route cases duplicated by handler admission table (cherry picked from commit 9c7f90a) Co-authored-by: RomneyDa <[email protected]> (cherry picked from commit aa6e9233bd452fd725848d72bc571c1b283137d9)
…psing to open (#184989) * fix(msteams): keep unresolved allowlists restrictive instead of collapsing to open * fix(msteams): use a non-access-group deny marker for unresolved sender allowlists * test(msteams): drop marker-representation test covered by handler regression * test(msteams): drop projection-plus-route cases duplicated by handler admission table Beta.5 baseline adaptation: Retain the native beta.5 owners, fixtures and public contracts; add focused regression controls and bounded fixture extraction; apply checkout formatting. (cherry picked from commit 9c7f90a) Co-authored-by: RomneyDa <[email protected]> (cherry picked from commit 813bffb454620f5222c62360c80d95eaa2935685)
…to extended stable (#187286) * fix(msteams): keep unresolved allowlists restrictive instead of collapsing to open (#184989) * fix(msteams): keep unresolved allowlists restrictive instead of collapsing to open * fix(msteams): use a non-access-group deny marker for unresolved sender allowlists * test(msteams): drop marker-representation test covered by handler regression * test(msteams): drop projection-plus-route cases duplicated by handler admission table (cherry picked from commit 9c7f90a) Co-authored-by: RomneyDa <[email protected]> (cherry picked from commit 25265e4b23843946108fe75d6823cd4e3e64cfd7) * refactor: keep Teams allowlist sentinel private (#185484) The Microsoft Teams fail-closed allowlist sentinel now remains module-private while preserving its exact restrictive projection and lifecycle coverage. (cherry picked from commit 59b1ddd) Co-authored-by: RomneyDa <[email protected]> (cherry picked from commit 52a8609397572a37ae78544c11118704f8711f12) * fix(msteams): backport restrictive unresolved allowlists to extended stable OpenClaw-Publication: 0457935b-4ff7-4cd5-bf04-de5a5e46e7f3 * fix: satisfy focused backport lint requirements (#187286) Co-authored-by: RomneyDa <[email protected]> * test: resolve Teams config type from runtime API root Co-authored-by: RomneyDa <[email protected]> --------- Co-authored-by: Agustin Rivera <[email protected]> Co-authored-by: RomneyDa <[email protected]> Co-authored-by: Shakker <[email protected]> Co-authored-by: roboclaw-bot <[email protected]>
Summary
At monitor startup the Microsoft Teams plugin replaces the configured
teamsmap andgroupAllowFromlist with a stable-ID projection that drops mutable display names. When every configured entry was a name that did not resolve, the projection became{}or[]. The route gate and the group sender gate both read an empty value as "no allowlist configured", so the restriction the operator wrote disappeared and the bot admitted senders it was meant to exclude. This change keeps a configured-but-unresolvable allowlist configured and makes it match nothing, so the gates deny. It is contained inextensions/msteams; no core change, no new config key, no default change.Related: #99905 introduced the name-dropping projection, #115746 extended it to group conversation IDs, #112811 introduced the handler config reader.
What Problem This Solves
An operator who scopes the Teams bot with name-keyed entries (for example
teams: { "Engineering": {} }, orgroupAllowFrom: ["Bob Builder"]) expects unresolved names to be "kept as typed but ignored for routing" (docs/channels/msteams/access-control.md), i.e. to grant nothing. Instead the whole restriction is removed. A member or guest of the tenant who can message the bot outside the intended scope can then trigger the agent, bounded by the sender gate (see Evidence for which configurations are exposed).What was wrong
teamsthat do not resolve.projectStableMSTeamsTeamsConfig(extensions/msteams/src/resolve-allowlist.ts) drops every team key that is not*, a GUID, or a19:...@threadid.monitor.tskeeps that projection when Graph resolution fails or finds nothing.resolveMSTeamsRouteConfig(policy.ts) computesallowlistConfigured = Object.keys(teams).length > 0, so{}means "not configured" andresolveNestedAllowlistDecision(src/channels/channel-config.ts) returns allowed.*team.projectStableMSTeamsChannelskeeps only*and thread-id channel keys, sochannelsbecomes{}and the inner gate reads "no channel allowlist". Graph state is irrelevant here;resolveMSTeamsTeamsConfignever looks up name channels under*.groupAllowFrom.projectStableMSTeamsGroupAllowlistreturns[].effectiveGroupSenderAllowlist(src/channels/message-access/allowlist.ts) andresolveGroupAllowFromSources(src/channels/allow-from.ts) treat an empty group list as unset and substitute the DMallowFrom, which can be["*"]withdmPolicy: "open".Net effect: a configured restriction silently turns into either no restriction or the DM list.
Why this design
19:[email protected]key for teams, channels and senders. It is deliberately not anaccessGroup:reference, because operators can define any access-group name; a regression test defines a same-named group and asserts it grants nothing.undefined), empty ([]/{}), and whitespace-only lists are left as they were, so the documented DM fallback for an unsetgroupAllowFromstill applies.dangerouslyAllowNameMatchingbehavior.Why this does not conflict with related PRs
groupAllowFromThis branch is based on current
upstream/main; the touched files are all underextensions/msteams/src.Evidence
groupAllowFrom,dmPolicy: open,allowFrom: ["*"](path c)pnpm openclaw qa msteams, mock model, loopback-only network namespace)QA-COLLAPSE-C-CHANNEL,QA-COLLAPSE-C-GROUPCHAT); scenario failsQA-COLLAPSE-LIVE-C); scenario passesteams: { Engineering: {} },groupPolicy: open, nothing resolves (path a)QA-COLLAPSE-A-...); scenario failsQA-COLLAPSE-LIVE-A); scenario passesteams: { "*": { channels: { Roadmap: {} } } },groupPolicy: open(path b)QA-COLLAPSE-B-...); scenario failsQA-COLLAPSE-LIVE-B); scenario passesteams, nothing resolves*team19:..@threadteam, probe inside the configured teamgroupAllowFromwith an operator-defined access group named like the old placeholderaccessGroup:reference)monitor.lifecycle.test.tsgroupAllowFrom: [](fails)*/ unset / empty listsThe three Gateway scenarios are local QA flow files (not part of this PR) that send channel and group-chat probes from an unlisted sender, wait 25s for no outbound message (no agent dispatch), then require a reply to an allowed DM so a dead pipeline cannot pass. Each was run on the base source (fails) and on this branch (passes). Revocation during preparation is not changed by this PR: the placeholder is fixed at startup, and the existing handler-time re-authorization suites pass unchanged.
Captured Gateway output
Each run:
pnpm openclaw qa msteams --scenario <id> --allow-failuresinside a loopback-only network namespace (unshare --user --map-root-user --net), real Gateway + bundled Teams plugin + loopback Bot Framework connector + mock model. "base" is the pre-fixresolve-allowlist.ts/monitor.ts; "fix" is this branch. Message and activity IDs are redacted to<id>; no credentials or endpoints are involved. The control run uses a stable19:[email protected]channel ID: it behaves identically on base and fix (unlisted channel blocked, listed channel answered), i.e. existing ID-keyed settings are unchanged.Captured suite summaries (a, b, c, ID control; base and fix)
Latest stable release (v2026.10.7) as the pre-fix baseline
The same scenario files and the same stored settings were run against a checkout of the latest stable tag
v2026.10.7(its QA harness needed a four-lineprepareFlowbackport from main so the webhook URL resolves; no product code was changed). The stable-ID control passes there exactly as it does on this branch, so existing ID-keyed settings and valid ID access are unchanged by this fix. The names-onlygroupAllowFromcase reproduces on the stable release (probes answered) and is blocked on this branch.Captured v2026.10.7 runs (ids redacted)
In-place upgrade on a clean VM
On a freshly restored clean-slate Linux VM, Node 26.12.1 and a fresh
npm install -g [email protected]plus the official@openclaw/msteams2026.10.7 plugin, I applied a stored configuration and started the Gateway on the stable release. The configuration haddmPolicy: open,allowFrom: ["*"],groupPolicy: allowlist,groupAllowFrom: ["Bob Builder"], and ateamsmap with one stable19:[email protected]team (with a stable channel) next to the name keyEngineering. I then stopped the Gateway and replaced the installed plugin'sdistwith a build of this branch's two source changes applied on top of the v2026.10.7 tree (the branch does not apply cleanly to that tag, soresolve-allowlist.tsneeded a manual merge of the placeholder block; no other change), kept the stored configuration and state in place, and started the Gateway again.What this shows: after the upgrade the stored configuration is byte-identical (same sha256), the Teams plugin registers without errors, the provider starts on the same route, and the channel reports running and connected with the existing settings. The VM has no Bot Framework connector, so this run does not send traffic; the allow/deny behavior is shown by the Gateway scenarios above. The plugin-only swap on a stable core is a proxy for a release upgrade, not a published release.
Data-model compatibility
No stored data, schema, config key or default changes. The placeholder exists only in the in-memory projection handed to the handler at startup; the stored configuration is never rewritten (asserted in
monitor.lifecycle.test.tsandresolve-allowlist.test.ts). Existing ID-keyed,*,accessGroup:and resolved-name configurations project exactly as before (existingresolve-allowlist, lifecycle and conversation-allowlist suites pass unchanged).Commands (Node 24.22.1): on this branch
pnpm test extensions/msteamspasses (16 + 91 test files);oxfmt --list-different,oxlinton the changed files,pnpm tsgo:extensionsandpnpm tsgo:extensions:testpass. Against the base source the four handler admission rows, the new unit tests and the lifecycle test fail. Not run:node scripts/check-changed.mjsas a single aggregate (the host killed it); the assertion-safety ratchet was run on its own and passes.Testing
resolve-allowlist.test.ts(projection, Graph-resolution path, placeholder cleanup, sender list, no config mutation), 1 inmonitor.lifecycle.test.ts, 5 handler-level admission tests inmonitor-handler/message-handler.authz.test.ts(including the access-group collision).extensions/msteamssuites, including the existing conversation-allowlist and policy tests.Boundary decisions requested
groupAllowFrom, no group sender is now admitted until an ID is configured (previously the DM list was used). This restores the documented "only listed senders" behavior; please confirm that tightening is acceptable.main, the handler reader (monitor-handler/config.ts) serves the raw configuration after an unrelated config reload. A name-keyed team that sits beside a*entry then falls through to the*entry. That is a separate mechanism from this fix and is not changed here; please decide whether it should be handled in a follow-up.