-
Notifications
You must be signed in to change notification settings - Fork 1.7k
[PM-32187] Add Send Type restriction to Send Controls policy #7504
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
mcamirault
wants to merge
63
commits into
main
Choose a base branch
from
tools/pm-32187/restrict-send-type-policy
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
63 commits
Select commit
Hold shift + click to select a range
2bb7c17
initial send controls
harr1424 6f51c42
update vNext methods and add test coverage for policy validators
harr1424 94b7025
Merge branch 'main' into tools/PM-31885-SendControls-Policy
harr1424 7c4c042
Merge remote-tracking branch 'origin/main' into tools/PM-31885-SendCoβ¦
harr1424 bcc2960
add comments to tests
harr1424 1f7caf8
Merge branch 'main' into tools/PM-31885-SendControls-Policy
harr1424 d52424c
Apply suggestion from @mkincaid-bw
harr1424 235d832
renamne migrations for correct sorting
harr1424 e6bf8e6
Merge branch 'tools/PM-31885-SendControls-Policy' of github.com:bitwaβ¦
harr1424 b0af868
Merge branch 'main' into tools/PM-31885-SendControls-Policy
harr1424 4a0728c
respond to csharp related review comments
harr1424 16cffeb
fix failing lints
harr1424 ea8527e
fix tests
harr1424 783b426
revise policy sync logic
harr1424 f8bbfa0
revise policy event logic and tests
harr1424 5022841
Merge branch 'main' into tools/PM-31885-SendControls-Policy
harr1424 9b1b7e7
Merge branch 'tools/PM-31885-SendControls-Policy' of github.com:bitwaβ¦
harr1424 a6ea853
add integration tests
harr1424 e6c1f11
Merge branch 'main' into tools/PM-31885-SendControls-Policy
harr1424 ac6710d
OR legacy policy data with SendControls policy data
harr1424 c739d52
Merge branch 'main' into tools/PM-31885-SendControls-Policy
harr1424 8bc9f7d
remove migrations and associated integration test
harr1424 26baa10
Merge branch 'main' into tools/PM-31885-SendControls-Policy
harr1424 b544964
whitespacing and comment correction
harr1424 50fdaf2
aggregate kegacy Send policies in PolicyQuery and adjust PoliciesContβ¦
harr1424 84d0cd1
add comments to simplify post-migration cleanup
harr1424 f27e358
consolidate legacy Send policy synthesis from PoliciesController intoβ¦
harr1424 1f54881
respond to review comments and other minor fixes
harr1424 f779c2f
Merge branch 'main' into tools/PM-31885-SendControls-Policy
harr1424 d3cf561
[PM-31884] Add Send control policy access control fields
mcamirault 697bae2
Disable and enable Sends based on policy compliance
mcamirault b23c233
Merge branch 'main' into tools/pm-31884/send-access-controls-policy
mcamirault 947c3b5
Remove stray merge change
mcamirault 657ee7d
Address PR comments
mcamirault 2bafe52
More PR comment fixes
mcamirault c43c079
Adjust email domain restriction logic, consolidate into a function
mcamirault c4e326c
More PR comment fixes
mcamirault f3a4f16
Fix data migration and sproc files
mcamirault 3a53965
Even out database load by fetching all org Send IDs and processing inβ¦
mcamirault f0d09f5
Merge branch 'main' into tools/pm-31884/send-access-controls-policy
mcamirault 44dd3cd
Fix tests and address review comments
mcamirault 72a8b71
[PM-32187] Add Send Type restriction to Send Controls policy
mcamirault 9e68219
Fix Send Type check breaking reenabling behavior
mcamirault 0732302
Merge branch 'main' into tools/pm-31884/send-access-controls-policy
mcamirault 425b7b5
Merge branch 'main' into tools/pm-31884/send-access-controls-policy
mcamirault 183816b
More PR comment fixes
mcamirault a27de12
Merge branch 'main' into tools/pm-31884/send-access-controls-policy
mcamirault f567d52
Fix data migration script order
mcamirault 9cb87f2
Lint fixes
mcamirault f3b4404
Address a few review comments
mcamirault 85e412c
Fix migration script
mcamirault e7fbf37
Merge branch 'main' into tools/pm-31884/send-access-controls-policy
mcamirault ee4c853
Merge branch 'main' into tools/pm-31884/send-access-controls-policy
mcamirault c55aa58
Merge branch 'tools/pm-31884/send-access-controls-policy' into tools/β¦
mcamirault 1436fb2
Fix data protection merge bug
mcamirault 8a5b35a
Merge branch 'tools/pm-31884/send-access-controls-policy' into tools/β¦
mcamirault d768e97
Merge branch 'main' into tools/pm-31884/send-access-controls-policy
mcamirault 3b628bd
Update date of data migration file
mcamirault 5ee54bb
Merge branch 'tools/pm-31884/send-access-controls-policy' into tools/β¦
mcamirault bb074e8
Merge branch 'main' into tools/pm-32187/restrict-send-type-policy
mcamirault c358aaa
Fix merge conflicts, tests, update approach to storing Send type restβ¦
mcamirault f00128d
Address review comments, formatting issues, duplicate migration script
mcamirault 9aa50d9
Add update script for Send_ReadIdsByOrganizationId proc
mcamirault File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -19,7 +19,7 @@ BEGIN | |
|
|
||
| INSERT INTO @UserIds | ||
| SELECT DISTINCT | ||
| UserId | ||
| [UserId] | ||
| FROM | ||
| [dbo].[Send] | ||
| WHERE | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am not certain if this file should be checked in |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
util/Migrator/DbScripts/2026-06-22_00_UpdateSendReadIdsByOrgId.sql
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| CREATE OR ALTER PROCEDURE [dbo].[Send_ReadIdsByOrganizationId] | ||
| @OrganizationId UNIQUEIDENTIFIER | ||
| AS | ||
| BEGIN | ||
| SET NOCOUNT ON | ||
|
|
||
| -- Get the IDs of all users in an org -- | ||
| DECLARE @OrgUserIds AS [GuidIdArray]; | ||
| INSERT INTO @OrgUserIds | ||
| SELECT DISTINCT | ||
| [UserId] | ||
| FROM | ||
| [dbo].[OrganizationUserView] | ||
| WHERE | ||
| [OrganizationId] = @OrganizationId | ||
| AND [UserId] IS NOT NULL | ||
|
|
||
| -- Get the IDs of all Sends associated with those users -- | ||
| SELECT | ||
| [Id] | ||
| FROM | ||
| [dbo].[SendView] | ||
| WHERE | ||
| [UserId] IN (SELECT [Id] FROM @OrgUserIds) | ||
| END | ||
| GO |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
β»οΈ DEBT: New
AllowedSendTypescreation-time guard has no unit test.Details
This branch is the bypass-resistant server-side enforcement (the CLI skips front-end checks), so it is the most important path to cover. The sync handler's equivalent logic got a test in this PR (
SendControlsSyncPolicyEventTests), butSendValidationServiceTests.cshas no case asserting that a disallowedsend.Typethrows and an allowed one passes.Project convention (
CLAUDE.md): "ALWAYS add unit tests (with mocking) for any new feature development." Suggest adding aValidateUserCanSaveAsync_WhenSendTypeRestrictedByPolicytest mirroring the existing domain/auth cases.