Skip to content

fix(msteams): accept SingleTenant sts.windows.net issuer in JWT validator (#64270)#64641

Merged
BradGroux merged 1 commit intoopenclaw:mainfrom
sudie-codes:fix/msteams-singletenant-jwt-64270
Apr 12, 2026
Merged

fix(msteams): accept SingleTenant sts.windows.net issuer in JWT validator (#64270)#64641
BradGroux merged 1 commit intoopenclaw:mainfrom
sudie-codes:fix/msteams-singletenant-jwt-64270

Conversation

@sudie-codes
Copy link
Copy Markdown
Contributor

Summary

Fixes SingleTenant bot JWT validation failures. SingleTenant has been Microsoft's default bot type since 2025-07-31, so every new Teams bot deployment was hitting 401 Unauthorized on incoming webhooks.

Root cause

The sts.windows.net v1 issuer entry in BOT_FRAMEWORK_ISSUERS was hardcoded to one specific tenant UUID (d6d49420-f39b-4df7-a1dc-d59a935871db). SingleTenant tokens carry issuer https://sts.windows.net/{tenantId}/ scoped to the bot's own tenant, so every other deployment failed issuer validation.

The second half of the bug report, missing https://api.botframework.com from the audience list, was already fixed in #62674. The current createBotFrameworkJwtValidator builds allowedAudiences = [appId, api://appId, https://api.botframework.com], so no further audience changes are needed. Verified against extensions/msteams/src/sdk.ts.

Fix

  • Change the sts.windows.net entry from a hardcoded string to (tenantId) => \https://sts.windows.net/${tenantId}/\``, matching the shape of the existing login.microsoftonline.com/.../v2.0 v2 entry. createBotFrameworkJwtValidator already resolves function-form issuers against creds.tenantId, so no caller changes are needed.
  • Rename the existing STS Windows test to explicitly reference SingleTenant and [Bug] MS Teams SingleTenant bot: JWT validation fails (issuer + audience mismatch) #64270, and have it read creds.tenantId so it exercises the tenant-aware path.
  • Add a regression guardrail test: the previously hardcoded UUID must be rejected when the bot is configured for a different tenant. This prevents silently accepting cross-tenant tokens if the string ever gets reintroduced.

Note on related PR

#64276 (by @mschaepers, the issue reporter) proposes the same sts.windows.net fix. This PR builds on their approach with identical production semantics, plus an extra regression test for the cross-tenant case and a code comment that documents why the function form exists. If #64276 lands first, this PR becomes a small test-only follow-up.

Test plan

  • pnpm test extensions/msteams/src/sdk.test.ts (13 passed, including the two new SingleTenant cases)
  • CI green

Fixes #64270

Generated with Claude Code

@openclaw-barnacle openclaw-barnacle Bot added channel: msteams Channel integration: msteams size: XS labels Apr 11, 2026
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Apr 11, 2026

Greptile Summary

This PR fixes a JWT validation bug (#64270) where sts.windows.net v1 issuer tokens were rejected for all SingleTenant bot deployments except the one whose UUID happened to be hardcoded. The fix replaces the hardcoded string with a function (tenantId) => \https://sts.windows.net/${tenantId}/\`` — exactly matching the existing pattern used for the login.microsoftonline.com v2 entry — and adds both a positive test confirming tenant-aware acceptance and a regression guardrail test confirming the old UUID is rejected for a differently-configured bot.

Confidence Score: 5/5

Safe to merge — minimal, targeted fix using an established pattern with correct tests and no security regressions.

The production change is a one-line replacement following an existing pattern already used in the same array. resolveIssuerEntry and allowedIssuers both already handle the function form correctly, so no call-site changes are needed. The two new tests cover both the happy path and the cross-tenant rejection path. No unrelated changes are introduced.

No files require special attention.

Reviews (1): Last reviewed commit: "fix(msteams): accept SingleTenant sts.wi..." | Re-trigger Greptile

@BradGroux BradGroux force-pushed the fix/msteams-singletenant-jwt-64270 branch from 3e8dc3f to ed07129 Compare April 11, 2026 18:03
@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling size: S and removed size: XS labels Apr 11, 2026
@BradGroux BradGroux force-pushed the fix/msteams-singletenant-jwt-64270 branch from f37fa12 to 7e381df Compare April 12, 2026 00:48
@openclaw-barnacle openclaw-barnacle Bot added size: XS and removed agents Agent runtime and tooling size: S labels Apr 12, 2026
@BradGroux BradGroux merged commit 7e6b4d7 into openclaw:main Apr 12, 2026
42 checks passed
trudbot pushed a commit to trudbot/openclaw that referenced this pull request Apr 12, 2026
TOMUIV pushed a commit to TOMUIV/openclaw that referenced this pull request Apr 14, 2026
lovewanwan pushed a commit to lovewanwan/openclaw that referenced this pull request Apr 28, 2026
ogt-redknie pushed a commit to ogt-redknie/OPENX that referenced this pull request May 2, 2026
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request May 9, 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 size: XS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] MS Teams SingleTenant bot: JWT validation fails (issuer + audience mismatch)

2 participants