Skip to content

Security: lock JsonWebToken trust-boundary contract#586

Open
corinagum wants to merge 2 commits into
mainfrom
cg/jwt-trust-boundary
Open

Security: lock JsonWebToken trust-boundary contract#586
corinagum wants to merge 2 commits into
mainfrom
cg/jwt-trust-boundary

Conversation

@corinagum
Copy link
Copy Markdown
Collaborator

@corinagum corinagum commented May 20, 2026

Summary

Documents the layered authentication model the SDK uses for inbound JSON Web Tokens. TypeScript half of a 3-SDK PR set.

Why

Security scan finding "JsonWebToken No Signature Verification" flagged the JsonWebToken accessor class for decoding tokens without verifying signatures. A cross-SDK audit confirmed this is intentional architecture: signature verification runs at the HTTP boundary (JwtValidator.validateAccessToken in packages/apps/src/middleware/auth/), and the accessor exists as a typed view over already-validated payloads. Every consumer of decoded claims is downstream of a validator pass.

This PR makes the architectural invariant explicit at the constructor site so future readers (and the scanner on its next pass) see the design intent locally.

What

Contract docstring at JsonWebToken's constructor explaining that it performs no signature verification, where verification actually happens, and the rule that callers must not construct from raw network input.

What this does not change

  • No runtime behavior change. No signature verification added or removed.
  • No API surface change. JsonWebToken keeps its current name and shape (verified public on @microsoft/teams.api, so a rename would have been breaking).
  • No effect on the activity pipeline. Bot Framework JWT validation continues to happen via JwtValidator.validateAccessToken exactly as before.

Related PRs

@corinagum corinagum changed the title Security: lock JsonWebToken trust-boundary contract (#6 disposition) Security: lock JsonWebToken trust-boundary contract May 20, 2026
@corinagum corinagum marked this pull request as ready for review May 22, 2026 23:15
Copilot AI review requested due to automatic review settings May 22, 2026 23:15
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Documents the security/trust-boundary contract for JsonWebToken in @microsoft/teams.api, clarifying that it is a typed accessor over an already-validated JWT and does not itself perform signature or claim validation.

Changes:

  • Adds a constructor docstring to JsonWebToken describing the layered authentication model and explicitly stating that the class does not verify signatures or enforce token validity.
  • Points readers to the HTTP-boundary validator (JwtValidator.validateAccessToken) as the intended location for JWT validation.

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

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