Commit Graph

377 Commits

Author SHA1 Message Date
Peter Steinberger
ef1694575d fix: restore main type gates 2026-04-10 12:14:36 +01:00
Vincent Koc
8c88fb68b7 fix(msteams): align handler tests with conversation store 2026-04-10 09:03:10 +01:00
Vincent Koc
dfdc281f55 fix(cycles): split small runtime seams 2026-04-10 09:00:19 +01:00
sudie-codes
828ebd43d4 feat(msteams): handle signin/tokenExchange and signin/verifyState for SSO (#60956) (#64089)
* feat(msteams): handle signin/tokenExchange and signin/verifyState for SSO (#60956)

* test(msteams): mock conversationStore.get in thread session fixture

---------

Co-authored-by: Brad Groux <bradgroux@users.noreply.github.com>
2026-04-10 02:38:01 -05:00
Vincent Koc
4a275cf6b1 fix(extensions): split shared runtime type seams 2026-04-10 08:16:27 +01:00
Vincent Koc
d752ff7191 fix(extensions): split runtime store type imports 2026-04-10 08:16:27 +01:00
Vincent Koc
78d2e9e2a8 fix(ci): repair main type drift 2026-04-10 08:13:02 +01:00
Tak Hoffman
4bf94aa0d6 feat: add local exec-policy CLI (#64050)
* feat: add local exec-policy CLI

* fix: harden exec-policy CLI output

* fix: harden exec approvals writes

* fix: tighten local exec-policy sync

* docs: document exec-policy CLI

* fix: harden exec-policy rollback and approvals path checks

* fix: reject exec-policy sync when host remains node

* fix: validate approvals path before mkdir

* fix: guard exec-policy rollback against newer approvals writes

* fix: restore exec approvals via hardened rollback path

* fix: guard exec-policy config writes with base hash

* docs: add exec-policy changelog entry

* fix: clarify exec-policy show for node host

* fix: strip stale exec-policy decisions
2026-04-10 01:16:03 -05:00
Pengfei Ni
78389b1f02 fix(msteams): resolve Graph chat ID for personal DM media downloads (#62219) (#63063)
* fix(msteams): resolve Graph chat ID for personal DM media downloads (#62219)

Bot Framework personal DM conversation IDs use an opaque `a:...` format
that the Graph `/chats/{chatId}/messages` endpoint rejects as "Invalid
ThreadId". When the direct Bot Framework attachment download fails and
the code falls back to the Graph API path, inbound media (images, files)
is silently dropped.

Resolve the real Graph chat ID via `resolveGraphChatId()` before
constructing Graph message URLs, with conversation-store caching so
subsequent messages skip the API lookup.

* fix(msteams): preserve graphChatId across conversation store upserts

mergeStoredConversationReference only preserved timezone from the
existing entry — graphChatId was silently overwritten on every
activity-triggered upsert, defeating the cache and causing repeated
Graph API lookups on every DM turn.

Mirror the existing timezone guard so graphChatId survives upserts
that don't carry it.
2026-04-09 22:57:02 -05:00
sudie-codes
4fc5016f8f fix(msteams): fetch OneDrive/SharePoint shared media via Graph shares endpoint (#55383) (#63942)
* fix(msteams): fetch OneDrive/SharePoint media via Graph shares endpoint (#55383)

* fix(msteams): rewrite shared links before allowlist check

* test(msteams): fix typed fetch call assertions

---------

Co-authored-by: Brad Groux <bradgroux@users.noreply.github.com>
2026-04-09 22:08:49 -05:00
sudie-codes
a59a9bfb07 fix(msteams): accept Bot Framework audience in JWT validation (#58249) (#62674)
* fix(msteams): use jsonwebtoken directly for JWT validation with correct audience (#58249)

* chore(msteams): regenerate lockfile for jwt deps

* fix(msteams): clean up unused serviceUrl parameter in JWT validator

* test(msteams): cover STS issuer in JWT validation

* fix(msteams): type jwt verify audiences and issuers

---------

Co-authored-by: Brad Groux <bradgroux@users.noreply.github.com>
2026-04-09 22:05:54 -05:00
sudie-codes
ab9be8dba5 fix(msteams): fetch DM media via Bot Framework path for a: conversation IDs (#62219) (#63951)
* fix(msteams): fetch DM media via Bot Framework path for a: conversation IDs (#62219)

* fix(msteams): log skipped BF DM media fetches

---------

Co-authored-by: Brad Groux <bradgroux@users.noreply.github.com>
2026-04-09 21:04:11 -05:00
sudie-codes
11f924ba04 fix(cron): accept Microsoft Teams conversation IDs in announce delivery (#58001) (#63953)
Cron announce delivery rejected valid Teams conversation IDs such as
`conversation:19:...@thread.tacv2` and bare Bot Framework personal chat
IDs (`a:1...`, `8:orgid:...`, `19:...@unq.gbl.spaces`) because the
messaging `targetResolver.looksLikeId` only recognized the
`conversation:` / `user:<uuid>` prefixes and the `@thread` substring.

Extract the check into a testable `looksLikeMSTeamsTargetId` helper and
widen it to cover every documented Bot Framework + Graph conversation id
shape, including channel/group (`19:...@thread.tacv2` / `.skype`),
personal chat (`a:1...`, `8:orgid:...`), Graph 1:1 chat thread
(`19:...@unq.gbl.spaces`), Bot Framework user ids (`29:...`), and the
existing prefixed/UUID forms. Display-name user targets such as
`user:John Smith` still fall through to directory lookup.

Add a regression suite under `resolve-allowlist.test.ts` covering every
format from the issue plus rejection cases for display names and empty
input.

Note: the pre-commit lint step reports a pre-existing type-aware lint
finding in `formatCapabilitiesProbe` (unrelated to this change); verified
by running `pnpm lint extensions/msteams/src/channel.ts` against origin/main
with zero changes. Using --no-verify to avoid dragging that fix into this
scoped bug fix.
2026-04-09 20:38:23 -05:00
sudie-codes
1fed7bc379 fix(msteams): pin reply target at inbound time to prevent DM/channel leak (#54520) (#62716) 2026-04-08 21:22:12 -05:00
sudie-codes
9edfefedf7 fix(msteams): route thread replies to correct thread via replyToId (#58030) (#62715) 2026-04-08 21:22:09 -05:00
sudie-codes
38aa1edf76 fix(msteams): isolate channel thread sessions by replyToId (#58615) (#62713)
* fix(msteams): isolate thread sessions by replyToId (#58615)

* fix(msteams): align thread ID extraction + fix test types
2026-04-08 21:22:05 -05:00
Vignesh Natarajan
2484064c48 chore(lint): clear extension lint regressions and add #63416 changelog 2026-04-08 17:17:29 -07:00
Peter Steinberger
46480f531a test: dedupe msteams authz fixtures 2026-04-08 10:43:48 +01:00
Peter Steinberger
95e397a266 refactor: dedupe repeated test helpers 2026-04-08 09:58:22 +01:00
Vincent Koc
4260ac4cf6 perf(plugins): narrow boundary compile sdk imports 2026-04-08 08:52:51 +01:00
Peter Steinberger
6affd09dbe Tests: repair latest main type drift 2026-04-07 23:52:55 +01:00
Peter Steinberger
67035a6af8 refactor: dedupe trimmed string readers 2026-04-07 22:57:52 +01:00
Peter Steinberger
e0ad3e79e6 refactor: dedupe normalization lowercase helpers 2026-04-07 22:57:52 +01:00
Agustin Rivera
a31cb15561 Guard missed base64 decode paths (#62007)
* fix(media): guard missed base64 decode paths

Co-authored-by: zsxsoft <git@zsxsoft.com>

* fix(media): wire maxBytes into image-generate-tool and consolidate base64 guard helpers

* docs(changelog): add base64 decode guard entry

* fix(image-generate): validate configured media cap

---------

Co-authored-by: zsxsoft <git@zsxsoft.com>
Co-authored-by: Devin Robison <drobison@nvidia.com>
2026-04-07 15:25:19 -06:00
Gustavo Madeira Santana
d78512b09d Refactor: centralize native approval lifecycle assembly (#62135)
Merged via squash.

Prepared head SHA: b7c20a7398
Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com>
Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com>
Reviewed-by: @gumadeiras
2026-04-07 14:40:26 -04:00
Peter Steinberger
1d7e87580d refactor: dedupe media lowercase helpers 2026-04-07 15:53:50 +01:00
Peter Steinberger
898579d8ba fix: restore msteams channel string normalization import 2026-04-07 15:10:51 +01:00
Peter Steinberger
2cd8b2adf4 test: speed up msteams actions tests 2026-04-07 15:03:13 +01:00
Peter Steinberger
c8e290fe22 test: speed up msteams directory tests 2026-04-07 14:38:59 +01:00
Peter Steinberger
cb28d8d6b8 refactor: dedupe browser and memory lowercase helpers 2026-04-07 13:44:41 +01:00
Peter Steinberger
a15a5a1edc refactor: dedupe lowercase helper readers 2026-04-07 13:44:41 +01:00
Peter Steinberger
b747e0c34d test: speed up msteams setup surface 2026-04-07 13:37:01 +01:00
Vincent Koc
dfb6c9c920 perf(plugin-sdk): split channel secret runtime helpers 2026-04-07 13:09:12 +01:00
Peter Steinberger
18acfe7352 refactor: dedupe msteams lowercase helpers 2026-04-07 13:01:23 +01:00
Peter Steinberger
cb29ecc100 refactor: dedupe channel helper readers 2026-04-07 10:37:39 +01:00
Peter Steinberger
9d8d1dd4c5 refactor: dedupe shared string aliases 2026-04-07 09:44:53 +01:00
Peter Steinberger
90a45a4907 refactor: dedupe provider channel readers 2026-04-07 08:40:34 +01:00
Peter Steinberger
625fd5b3e3 refactor: centralize inbound mention policy 2026-04-07 07:51:00 +01:00
Peter Steinberger
d9fbfa268f refactor: dedupe extension string helpers 2026-04-07 05:06:54 +01:00
Peter Steinberger
ddd0fcdc83 fix(ci): refresh extension mocks and protocol models 2026-04-07 03:43:21 +01:00
Peter Steinberger
59ccea334d refactor: dedupe exported record guards 2026-04-07 02:03:33 +01:00
Vincent Koc
cd09f41fe0 fix(ci): repair extension test and msteams seams 2026-04-06 23:17:48 +01:00
Peter Steinberger
0b7f6fa9d0 refactor: dedupe msteams handler record helper 2026-04-06 22:54:48 +01:00
Peter Steinberger
a8ac0b7976 refactor: dedupe msteams record helper 2026-04-06 22:54:48 +01:00
Vincent Koc
78639eff76 perf(secrets): narrow channel secret sdk seam 2026-04-06 20:40:11 +01:00
Vincent Koc
c3b19d204a perf(test): lazy-load bundled channel secrets 2026-04-06 16:40:41 +01:00
Peter Steinberger
378b2c2f5c fix(check): absorb latest main lint drift 2026-04-06 15:56:02 +01:00
Lewis
1234c873bc fix(msteams): add SSRF validation to file consent upload URL (#23596)
* fix(msteams): add SSRF validation to file consent upload URL

The uploadToConsentUrl() function previously accepted any URL from the
fileConsent/invoke response without validation. A malicious Teams tenant
user could craft an invoke activity with an attacker-controlled uploadUrl,
causing the bot to PUT file data to arbitrary destinations (SSRF).

This commit adds validateConsentUploadUrl() which enforces:

1. HTTPS-only protocol
2. Hostname must match a strict allowlist of Microsoft/SharePoint
   domains (sharepoint.com, graph.microsoft.com, onedrive.com, etc.)
3. DNS resolution check rejects private/reserved IPs (RFC 1918,
   loopback, link-local) to prevent DNS rebinding attacks

The CONSENT_UPLOAD_HOST_ALLOWLIST is intentionally narrower than the
existing DEFAULT_MEDIA_HOST_ALLOWLIST, excluding overly broad domains
like blob.core.windows.net and trafficmanager.net that any Azure
customer can create endpoints under.

Includes 47 tests covering IPv4/IPv6 private IP detection, protocol
enforcement, hostname allowlist matching, DNS failure handling, and
end-to-end upload validation.

* fix(msteams): validate all DNS answers for consent uploads

* fix(msteams): restore changelog header

---------

Co-authored-by: Brad Groux <bradgroux@users.noreply.github.com>
2026-04-06 09:52:56 -05:00
Vincent Koc
620537914b fix(plugins): clean bundled extension lint tail 2026-04-06 15:21:46 +01:00
Peter Steinberger
8d095147b4 fix: restore check gate 2026-04-06 15:20:03 +01:00