Commit Graph

7066 Commits

Author SHA1 Message Date
Justin Baur
8b2ea6614a Make Setup testable and add test for install 2026-04-10 13:21:27 -04:00
Rui Tomé
3dd72f6118 [PM-22450] Bump Collection.RevisionDate on edits and access changes (#7380)
* Fix UpdateCollectionCommand to set RevisionDate using TimeProvider and update corresponding tests. Adjust tests to verify correct RevisionDate assignment during collection updates.

* Enhance BulkAddCollectionAccessCommand to include revision date in access updates. Update ICollectionRepository and its implementations to accept revision date parameter. Modify stored procedure to update collection revision dates accordingly. Add tests to verify correct behavior of access creation and revision date updates.

* Update GroupRepository and stored procedures to bump RevisionDate for affected collections during group creation and updates. Enhance integration tests to verify that collection revision dates are correctly updated when groups are created or modified.

* Implement revision date updates for affected collections in OrganizationUserRepository and related stored procedures. Add integration tests to ensure revision dates are correctly bumped during organization user creation and updates.

* Update database migration script

* Update migration script summary

* Refactor OrganizationUserReplaceTests to create collection first

* Refactor stored procedures to use Common Table Expressions (CTEs) for updating RevisionDate of affected collections. This change improves readability and maintainability by consolidating the logic for identifying affected collections in Group_UpdateWithCollections and OrganizationUser_UpdateWithCollections procedures.

* Enhance OrganizationUser_CreateManyWithCollectionsAndGroups stored procedure to accept RevisionDate parameter for updating affected collections. Update OrganizationUserRepository to utilize the provided RevisionDate when available, ensuring accurate revision date management during organization user operations.

* Refactor OrganizationUser_CreateManyWithCollectionsGroups and migration script to utilize temporary table for CollectionUser data insertion. This change improves performance and maintains consistency in updating RevisionDate for affected collections.

* Refactor OrganizationUserRepository to consistently use RevisionDate from created OrganizationUsers when updating affected collections. This change enhances the accuracy of revision date management across the repository.

* Refactor tests to ensure consistent handling of RevisionDate across Group and Collection repositories. Update assertions to compare RevisionDate directly, improving accuracy in revision date management during tests.

* Restore BOM in Group_UpdateWithCollections and OrganizationUser_UpdateWithCollections

* Refactor GroupRepository and OrganizationUserRepository to improve handling of RevisionDate. Updated collection filtering logic to use HashSet for efficiency and ensured that affected collections are filtered by OrganizationId, enhancing accuracy in revision date management.

* Bump migration script date

* Remove internal set from RevisionDate on Group and OrganizationUser

The Dapper repositories use a System.Text.Json serialize/deserialize
round-trip to build *WithCollections objects. System.Text.Json silently
skips properties with non-public setters, so RevisionDate was reverting
to DateTime.UtcNow instead of preserving the value set in C#.

* Refactor OrganizationUser_CreateManyWithCollectionsGroups and migration script to improve the logic for updating RevisionDate. The update now uses INNER JOINs to ensure accurate filtering of collections based on OrganizationId and CollectionUser data, enhancing the precision of revision date management.

* Fix sprocs styling

* Added early return to OrganizationUserRepository.CreateManyAsync if the supplied parameter is empty
2026-04-10 07:27:27 +01:00
Jared
5dbfa77395 Add new feature flag for Policy Drawers (pm-34804) in Constants.cs (#7429) 2026-04-09 17:24:37 -04:00
Jared
b3c8950838 [PM-26383] Remove feature flag from server-side for autoconfirm (#7402)
* Refactor organization user confirmation logic by removing direct feature flag checks. Updated related commands and tests to utilize policy requirements instead of feature service checks for automatic user confirmation. Cleaned up organization form view by simplifying checkbox rendering for automatic user confirmation.

* Refactor ProviderService to remove feature service dependency for automatic user confirmation. Updated logic to streamline policy requirement checks and cleaned up related tests by removing unnecessary feature flag assertions.

* Enhance tests for automatic user confirmation policy requirements. Updated multiple test classes to include checks for `AutomaticUserConfirmationPolicyRequirement`, ensuring no auto-confirm restrictions are applied by default. Refactored related assertions in `AcceptOrgUserCommandTests`, `ConfirmOrganizationUserCommandTests`, `RestoreOrganizationUserCommandTests`, and others to streamline compliance validation logic.

* Enhance tests for automatic user confirmation policy across multiple test classes. Added checks for `AutomaticUserConfirmationPolicyRequirement` in `ConfirmOrganizationUserCommandTests`, `RestoreOrganizationUserCommandTests`, and `SelfHostedOrganizationSignUpCommandTests`, ensuring compliance validation logic is streamlined and consistent. Updated assertions to reflect new policy requirements.

* Implement mock for AutomaticUserConfirmationPolicyRequirement in ProviderServiceTests to enhance test coverage for user confirmation policies.

* Update ProviderServiceTests to include mocks for AutomaticUserConfirmationPolicyRequirement, enhancing test coverage for user acceptance scenarios.

* Refactor test method names in EmergencyAccessServiceTests for clarity by removing feature flag references, improving readability and maintainability of the test suite.
2026-04-09 12:56:23 -04:00
renovate[bot]
69ed2dbd4f [deps]: Update docker/login-action action to v4 (#7346)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-04-09 17:39:04 +02:00
Kyle Denney
bd7e8bb248 [PM-31894] remove storage reconciliation job and flags (#7424) 2026-04-09 10:08:03 -05:00
Stephon Brown
4883d4995e chore(mail): update 'renewal' to 'subscription' in Families email subject (#7406) 2026-04-09 10:31:13 -04:00
Rui Tomé
e10b13f0eb [PM-34178] Add entities, repository and database migrations for Organization Invite Link feature (#7407)
* Add feature flag for Organization Invite Links

* Add OrganizationInviteLink database entity

* Add OrganizationInviteLink table sql script and also OrganizationInviteLinkView that reads from it

* Add OrganizationInviteLink stored procedures for CRUD operations

* Add SQL migration script

* Add EF migrations

* Add EF configurations

* Add IOrganizationInviteLinkRepository and integration tests

* Add OrganizationInviteLinkRepository Dapper implementation

* refactor(tests): Update OrganizationInviteLinkRepositoryTests to use [Theory] attribute for test cases
2026-04-09 15:22:38 +01:00
Jimmy Vo
45ac58b7b5 [PM-34146] Add GetManyConfirmedAcceptedByUserIdAsync(Guid userId) to the IPolicyRepository interface (#7392) 2026-04-09 10:21:09 -04:00
Thomas Rittson
9ceab46d2d Remove missed uses of PolicyRequirements flag (#7426)
This is being used for the RequireSso policy only.
This commit removes the remaining other references.
2026-04-09 07:18:06 -07:00
renovate[bot]
65defa6b24 [deps] DbOps: Update dbup-sqlserver to v7 (#7218)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: rkac-bw <148072202+rkac-bw@users.noreply.github.com>
2026-04-09 08:02:09 -06:00
Jimmy Vo
a29fe6f922 [PM-33044] Provider Ability Refactor EventService (#7411) 2026-04-09 09:48:25 -04:00
renovate[bot]
98fc94653b [deps] DbOps: Update Microsoft.Data.SqlClient to v7 (#7344)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: rkac-bw <148072202+rkac-bw@users.noreply.github.com>
2026-04-09 07:28:27 -06:00
Vijay Oommen
aff701b3c0 PM-33194 single integration of a type only (#7280) 2026-04-09 08:14:42 -05:00
John Harrington
ebbf6dd0fa [PM-34383] Add import validation allowing providers to perform imports (#7394)
* resolve auth bypass and enable nullable (tech debt)

* fix failing test
2026-04-08 14:44:17 -07:00
Patrick-Pimentel-Bitwarden
7c4fa752c7 fix(change-email): [PM-34742] Change Email Sets Salt (#7422)
* fix(change-email): [PM-34742] Change Email Sets Salt (#7422) - Fixed email and salt being able to be separated. Added test to confirm rollback on stripe failure.
2026-04-08 17:26:39 +00:00
Jordan Aasen
49e08254a2 add feature flag (#7412) 2026-04-08 09:27:44 -07:00
Jared
ea32fd1642 refactor(UsersController): Remove unused feature service and simplify revoke user logic (#7397)
* Removed references to IFeatureService and IRevokeOrganizationUserCommand from UsersController.
* Simplified the logic for revoking users by directly using IRevokeOrganizationUserCommandV2.
* Updated unit tests to reflect the removal of feature flag checks for SCIM revoke functionality.
2026-04-08 11:21:08 -04:00
Patrick-Pimentel-Bitwarden
fc0ce255af Revert "fix(change-email): [PM-34742] Change Email Sets Salt (#7413)" (#7421)
This reverts commit 13eecfd605.
2026-04-08 11:05:57 -04:00
Patrick-Pimentel-Bitwarden
74c4aced74 fix(refactor): [PM-34246] Rename Set Password to Finalize Onboarding (#7328)
* fix(refactor): [PM-34246] Rename Set Password to Finalize Onboarding - Initial set of renames take two.

* fix(refactor): [PM-34246] Rename Set Password to Finalize Onboarding - Updated function name.

* fix(refactor): [PM-34246] Rename Set Password to Finalize Onboarding - Fixed test.

* fix(refactor): [PM-34246] Rename Set Password to Finalize Onboarding - Unborked tests.

* fix(refactor): [PM-34246] Rename Set Password to Finalize Onboarding - Changed test names.
2026-04-08 11:00:17 -04:00
Jared McCannon
eb251d9bf8 Removing not scim check from api-key and rotate-api-key (#7403) 2026-04-08 09:58:58 -05:00
Alex Morask
a5052d8d0f fix(billing): skip ended schedule phases when updating storage (#7420) 2026-04-08 09:51:03 -05:00
sven-bitwarden
54023cac9a [PM-33213] Remove FeatureFlag Around ResetPassword && PolicyRequirements (#7188)
* Remove policy requirement feature flags around ResetPassword policyˆ

* Remove unused elements

* Remove unused elements

* Remove more unused elements

* More unused elements!

* remove policy requirement for organizationscontroller

* Fix test to revert to PolicyQuery

* Remove unused code

* Restore PolicyQuery for OrganizationService

* Add TODOs indicating why we are staying on policyquery
2026-04-08 09:44:55 -05:00
Jared McCannon
076032954c Adding feature flag (#7401) 2026-04-08 09:20:06 -05:00
Graham Walker
f6e858b296 PM-34686 initial commmit (#7398) 2026-04-08 07:43:05 -05:00
Patrick Honkonen
fdb4bb4630 [PM-34171] Add mobile card scanner feature flag (#7310) 2026-04-08 08:31:19 -04:00
Patrick-Pimentel-Bitwarden
13eecfd605 fix(change-email): [PM-34742] Change Email Sets Salt (#7413)
* fix(change-email): [PM-34742] Change Email Sets Salt - Fixed prelogin to respond back with salt data coming from database.

* fix(change-email): [PM-34742] Change Email Sets Salt - Fixed change email.

* test(change-email): [PM-34742] Change Email Sets Salt - Updated and added more tests
2026-04-07 18:47:19 -04:00
Jordan Aasen
d038dfa261 [PM-33500] - delete attachments from deleted ciphers (#7208)
* delete attachments from deleted ciphers

* add DeleteAttachmentsForOrganizationAsync to cipher service. update specs

* fix test

* only grab cipherId for attachments deletion

* add missing directive

---------

Co-authored-by: SmithThe4th <gsmith@bitwarden.com>
2026-04-07 21:12:59 +00:00
Alex Morask
aa1aa58190 fix(billing): use top-level ProrationBehavior on schedule updates for immediate storage invoicing (#7410) 2026-04-07 15:09:21 -05:00
renovate[bot]
13a9866cdb [deps] Billing: Update Kralizek.AutoFixture.Extensions.MockHttp to 2.2.1 (#6556)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-04-07 15:08:49 -05:00
Vijay Oommen
226828f296 PM-34391 fixes to eventsController (#7405) 2026-04-07 13:43:54 -05:00
Rui Tomé
cc596d8ad7 [PM-34177] Fix feature flag key value for Organization Invite Links (#7409)
* [PM-34177] Fix feature flag key value for Organization Invite Links

* Rename feature flag key for Organization Invite Links to Generate Invite Link
2026-04-07 19:21:19 +01:00
Alex Morask
c04ee9c0a9 fix(billing): handle cross-product Phase 2 price overlay for Families 2019 (#7408) 2026-04-07 12:32:51 -05:00
Rui Tomé
1ece1145e3 [PM-34177] Add feature flag for Organization Invite Links (#7404) 2026-04-07 18:12:28 +01:00
adudek-bw
3fb16705c3 Add SDK Sends API feature flag (#7254) 2026-04-07 11:36:34 -04:00
renovate[bot]
4bed21d1ea [deps] Billing: Update swashbuckle-aspnetcore monorepo to 10.1.7 (#7008)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-04-07 09:38:14 -05:00
Rui Tomé
c277637312 [PM-29152] Rename VNextSavePolicyCommand to SavePolicyCommand and remove deprecated policy interfaces (#7364)
* Remove deprecated ISavePolicyCommand interface and SavePolicyCommand implementation along with associated tests

* Refactor policy validation: remove IPolicyValidator interface and related implementations. Update PolicyServiceCollectionExtensions to eliminate deprecated methods. Adjust policy validator classes to remove IPolicyValidator dependency and streamline validation methods.

* Remove IPostSavePolicySideEffect interface and its implementation from the policy validation framework.

* Rename VNextSavePolicyCommand to SavePolicyCommand

* Continue renaming VNextSavePolicyCommand

* Refactor policy validation tests to use SavePolicyModel in ValidateAsync and side effect methods

* Refactor policy validators to directly use PolicyUpdate from SavePolicyModel in validation and side effect methods, improving code clarity and reducing method complexity.

* Rename test methods in PoliciesControllerTests and VerifyOrganizationDomainCommandTests to better reflect their functionality, enhancing clarity and consistency across the test suite.

* Refactor OrganizationUserNotificationPolicyValidator by removing unused methods and simplifying the implementation. Update corresponding tests to reflect these changes.

* Remove unnecessary nullable enable directives from policy validator files and update using statements for consistency.

* Rename policy validators to handlers

* dotnet format
2026-04-07 13:03:13 +01:00
Vijay Oommen
8d00c2bb45 PM-34230 server side constant for feature flag (#7395) 2026-04-06 16:36:01 -05:00
Thomas Rittson
963c160999 [PM-34595] Add provider authorization attributes (#7389)
Introduces declarative authorization pattern for Provider-based endpoints
following the same approach as the existing Organization authorization
infrastructure. No production code behavior changes — handler and
requirements are registered but not yet wired to any controllers.

New:
- IProviderRequirement: base interface for provider authorization requirements
- ProviderRequirementHandler: central handler that resolves provider claims
  from route/context and delegates to requirement implementations
- ProviderClaimsExtensions: helpers to parse provider membership from claims
- ProviderAdminRequirement, ProviderUserRequirement, ManageProviderUsersRequirement
- HttpContextExtensions.GetProviderId(): route param helper (mirrors GetOrganizationId)
- DI registration for ProviderRequirementHandler
- Unit tests for all new types
2026-04-07 07:34:03 +10:00
Alex Morask
e758ca2e27 fix(billing): display Phase 2 prices and discount on org subscription page (#7393) 2026-04-06 14:15:20 -05:00
gitclonebrian
eb3700afcc moved image tag max length logic out of conditional block. now applies in all scenarios (#7396) 2026-04-06 18:51:02 +00:00
Daniel James Smith
2c9be6fa4c [PM-34456] Innovation Sprint: Enable generating automated release notes (#7362)
* Enable generating automated release notes

* Update release.yml template

---------

Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com>
2026-04-06 20:08:24 +02:00
Brandon Treston
ecac34bc18 [PM-22525] Log when provider admin accesses an org vault (#7379)
* log when provider admin accesses an org vault

* cleanup whitespace

* more whitespace clean up
2026-04-06 12:17:30 -04:00
Github Actions
0a15a68c63 Bumped version to 2026.4.0 2026-04-06 15:56:58 +00:00
Alex Morask
c4f9ad79a9 fix(billing): prevent stale schedule discount after Stripe deletion (#7391) 2026-04-06 10:54:28 -05:00
Dave
93604aae8f fix(emergency-access): [PM-33788] EF Emergency Access Query Updates
* feat(emergency-access) [PM-33788] Update expired recoveries query.

* feat(emergency-access) [PM-33788] Update many to notify query.

* test(emergency-access) [PM-33788] Update integration tests for recovery time.
2026-04-05 14:43:13 -04:00
Nik Gilmore
2b7ba20487 [PM-28190] Add pm-28190-cipher-sharing-ops-to-sdk Feature Flag (#6887) 2026-04-03 10:44:46 -07:00
Conner Turnbull
6eb0c3c3ef Include schedule Phase 2 discount in premium tax estimate preview (#7385)
When a subscription has an active schedule during the ~15-day window before
renewal, the invoice preview for tax estimation was built with the new price
but without the Phase 2 discount coupon. This caused the estimated tax on the
subscription page to be higher than what Stripe would actually charge.

Pass the coupon ID from the schedule's Phase 2 discount through to
EstimatePremiumTaxAsync so it is included in the InvoiceCreatePreviewOptions.
2026-04-03 10:41:33 -04:00
Matt Gibson
5596ffce0d [pm-34486] require basic auth on seeder api endpoints (#7368)
* [pm-34486] require basic auth on seeder api endpoints

* Fixup tests with basic auth
2026-04-03 07:22:23 +02:00
renovate[bot]
0cb7417824 [deps]: Update prettier to v3.8.1 (#6702)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Vicki League <vleague@bitwarden.com>
2026-04-02 14:41:42 -04:00