Skip to content

fix(teams): authenticate protected inline attachments - #749

Open
onmax wants to merge 2 commits into
vercel:mainfrom
onmax:agent/authenticate-teams-inline-attachments
Open

fix(teams): authenticate protected inline attachments#749
onmax wants to merge 2 commits into
vercel:mainfrom
onmax:agent/authenticate-teams-inline-attachments

Conversation

@onmax

@onmax onmax commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Summary

Authenticates connector-hosted Teams inline attachments through the configured Bot Framework client, so message.attachments[].fetchData() can retrieve protected content. Teams file download cards use their direct content.downloadUrl anonymously, and serialized attachments reconstruct the same routing during rehydration.

Bot credentials are limited to non-redirecting HTTPS requests whose origin exactly matches the Activity connector origin. Cross-origin URLs, HTTP URLs, and file-card download URLs never enter the authenticated client path.

File-card MIME inference covers common image and text formats plus PDF, XLS, and XLSX attachments.

The implementation follows Microsoft's inline-image access-token sample and Teams file-card contract.

Test plan

  • pnpm validate
  • pnpm --filter @chat-adapter/teams test — 20 files and 257 tests passed
  • pnpm --filter @chat-adapter/teams typecheck
  • pnpm --filter @chat-adapter/teams... build
  • Coverage includes authenticated same-origin retrieval with redirects disabled, anonymous file-card/cross-origin/HTTP retrieval, PDF/XLS/XLSX and leading-dot MIME inference, bot and anonymous rehydration, invalid metadata failing closed, and the existing protected fetch override

Possible follow-up

Evaluate image-meta for consolidating image type and dimension detection from downloaded bytes across adapters. It does not replace this adapter's pre-fetch authentication routing or its PDF/Excel file-card MIME inference, so this PR deliberately adds no dependency or lockfile change.

Checklist

  • All commits are signed and verified
  • All commits are signed off for the DCO (git commit -s)
  • pnpm validate passes
  • Changeset added (or N/A — see CONTRIBUTING.md)
  • Documentation updated (or N/A)

Signed-off-by: onmax <maximogarciamtnez@gmail.com>
@vercel

vercel Bot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

@onmax is attempting to deploy a commit to the Vercel Team on Vercel.

A member of the Team first needs to authorize it.

Signed-off-by: onmax <maximogarciamtnez@gmail.com>
@onmax
onmax marked this pull request as ready for review July 28, 2026 06:07
@onmax
onmax requested a review from a team as a code owner July 28, 2026 06:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant