Skip to content

feat(den): add Microsoft 365 permission parity - #2700

Merged
benjaminshafii merged 7 commits into
different-ai:devfrom
reachjalil:feature/microsoft-365-permission-parity
Jul 13, 2026
Merged

benjaminshafii merged 7 commits into
different-ai:devfrom
reachjalil:feature/microsoft-365-permission-parity

Conversation

@reachjalil

@reachjalil reachjalil commented Jul 13, 2026 •

Copy link
Copy Markdown
Member

Manager summary

Microsoft 365 previously exposed only three fixed read options in OpenWork: Outlook mail, calendar, and OneDrive. Administrators could not configure the broader capability choices available in the Google Workspace connector, and connected members did not have an end-to-end permission upgrade path for those capabilities.

This draft adds a Google-style progressive permission picker for Microsoft 365. The existing three read permissions remain the safe defaults. Calendar event creation, Outlook draft management, OneDrive writing and broader file access, and Teams chat capabilities are explicit administrator opt-ins.

The branch is intentionally still a draft. The implementation is safe enough to review and build on, while live-tenant verification of the expanded permissions can continue before approval.

What was there before

  • Three Microsoft 365 feature keys were defined locally in the UI and Den.
  • The setup dialog was labeled read-only and always showed the same three choices.
  • Den implemented read operations for Outlook mail, calendar, and OneDrive.
  • Reconnect checks required exact scope strings, so a stronger granted scope could incorrectly look incomplete.
  • The deterministic Microsoft mock covered the original read journey only.

What this adds

Administrator permission picker

Area User-facing choice Delegated Microsoft Graph scope
Calendar Read Outlook calendar Calendars.Read
Calendar Create and manage calendar events Calendars.ReadWrite
Outlook Create and manage email drafts Mail.ReadWrite
Outlook Read Outlook mail Mail.Read
OneDrive Read OneDrive files Files.Read
OneDrive Create and update OneDrive files Files.ReadWrite
OneDrive Read all files the member can access Files.Read.All
OneDrive Full access to files the member can access Files.ReadWrite.All
Teams Read Teams chats Chat.Read
Teams Send Teams chat messages Chat.Read and ChatMessage.Send

User.Read remains part of base sign-in. Exact scopes and the broader consequences of Microsoft read/write permissions are shown in the setup dialog.

Implemented operations

  • Create an Outlook draft. This does not send mail.
  • Create a calendar event. Adding attendees can send invitations through Microsoft Graph.
  • Create or replace a bounded text file at a OneDrive path.
  • List existing Teams chats and messages.
  • Send a message to an existing Teams chat. This does not create a new chat.

Permission enforcement

Each operation verifies all of these boundaries before Microsoft Graph is called:

  1. The organization administrator enabled the feature.
  2. The calling member connected their own Microsoft account.
  3. The member grant contains the required scope or a documented stronger scope.
  4. The Den MCP token has the existing read or write authority required by the HTTP method.

Stronger Microsoft scopes now satisfy their narrower equivalents. For example, Mail.ReadWrite satisfies Mail.Read and Files.ReadWrite.All satisfies the narrower file scopes. This prevents false reconnect warnings while preserving fail-closed checks for missing consent.

Reconnect behavior

Permission-only updates retain the encrypted tenant client credentials. Members whose existing grant does not cover the new selection see Reconnect to grant new permissions. The next authorization request contains the newly selected delegated scopes.

What testing found and fixed

The proof work found four development-test gaps in addition to the product changes:

  • The shared browser sign-in helper still assumed email and password appeared on one screen. It now supports the current email-first flow.
  • The local task runner dropped the Microsoft mock endpoint variables. They are now explicitly passed through, preventing an automated test from accidentally opening the public Microsoft authority.
  • The Entra mock returned the original read scopes after a permission upgrade. It now binds the requested scopes to the authorization code and returns the correct expanded grant.
  • Local Den could advertise its OAuth callback with 127.0.0.1 even though the Entra development app was registered with localhost. The standard local runner now explicitly publishes http://localhost:<api-port> as its browser-facing API origin while retaining 127.0.0.1 for internal service traffic. This prevents Azure AADSTS50011 redirect URI mismatch failures without changing production public-origin configuration.

The Microsoft Graph mock now covers read and mutation endpoints so the verification exercises actual Den-to-Graph request shapes rather than only checking UI state.

Verification completed

  • 22 focused Microsoft provider, route, Graph-client, and permission-picker tests passed with 94 assertions.
  • 9 native-provider connection and reconnect tests passed with 21 assertions against the isolated Den database.
  • Shared types build passed.
  • Den API TypeScript check passed.
  • Den Web TypeScript check passed.
  • Den API production build passed.
  • Den Web production build passed.
  • Root application TypeScript check passed.
  • A live local sign-in confirmed both the provider configuration and the generated Microsoft authorization URL use the exact callback http://localhost:33925/v1/oauth-providers/microsoft-365/connect/callback.
  • The six-frame Microsoft 365 browser proof passed before the final rebase. It covered safe defaults, mock OAuth, bounded Outlook/calendar/OneDrive reads, permission persistence, reconnect, every newly enabled mock operation, disconnect, and fail-closed behavior.
  • The branch rebased cleanly onto the latest upstream dev with no conflicts. Focused tests, typechecks, and production builds were repeated after the rebase.

Per the review plan, the full browser story was not replayed again after the clean rebase. That detailed replay can be performed during the next verification stage.

Important boundaries before approval

  • The expanded consent and write operations have not yet been verified against a real customer Microsoft 365 tenant in this PR.
  • Microsoft write scopes are broader than the narrow OpenWork operation names. The UI calls this out, and Den still limits the operations it exposes.
  • Sending Outlook mail is not included; only draft creation is included.
  • Creating a Teams chat is not included; sending is limited to an existing chat.
  • Microsoft selected-file permissions require separate resource assignment and are not represented as equivalent to Google Drive selected-file access.
  • Application-only Microsoft Graph permissions and tenant-wide administration are out of scope. This remains delegated, per-member access.

Proposed review and rollout

  1. Review the permission names, exact scopes, and warning copy.
  2. Verify consent and reconnect with a controlled Entra test tenant.
  3. Exercise each selected operation with a dedicated test account and disposable data.
  4. Confirm the resulting audit and user experience with maintainers.
  5. Keep this PR draft until those live checks are understood and accepted.

This PR targets dev directly and is designed to remain independently reviewable while the other MCP diagnostic branches are verified and merged.

@vercel

vercel Bot commented Jul 13, 2026 •

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
openwork-landing Ready Ready Preview, Comment, Open in v0 Jul 13, 2026 3:19am

@vercel

vercel Bot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

@reachjalil is attempting to deploy a commit to the Different AI Team on Vercel.

A member of the Team first needs to authorize it.

reachjalil and others added 5 commits July 12, 2026 19:50
* feat(mcp): add enterprise mock foundation artifacts

* chore(mcp): wire enterprise mock workspaces

* ci(mcp): enforce enterprise mock checks

* fix(mcp): emit a truly invalid schema fault

* feat(mcp): configure exact mock OAuth redirects

* feat(mcp): strengthen mock OAuth verification

* fix(mcp): accept Azure localhost OAuth callbacks

* fix(mcp): close mock sockets across scenario restarts

* fix(mcp): make mock listener restarts explicit
* fix(oauth): surface safe token exchange failures

* test(oauth): use synthetic provider diagnostics
* feat(mcp): add enterprise MCP client package

* refactor(mcp): harden enterprise client contracts

* fix(mcp): preserve the first failing request phase

---------

Co-authored-by: Benjamin Shafii <[email protected]>
# Conflicts:
#	ee/apps/den-api/test/microsoft-365-provider-scopes.test.ts
@reachjalil
reachjalil marked this pull request as ready for review July 13, 2026 03:22
@benjaminshafii
benjaminshafii merged commit 752d610 into different-ai:dev Jul 13, 2026
11 checks passed
@reachjalil
reachjalil deleted the feature/microsoft-365-permission-parity branch July 17, 2026 07:06

This branch was successfully deployed

1 active deployment
Preview – openwork-landing — 8d8dc953 Deployed Jul 13, 2026 by vercel[bot]
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.

2 participants