Skip to content

fix(msteams): bound user token response parsing [AI]#101764

Closed
mmaps wants to merge 1 commit into
openclaw:mainfrom
mmaps:maintenance/update-20260707-153228-c9db42
Closed

fix(msteams): bound user token response parsing [AI]#101764
mmaps wants to merge 1 commit into
openclaw:mainfrom
mmaps:maintenance/update-20260707-153228-c9db42

Conversation

@mmaps

@mmaps mmaps commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes an issue where Microsoft Teams SSO token exchange could fail poorly when the Bot Framework User Token service returned a very large or malformed JSON response.

Why This Change Was Made

The Microsoft Teams SSO success path now uses the shared provider JSON response reader, matching the bounded parsing behavior already used by the plugin's Graph and attachment paths. The regression test verifies the stream is cancelled at the JSON response limit and that raw Response.json() parsing is not used.

AI-assisted.

User Impact

Microsoft Teams SSO token exchange now handles oversized or malformed User Token service responses with bounded parsing. Normal token responses keep the same behavior, and invalid responses do not persist a delegated token.

Evidence

  • pnpm format -- extensions/msteams/src/sso.ts extensions/msteams/src/monitor-handler.sso.test.ts
  • git diff --check
  • node scripts/run-vitest.mjs extensions/msteams/src/monitor-handler.sso.test.ts - 1 file, 6 tests passed
  • rg -n "await [A-Za-z0-9_]+\\.json\\(|\\.json\\(\\)" extensions/msteams/src extensions/msteams/*.ts - remaining Microsoft Teams matches are regression-test spies only

Known limitation: remote Testbox/Crabbox proof was not available in this environment because neither crabbox nor ../crabbox/bin/crabbox is installed.

@openclaw-barnacle openclaw-barnacle Bot added channel: msteams Channel integration: msteams size: S labels Jul 7, 2026
@mmaps
mmaps force-pushed the maintenance/update-20260707-153228-c9db42 branch from 4459fcd to 96b784c Compare July 7, 2026 15:47
@clawsweeper

clawsweeper Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Thanks for the context here. I swept through the related work, and this is now duplicate or superseded.

Close as superseded: this helper-only Microsoft Teams SSO bounded-read branch overlaps the same problem already owned by the open proof-positive route-level PR, which covers the registered sign-in routes and cloud token-host parity.

Root-cause cluster
Relationship: superseded
Canonical: #97781
Summary: This helper-only PR is superseded by the open canonical Microsoft Teams SSO bounded-read PR, which fixes the same helper and the live registered sign-in route boundary.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Canonical path: Close this helper-only duplicate and continue review on #97781, preserving the route-level bounded-read, SDK cloud-token-host, and overflow coverage there.

So I’m closing this here and keeping the remaining discussion on #97781.

Review details

Best possible solution:

Close this helper-only duplicate and continue review on #97781, preserving the route-level bounded-read, SDK cloud-token-host, and overflow coverage there.

Do we have a high-confidence way to reproduce the issue?

Yes, by source inspection. Current main and v2026.6.11 still use raw response.json() in the helper, while the live registered sign-in routes still delegate through SDK handlers.

Is this the best way to solve the issue?

No for this branch as the landing path. The bounded-reader direction is useful, but the canonical route-level PR is the narrower maintainable endpoint because it covers the live registered routes and sovereign-cloud token host behavior.

Security review:

Security review cleared: No supply-chain or secret-handling regression was found; the diff narrows an external SSO response-read boundary and adds only a focused test.

AGENTS.md: found and applied where relevant.

What I checked:

Likely related people:

  • sudie-codes: Authored the merged Microsoft Teams SSO implementation that added callUserTokenService, the invoke handlers, and adjacent SSO tests. (role: introduced behavior; confidence: high; commits: 828ebd43d47b; files: extensions/msteams/src/sso.ts, extensions/msteams/src/monitor.ts, extensions/msteams/src/monitor-handler.sso.test.ts)
  • heyitsaamir: Authored the merged Teams SDK migration that established the current SDK sign-in delegate boundary for the live routes. (role: major refactor author; confidence: high; commits: 04c29825356f; files: extensions/msteams/src/monitor.ts, extensions/msteams/src/sdk.ts, extensions/msteams/src/sso.ts)
  • steipete: Merged the Teams SDK migration that owns the production route compatibility question now handled by the canonical PR. (role: merger; confidence: high; commits: 04c29825356f; files: extensions/msteams/src/monitor.ts, extensions/msteams/src/sdk.ts)
  • Alix-007: Authored the shared bounded provider JSON reader and owns the open canonical Microsoft Teams SSO route-level bounded-read PR. (role: canonical fix author and adjacent owner; confidence: high; commits: 2592f8a51a4e, efffccc03c29; files: src/agents/provider-http-errors.ts, src/agents/provider-http-errors.test.ts, extensions/msteams/src/sso.ts)
  • Vincent Koc: Recent carry-forward work touched the Microsoft Teams SSO and monitor files on current main. (role: recent area contributor; confidence: medium; commits: 3ad77774f0e5; files: extensions/msteams/src/sso.ts, extensions/msteams/src/monitor.ts)

Codex review notes: model internal, reasoning high; reviewed against 3d206140f3f0.

@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P2 Normal backlog priority with limited blast radius. labels Jul 7, 2026
@mmaps mmaps closed this Jul 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: msteams Channel integration: msteams P2 Normal backlog priority with limited blast radius. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. size: S status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant