fix(msteams): route file.download.info links via graph shares#85845
fix(msteams): route file.download.info links via graph shares#85845IWhatsskill wants to merge 1 commit into
Conversation
|
Codex review: needs real behavior proof before merge. Reviewed June 24, 2026, 12:17 PM ET / 16:17 UTC. Summary PR surface: Source +1, Tests +33. Total +34 across 2 files. Reproducibility: yes. at source level. Current main treats Review metrics: 1 noteworthy metric.
Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Proof guidance:
Mantis proof suggestion Risk before merge
Maintainer options:
Next step before merge
Security Review detailsBest possible solution: Keep the narrow resolver/test change, require redacted live Teams/SharePoint proof, and clarify the Do we have a high-confidence way to reproduce the issue? Yes, at source level. Current main treats Is this the best way to solve the issue? Yes for the code shape. Reusing AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 3217165be770. Label changesLabel justifications:
Evidence reviewedPR surface: Source +1, Tests +33. Total +34 across 2 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
|
|
ClawSweeper PR egg 🎁 Pass real behavior proof to wake the egg and unlock a hatchable treat. Where did the egg go?
|
|
This assigned pull request has been automatically marked as stale after being open for 27 days. |
Summary
application/vnd.microsoft.teams.file.download.infoattachments can expose SharePoint/OneDrivedownloadUrlvalues that require Graph auth, but the download path used those URLs directly.downloadUrlvalues through the existing Graph shares URL helper before downloading.resolveDownloadCandidate()now appliestryBuildGraphSharesUrlForSharedLink()tofile.download.infodownloadUrlvalues, and a regression test locks the Graph-only allowlist/auth path.Motivation
contentUrlpath.Change Type (select all)
Scope (select all touched areas)
Linked Issue/PR
Real behavior proof (required for external PRs)
Behavior or issue addressed: MSTeams
file.download.infoSharePoint/OneDrivedownloadUrlattachments now resolve throughhttps://graph.microsoft.com/v1.0/shares/.../driveItem/contentinstead of trying to fetch the raw SharePoint URL directly.Real environment tested: Disposable OpenClaw checkout on a Linux testserver under
/root/openclaw-pr-tests/runs/2026-05-23-msteams-download-info-67177/repo, basef6204d081fc35574c86c0df36fed0cced43db8ef, Nodev22.22.2, pnpm11.2.2.Exact steps or command run after this patch:
node scripts/run-vitest.mjs extensions/msteams/src/attachments.test.ts -t 'routes file.download.info SharePoint downloadUrl through Graph shares endpoint'node scripts/run-vitest.mjs extensions/msteams/src/attachments.test.ts extensions/msteams/src/attachments/shared.test.tscorepack pnpm exec oxfmt --check --threads=1 extensions/msteams/src/attachments/download.ts extensions/msteams/src/attachments.test.tspnpm check:changed --base origin/maingit diff --checkEvidence after fix (screenshot, recording, terminal capture, console output, redacted runtime log, linked artifact, or copied live output): Copied terminal output from the disposable OpenClaw checkout after applying this patch:
Observed result after fix: The regression run saved a PDF media item from the MSTeams attachment path. Every fetched URL started with
https://graph.microsoft.com/v1.0/shares/, and the Graph token provider was called. The raw SharePoint host was not fetched in the Graph-only allowlist/auth setup.What was not tested: A live Teams tenant and real SharePoint file download were not replayed. This PR does not claim to fix unrelated inline image or broader DM media-drop paths.
Before evidence (optional but encouraged): Copied terminal output from the same disposable checkout with only the new regression test applied to the old production code:
Root Cause (if applicable)
resolveDownloadCandidate()had already learned to normalize SharePoint/OneDrive sharedcontentUrlvalues through Graph shares, but theapplication/vnd.microsoft.teams.file.download.infobranch returnedcontent.downloadUrldirectly.file.download.infoattachment where onlygraph.microsoft.comwas allowed/authenticated and the sourcedownloadUrlwas a SharePoint shared link.contentUrlpath, but the Teams-specificdownloadUrlbranch remained outside that guardrail.Regression Test Plan (if applicable)
extensions/msteams/src/attachments.test.tsfile.download.infoattachment with a SharePointdownloadUrlshould be rewritten to the Graph shares endpoint, use Graph auth, and save the downloaded document media.contentUrl, not thefile.download.infodownloadUrlbranch.User-visible / Behavior Changes
MSTeams DM file attachments that arrive as
file.download.infowith SharePoint/OneDrive download URLs can now download through the existing Graph shares flow when Graph auth is configured, producing actual inbound media instead of only a placeholder.Diagram (if applicable)
Security Impact (required)
Yes/No) NoYes/No) NoYes/No) YesYes/No) NoYes/No) NoYes, explain risk + mitigation: Eligible Teams file download links are normalized to the existing Graph shares content endpoint instead of the raw SharePoint/OneDrive URL. This reuses the existing Graph auth fallback and existing media host allowlist/auth-allowlist checks; it does not introduce a new token source or broaden file access beyond the configured Graph permissions.Repro + Verification
Environment
v22.22.2, pnpm11.2.2graph.microsoft.comfor the download path.Steps
file.download.infoattachment carrying a SharePointdownloadUrl.downloadUrlvalues through Graph shares.Expected
file.download.infoSharePoint/OneDrivedownloadUrlis fetched through the Graph shares endpoint with Graph auth and produces a stored document media item.Actual
Evidence
Attach at least one:
The required copied terminal output is included directly in the
Real behavior proofsection above so the PR-body gate can evaluate it.Human Verification (required)
What you personally verified (not just CI), and how:
Review Conversations
No review conversations exist yet for this new draft PR.
Compatibility / Migration
Yes/No) YesYes/No) NoYes/No) NoRisks and Mitigations
downloadUrlshape not represented by the regression fixture.downloadUrlwhen the URL cannot be converted.file.download.infodownloadUrlbranch and does not claim broader inline image coverage.