[PM-40460] feat: Enforce Send type restriction via Send Controls policy - #2909
Conversation
🤖 Bitwarden Claude Code ReviewOverall Assessment: APPROVE Reviewed the enforcement of the restrict-Send-type option of the Send Controls policy. Code Review Details
Notes considered and intentionally not raised as findings:
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## matt/PM-40248-send-controls-access-controls #2909 +/- ##
===============================================================================
+ Coverage 79.37% 81.66% +2.28%
===============================================================================
Files 1172 1049 -123
Lines 74950 67675 -7275
===============================================================================
- Hits 59492 55264 -4228
+ Misses 15458 12411 -3047 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
091707b to
5f54987
Compare
| /// The single Send type the user is restricted to by policy, or `nil` if both types are | ||
| /// allowed. When set, the add-Send entry points open this type directly (bypassing the | ||
| /// text/file chooser) and the "Types" filter section is hidden. | ||
| var restrictedSendType: SendType? |
There was a problem hiding this comment.
❓ QUESTION: Is the share extension path intentionally left out of the type restriction?
Details
The restriction is resolved and applied only in SendListProcessor/SendListView, so the share-extension entry point still creates a Send of whichever type the shared content is. SendItemCoordinator.showAddItem(content:) sets state.type = .file for .file content and .text for .text content, and AddEditSendItemProcessor.loadData() applies sendPolicyOptions.enforcedAccessType but not enforcedSendType:
state.sendPolicyOptions = await services.policyService.getSendPolicyOptions()
if let enforcedAccessType = state.sendPolicyOptions.enforcedAccessType {
state.accessType = enforcedAccessType
}So a member restricted to text-only can still share a file through the iOS share sheet and save it as a file Send, while isSendDisabled and enforcedAccessType from the same policy are honored on that screen. If this is deferred to a follow-up ticket, no change needed here — just want to confirm it isn't an oversight.
🎟️ Tracking
PM-40460
📔 Objective
Enforce the new restrict Send type option of the Send Controls policy (
pm-31885-send-controls). When an organization restricts Send creation to a single type, non-owner/non-admin members should only be able to create that type — with no chooser to pick text vs. file — and the "Types" filter should disappear from the Send list.The policy is delivered on the existing
sendControlspolicy via a newallowedSendTypesdata key: an array ofSendTyperaw values (0= text,1= file).[0, 1](or a missing key) means both types are allowed;[0]restricts to text-only and[1]to file-only. This builds directly on the consolidatedSendPolicyOptions(#2877) and the access-control enforcement added in #2906.📸 Screenshots
send.text.only.mov
send.file.only.mov
send.both.mov