Skip to content

Commit b34f34f

Browse files
committed
Document Mail.Send mailbox scoping
1 parent db0c278 commit b34f34f

1 file changed

Lines changed: 44 additions & 1 deletion

File tree

README.md

Lines changed: 44 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,11 +92,54 @@ The repository includes a GitHub Actions workflow for Azure Static Web Apps. Pus
9292

9393
Required deployment values should be stored as Azure Static Web Apps application settings or GitHub environment secrets, not in source control.
9494

95+
## Mail.Send Scoping
96+
97+
Microsoft Graph `Mail.Send` application permission is tenant-wide by default: without additional Exchange Online controls, an app with this permission may be able to send as any mailbox in the tenant.
98+
99+
Production deployments should restrict the app to the configured sender mailbox with an Exchange Online application access policy:
100+
101+
```powershell
102+
Connect-ExchangeOnline -UserPrincipalName admin@example.org
103+
104+
$appId = "<graph-client-id>"
105+
$senderMailbox = "sender@example.org"
106+
$scopeAddress = "capresponseform-mailsend-scope@example.org"
107+
108+
New-DistributionGroup `
109+
-Name "CAPResponseForm Mail.Send Scope" `
110+
-Alias "CAPResponseForm-MailSend-Scope" `
111+
-Type Security `
112+
-PrimarySmtpAddress $scopeAddress
113+
114+
Add-DistributionGroupMember `
115+
-Identity $scopeAddress `
116+
-Member $senderMailbox `
117+
-BypassSecurityGroupManagerCheck
118+
119+
New-ApplicationAccessPolicy `
120+
-AppId $appId `
121+
-PolicyScopeGroupId $scopeAddress `
122+
-AccessRight RestrictAccess `
123+
-Description "Restrict CAPResponseForm Mail.Send to the configured sender mailbox."
124+
```
125+
126+
Verify the effective scope with `Test-ApplicationAccessPolicy`:
127+
128+
```powershell
129+
Test-ApplicationAccessPolicy -AppId $appId -Identity $senderMailbox
130+
Test-ApplicationAccessPolicy -AppId $appId -Identity someone-else@example.org
131+
```
132+
133+
Expected results:
134+
135+
- The configured sender mailbox returns `Granted`.
136+
- A mailbox outside the scope group returns `Denied`.
137+
95138
## Security Notes
96139

97140
- Do not commit `api/local.settings.json`.
98141
- Do not commit Graph client secrets, Turnstile secret keys, deployment tokens, or mailbox credentials.
99-
- Restrict the Microsoft Graph mail application to the smallest practical mailbox scope.
142+
- Restrict the Microsoft Graph mail application to the smallest practical mailbox scope with an Exchange Online application access policy.
100143
- Use email override settings for testing in non-production environments.
101144
- Review public examples and tests before adding real personal addresses or tenant-specific values.
102145

0 commit comments

Comments
 (0)