Skip to content

[PM-40460] feat: Enforce Send type restriction via Send Controls policy - #2909

Open
matt-livefront wants to merge 2 commits into
matt/PM-40248-send-controls-access-controlsfrom
matt/PM-40460-send-controls-restrict-send-type
Open

[PM-40460] feat: Enforce Send type restriction via Send Controls policy#2909
matt-livefront wants to merge 2 commits into
matt/PM-40248-send-controls-access-controlsfrom
matt/PM-40460-send-controls-restrict-send-type

Conversation

@matt-livefront

@matt-livefront matt-livefront commented Jul 24, 2026

Copy link
Copy Markdown
Collaborator

🎟️ 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 sendControls policy via a new allowedSendTypes data key: an array of SendType raw 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 consolidated SendPolicyOptions (#2877) and the access-control enforcement added in #2906.

📸 Screenshots

Text Only File Only Both
send.text.only.mov
send.file.only.mov
send.both.mov

@matt-livefront
matt-livefront requested a review from a team as a code owner July 24, 2026 16:23
@matt-livefront matt-livefront added ai-review Request a Claude code review t:feature labels Jul 24, 2026
@github-actions github-actions Bot added the app:password-manager Bitwarden Password Manager app context label Jul 24, 2026
@github-actions

github-actions Bot commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

🤖 Bitwarden Claude Code Review

Overall Assessment: APPROVE

Re-reviewed after 71faad8, which closes the share-extension gap raised in the previous pass. AddEditSendItemProcessor.loadData() now blocks creating a Send whose type conflicts with sendPolicyOptions.enforcedSendType for non-edit modes, shows Alert.sendTypeRestrictedByPolicy(_:action:), and routes to .cancel (which dismisses the extension via AppCoordinator.sendItemCancelled()); edit mode is intentionally exempt so Sends created before the policy remain editable. The feature-flag gate stays in PolicyService.getSendPolicyOptions(), so enforcedSendType is nil when sendControls is off, and the earlier SendPolicyOptions/sendListPublisher(includeTypesSection:)/SendListView work is unchanged and still covered by tests for raw-value mapping, empty/duplicate/unknown values, and multi-policy resolution.

Code Review Details

No findings.

Notes considered and intentionally not raised as findings:

  • The early return in loadData() skips hasPremium and refreshProfileState(), but the only reachable next step is the alert's single OK action navigating to .cancel, so the partially loaded state is never used.
  • Blocking on loadData() rather than in saveSendItem() leaves a theoretical window if the policy changes while the add screen is open; the same pattern is already used for enforcedAccessType, and the server enforces the policy on create.

@codecov

codecov Bot commented Jul 24, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 79.58%. Comparing base (c47e0a2) to head (71faad8).
⚠️ Report is 2 commits behind head on matt/PM-40248-send-controls-access-controls.

Additional details and impacted files
@@                               Coverage Diff                               @@
##           matt/PM-40248-send-controls-access-controls    #2909      +/-   ##
===============================================================================
+ Coverage                                        79.37%   79.58%   +0.21%     
===============================================================================
  Files                                             1172     1170       -2     
  Lines                                            74950    75321     +371     
===============================================================================
+ Hits                                             59492    59947     +455     
+ Misses                                           15458    15374      -84     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@matt-livefront
matt-livefront force-pushed the matt/PM-40460-send-controls-restrict-send-type branch from 091707b to 5f54987 Compare August 3, 2026 21:42
Comment thread BitwardenShared/UI/Tools/Send/Send/SendList/SendListState.swift

@fedemkr fedemkr left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks good, the only doubt I have is the same as Claude here https://github.com/bitwarden/ios/pull/2909/changes#r3707928082 on the Share extension.

@github-actions github-actions Bot added the app:authenticator Bitwarden Authenticator app context label Aug 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai-review Request a Claude code review app:authenticator Bitwarden Authenticator app context app:password-manager Bitwarden Password Manager app context t:feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants