Skip to content

fix(apps): log inbound activities at info, warn on missing Authorization#568

Merged
corinagum merged 3 commits into
mainfrom
cg/silent-401
May 21, 2026
Merged

fix(apps): log inbound activities at info, warn on missing Authorization#568
corinagum merged 3 commits into
mainfrom
cg/silent-401

Conversation

@corinagum

@corinagum corinagum commented May 8, 2026

Copy link
Copy Markdown
Collaborator

Summary

Cross-SDK: equivalent fix filed for teams.py (microsoft/teams.py#425).

Test plan

  • npx turbo build --filter=@microsoft/teams.apps
  • npx jest in packages/apps (257/257 pass)
  • npx eslint src/http/http-server.ts (clean)
  • Reviewer eyeball: confirm log message wording

Copilot AI review requested due to automatic review settings May 8, 2026 21:02
…zation header

Inbound activities only logged at debug, and the missing-Authorization-header
path returned 401 with no log line at all. At default info level this made it
impossible to tell "request never arrived" from "request arrived and was
silently 401'd by the SDK." Adds an info-level entry log on every inbound and
a warn log when rejecting for a missing Authorization header.

Refs #564.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR improves diagnostics in @microsoft/teams.apps HTTP ingress by adding higher-visibility logs around inbound activity handling and the “missing Authorization header” rejection path, reducing cases where a silent 401 makes it hard to determine whether requests reached the SDK.

Changes:

  • Log every inbound activity at info level in HttpServer.handleRequest (type + id).
  • Log a warn when rejecting an inbound activity due to a missing Authorization header in authorize.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/apps/src/http/http-server.ts Outdated
…ype/id

Addresses Copilot review feedback on #568:
- Activity type/id come from the untrusted request body before auth runs.
  Strip control characters and cap length before interpolating into log
  lines so an attacker cannot forge multi-line log entries.
- Include type/id on the missing-Authorization-header warn, so users running
  at WARN level can correlate the rejection with a specific activity without
  needing the preceding info entry.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@corinagum
corinagum marked this pull request as draft May 8, 2026 21:45
Per review feedback: the info-level entry log on every inbound activity is
redundant with the existing debug log at the same site, and operators who
want diagnostic visibility into "did the request reach the SDK" can already
get it by flipping the logger to debug. The genuinely new diagnostic value
is the warn on the missing-Authorization-header path, which is silent at
every log level today; that stays.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@corinagum
corinagum merged commit 1ebe996 into main May 21, 2026
7 checks passed
@corinagum
corinagum deleted the cg/silent-401 branch May 21, 2026 14:18
corinagum added a commit to microsoft/teams.py that referenced this pull request May 21, 2026
…ion (#425)

## Summary
- Add a warn-level log on the missing-or-malformed Bearer token branch,
replacing a previously silent 401.
- Cross-SDK consistency fix: same diagnostic gap exists in teams.ts
(companion PR: microsoft/teams.ts#568).

## Test plan
- [x] `uv run poe check` (ruff format + ruff check, all pass)
- [x] `uv run pyright src/microsoft_teams/apps/http/http_server.py` (0
errors)
- [x] `uv run poe test` (580/580 pass)
- [ ] Reviewer eyeball: confirm log message wording

---------

Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
corinagum added a commit that referenced this pull request May 27, 2026
## Summary

Brings `origin/main` into `release` for the **2.0.12** release. **No
carve-outs this time** — Quoted Replies is included.

`version.json`: `2.0.12-preview.{height}` → `2.0.12`.

Aligns with teams.py 2.0.12 (PR #442 already on PyPI / pending publish).

## What's in this release (delta from 2.0.11)

**Features**
- Quoted Replies + new quotes features — previously held back via the
2.0.11 carve-out (#576)
- SuggestedActionSubmitActivity for `suggestedAction/submit` invoke
(#591)
- Default targeted replies for targeted inbound messages (#592)
- Filter colliding keys before `Object.assign` in `ActivityContext`
(#596)
- Prompt Preview support (#536)
- A2A sample (#584)
- AI/MCPClient (#572)
- Allow passing custom HTTP client via `AppOptions`-equivalent
- Reactions API marked GA (#575), Rename `ReactionClient.remove()` →
`delete()` (#567)

**Security & fixes**
- Security hardening: tighten cross-origin policies (#595)
- Lock JsonWebToken trust-boundary contract (#586)
- `fix(deps)`: npm audit fix — clears all high-severity advisories
(#599)
- `fix(apps)`: log inbound activities at info, warn on missing
Authorization (#568)
- `fix`: App user-agent merging (#573)
- `fix`: Add null checks in `local-memory.ts` to prevent role crash
(#438)
- `fix`: `@microsoft/teams.client` import error in webpack 5 (#566)
- Switch to named imports without subpaths (#561)

**Deprecations / package changes**
- Deprecate `DevtoolsPlugin` in favor of Microsoft 365 Agents Playground
(#593)
- Remove in-repo Teams CLI package (#580) — moved to
`teams-sdk/packages/cli`
- Deprecate AI Libraries (#588)
- Correct imports + return types in misc. packages (#589)

**Dependency bumps**
- turbo 2.8.11 → 2.9.14 (#587)
- qs 6.15.0 → 6.15.2 (#594)
- hono 4.12.14 → 4.12.16 (#562)
- npm audit fix bundle (#599): axios 1.13.5 → 1.16.1, fast-uri 3.1.0 →
3.1.2, ws 8.19.0 → 8.21.0, @azure/msal-node hoisted 5.2.2, uuid 11.1.0 →
11.1.1, @azure/identity 4.13.0 → 4.13.1, express-rate-limit, ip-address,
brace-expansion, etc.

## Quoted Replies inclusion notes

- Teams client rendering is in-sync with the wire format as of
2026-05-06.
- APX QR rollout completed: Public 2026-04-10, GCCH/DoD/Gallatin
2026-04-14.
- No SDK-side carve-outs needed; this matches the teams.py 2.0.12 (PR
#442) decision.

## Branch structure note

`prep-release/2.0.12` is reset to `origin/main` + a one-line
`version.json` bump. Diff against `release` (this PR) shows the full
delta from 2.0.11. We deliberately did not use a 2-parent merge commit —
the auto-merge tried to interleave non-overlapping hunks from main's QR
additions with release's QR carve-outs in `activity.ts`, producing a
semantically broken file. Reset-to-main + version bump is the clean way
to express "release should equal main."

## Test plan

- [x] `npm install` clean (post-audit-fix lockfile)
- [x] `npm run build` — 33/33 targets clean
- [x] `npm test` — 14/14 task targets, 279+ tests pass
- [x] E2E echo bot smoke test against `cg-test-bot-py` via canary ABS —
done on `cg/audit-deps-ts` (now merged); covers axios + msal-node code
paths
- [ ] Pipeline Build + Test stages green on `release` after merge
- [ ] Publish pipeline run with **Public** → ESRP → npm
`@microsoft/teams.*@2.0.12`
- [ ] Smoke install: `npm view @microsoft/teams[email protected]` after
publish
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.

3 participants