Commit graph

1246 commits

Author SHA1 Message Date
Todd Martin
94cd6fbff6
chore(flags): [PM-28337] Remove account recovery permission feature flag
Some checks are pending
Collect code references / Check for secret access (push) Waiting to run
Collect code references / Code reference collection (push) Blocked by required conditions
Scan / Check PR run (push) Waiting to run
Scan / Checkmarx (push) Blocked by required conditions
Scan / Sonar (push) Blocked by required conditions
Testing / Run tests (push) Waiting to run
* Removed pm-24425-send-2fa-failed-email

* Remove feature flag

* Linting

* Removed tests and cleaned up comment.
2026-01-11 12:04:10 -05:00
Ike
5320878295
[PM-25949] ExternalCallback Integration tests for SSO Project (#6809)
Some checks are pending
Collect code references / Check for secret access (push) Waiting to run
Collect code references / Code reference collection (push) Blocked by required conditions
Scan / Sonar (push) Blocked by required conditions
Scan / Check PR run (push) Waiting to run
Scan / Checkmarx (push) Blocked by required conditions
Testing / Run tests (push) Waiting to run
* feat: add new integration test project

* test: add factory for SSO application; ExternalCallback integration tests.

* test: modified Integration tests to use seeded data instead of service substitutes with mocked responses, where possible.

* fix: re-organize projects in solution. SsoFactory now in its owning project with SSO integration test which match the integration test factory pattern more closely.

* claude: better naming of class fields.
2026-01-10 09:02:50 -05:00
cyprain-okeke
e705fe3f3f
[PM-29598] Create Subscription Upgrade Endpoint (#6787)
Some checks are pending
Collect code references / Check for secret access (push) Waiting to run
Collect code references / Code reference collection (push) Blocked by required conditions
Scan / Check PR run (push) Waiting to run
Scan / Checkmarx (push) Blocked by required conditions
Scan / Sonar (push) Blocked by required conditions
Testing / Run tests (push) Waiting to run
* Add the ticket implementation

* Add the unit test

* Fix the lint and test issues

* resolve pr comments

* Fix the error on the test file

* Review suggestion and fixes

* resolve the api access comments

* Gte the key from the client

* Add the gateway type as stripe

* Address the legacy plans issues

* Resolve the misunderstanding

* Add additional storage that we will need if they revert

* Add the previous premium UserId
2026-01-09 16:34:06 +01:00
Jimmy Vo
b1cf59b1bf
[PM-27882] Fix the subject line. (#6818) 2026-01-09 10:04:52 -05:00
Maciej Zieniuk
2e92a53f11
[PM-27281] Support v2 account encryption on JIT master password signups (#6777)
Some checks failed
Collect code references / Check for secret access (push) Waiting to run
Collect code references / Code reference collection (push) Blocked by required conditions
Scan / Sonar (push) Blocked by required conditions
Scan / Check PR run (push) Waiting to run
Scan / Checkmarx (push) Blocked by required conditions
Testing / Run tests (push) Waiting to run
Database testing / Run tests (push) Has been cancelled
Database testing / Run validation (push) Has been cancelled
Database testing / Validate new migration naming and order (push) Has been cancelled
* V2 prep, rename existing SSO JIT MP command to V1

* set initial master password for account registraton V2

* later removel docs

* TDE MP onboarding split

* revert separate TDE onboarding controller api

* Server side hash of the user master password hash

* use `ValidationResult` instead for validation errors

* unit test coverage

* integration test coverage

* update sql migration script date

* revert validate password change

* better requests validation

* explicit error message when org sso identifier invalid

* more unit test coverage

* renamed onboarding to set, hash naming clarifications

* update db sql script, formatting

* use raw json as request instead of request models for integration test

* v1 integration test coverage

* change of name
2026-01-09 09:17:45 +01:00
Alex Morask
6d69c9bb99
Make PayPalIPNTransactionModel currency culture invariant (#6811) 2026-01-08 08:40:45 -06:00
Jordan Aasen
02c03f4493
[PM-27884][PM-27886][PM-27885] - Add Cipher Archives (#6578)
Some checks failed
Collect code references / Check for secret access (push) Waiting to run
Collect code references / Code reference collection (push) Blocked by required conditions
Scan / Check PR run (push) Waiting to run
Scan / Checkmarx (push) Blocked by required conditions
Scan / Sonar (push) Blocked by required conditions
Testing / Run tests (push) Waiting to run
Database testing / Run tests (push) Has been cancelled
Database testing / Run validation (push) Has been cancelled
Database testing / Validate new migration naming and order (push) Has been cancelled
* add Archives column to ciphers table

* add archives column

* update cipher archive/unarchive and cipher deatils query

* add migrations

* add missing migrations

* fixes

* update tests. cleanup

* syntax fix

* fix sql syntax

* fix sql

* fix CreateWithCollections

* fix sql

* fix migration file

* fix migration

* add go

* add missing go

* fix migrations

* add missing proc

* fix migrations

* implement claude suggestions

* fix test

* update cipher service and tests

* updates to soft delete

* update UserCipherDetailsQuery and migration

* update migration

* update archive ciphers command to allow org ciphers to be archived

* updates to archivedDate

* revert change to UserCipherDetails

* updates to migration and procs

* remove archivedDate from Cipher_CreateWithCollections

* remove trailing comma

* fix syntax errors

* fix migration

* add double quotes around datetime

* fix syntax error

* remove archivedDate from cipher entity

* re-add ArchivedDate into cipher

* fix migration

* do not set Cipher.ArchivedDate in CipherRepository

* re-add ArchivedDate until removed from the db

* set defaults

* change to CREATE OR ALTER

* fix migration

* fix migration file

* quote datetime

* fix existing archiveAsync test. add additional test

* quote datetime

* update migration

* do not wrap datetime in quotes

* do not wrap datetime in quotes

* fix migration

* clean up archives and archivedDate from procs

* fix UserCipherDetailsQuery

* fix setting date in JSON_MODIFY

* prefer cast over convert

* fix cipher response model

* re-add ArchivedDate

* add new keyword

* remove ArchivedDate from entity

* use custom parameters for CipherDetails_CreateWithCollections

* remove reference to archivedDate

* add missing param

* add missing param

* fix params

* fix cipher repository

* fix migration file

* update request/response models

* update migration

* remove Archives from Cipher_CreateWithCollections

* revert last change

* clean up

* remove comment

* remove column in migration

* change language in drop

* wrap in brackets

* put drop column in separate migration

* remove archivedDate column

* re-add archivedDate

* add refresh module

* bump migration name

* fix proc and migration

* do not require edit permission for archiving ciphers

* do not require edit permission for unarchiving ciphers
2026-01-07 09:29:10 -08:00
cd-bitwarden
afd47ad085
[SM-1570] Adding new item to organization license to disable SM ads for users (#6482)
* Adding new item to organization license

* fixing whitespace issues

* fixing missing comment

* fixing merge conflicts

* merge fix

* db merge fixes

* fix

* Updating SM to Sm, and adding more view refreshes

* fixing merge conflicts

* Redoing migration

* Update OrganizationLicense.cs

* Update OrganizationLicense.cs

* fixes

* fixes

* fixing db issues

* fix

* rearranging sql after merge conflicts

* Merge conflicts with dbscripts are fixed, adding missing usedisableSMadsForUsers where needed

* removing incorrect merge fix

* fixes

* adding feature flag to disable sm ads

---------

Co-authored-by: Conner Turnbull <cturnbull@bitwarden.com>
2026-01-07 09:42:10 -07:00
Kyle Denney
3f2ee5b029
[PM-30460] update storage job to also update database max storage (#6803)
* [PM-30460] update storage job to also update database max storage

* dry run logs

* more logging fixes and pr feedback, forgot sql scripts

* claude feedback

* pr feedback, redesign of entity id reverse lookup

* claude feedback
2026-01-07 10:38:27 -06:00
Jimmy Vo
63784e1f5f
[PM-27882] Add SendOrganizationConfirmationCommand (#6743) 2026-01-06 16:43:36 -05:00
Stephon Brown
530d946857
[PM-29061] Remove Feature Flag 24996 (#6744)
* refactor(billing): Remove flag uses

* refactor(billing): remove redundant endpoint

* chore(billing): remove the flag

* fix(billing): revert changes

* Revert "fix(billing): revert changes"

This reverts commit 92271b380c.

* test(billing): update tests
2026-01-06 20:51:43 +00:00
Rui Tomé
1b17d99bfd
[PM-29555] Add self-revoke endpoint for declining organization data ownership policy (#6739)
* Add OrganizationUser_SelfRevoked event type to EventType enum

* Add SelfRevokeOrganizationUserCommand implementation and interface for user self-revocation from organizations

* Add unit tests for SelfRevokeOrganizationUserCommand to validate user self-revocation logic, including success scenarios and various failure conditions.

* Add ISelfRevokeOrganizationUserCommand registration to OrganizationServiceCollectionExtensions for user self-revocation functionality

* Add self-revoke user functionality to OrganizationUsersController with new endpoint for user-initiated revocation

* Add integration tests for self-revoke functionality in OrganizationUsersController, covering scenarios for eligible users, non-members, and users with owner/admin roles.

* Add unit test for SelfRevokeOrganizationUserCommand to validate behavior when a user attempts to self-revoke without confirmation. This test checks for a BadRequestException with an appropriate message.

* Add MemberRequirement class for organization membership authorization

- Implemented MemberRequirement to check if a user is a member of the organization.
- Added unit tests for MemberRequirement to validate authorization logic for different user types.

* Update authorization requirement for self-revoke endpoint and add integration test for provider users

- Changed authorization attribute from MemberOrProviderRequirement to MemberRequirement in the RevokeSelfAsync method.
- Added a new integration test to verify that provider users who are not members receive a forbidden response when attempting to revoke themselves.

* Add EligibleForSelfRevoke method to OrganizationDataOwnershipPolicyRequirement

- Implemented the EligibleForSelfRevoke method to determine if a user can self-revoke their data ownership based on their membership status and policy state.
- Added unit tests to validate the eligibility logic for confirmed, invited, and non-policy users, as well as for different organization IDs.

* Refactor self-revoke user command to enhance eligibility checks

- Updated the SelfRevokeOrganizationUserCommand to utilize policy requirements for determining user eligibility for self-revocation.
- Implemented checks to prevent the last owner from revoking themselves, ensuring organizational integrity.
- Modified unit tests to reflect changes in eligibility logic and added scenarios for confirmed owners and admins.
- Removed deprecated policy checks and streamlined the command's dependencies.

* Use CommandResult pattern in self-revoke command

* Clearer documentation
2026-01-06 11:25:14 +00:00
Vincent Salucci
35868c2a65
[PM-22434] Remove CreateDefaultLocation feature flag references (#6758)
Some checks are pending
Collect code references / Check for secret access (push) Waiting to run
Collect code references / Code reference collection (push) Blocked by required conditions
Scan / Check PR run (push) Waiting to run
Scan / Checkmarx (push) Blocked by required conditions
Scan / Sonar (push) Blocked by required conditions
Testing / Run tests (push) Waiting to run
* chore: remove ff ref from PoliciesController

* chore: remove ff ref from OrganizationExportController, refs PM-22434

* chore: remove ff ref from CiphersController, refs PM-22434

* chore: remove ff ref from ConfirmOrganizationUserCommand, refs PM-22434

* chore: remove ff refs from OrganizationDataOwnershipPolicyValidator, refs PM-22434

* chore: remove ff ref from OrganizationUserControllerTests, refs PM-22434

* chore: remove ff refs from ConfirmOrganizationUserCommandTests, refs PM-22434

* chore: remove ff refs from OrganizationDataOwnershipPolicyValidatorTests, refs PM-22434

* chore: format, refs PM-22434
2026-01-05 17:27:17 -06:00
cyprain-okeke
76a8f0fd95
[PM 29610]Update Account Storage Endpoint (#6750)
* update account storage endpoint

* Fix the failing test

* Added flag and refactor base on pr comments

* fix the lint error

* Resolve the pr comments

* Fix the failing test

* Fix the failing test

* Return none

* Resolve the lint error

* Fix the failing test

* Add the missing test

* Formatting issues fixed
2026-01-05 10:52:52 -06:00
✨ Audrey ✨
484a8e42dc
[PM-21918] update send api models to support new email field (#5895)
Some checks failed
Database testing / Run tests (push) Has been cancelled
Database testing / Run validation (push) Has been cancelled
Database testing / Validate new migration naming and order (push) Has been cancelled
Collect code references / Check for secret access (push) Has been cancelled
Scan / Check PR run (push) Has been cancelled
Testing / Run tests (push) Has been cancelled
Collect code references / Code reference collection (push) Has been cancelled
Scan / Checkmarx (push) Has been cancelled
Scan / Sonar (push) Has been cancelled
* update send api models to support new `email` field

* normalize authentication field evaluation order

* document send response converters

* add FIXME to remove unused constructor argument

* add FIXME to remove unused constructor argument

* introduce `tools-send-email-otp-listing` feature flag

* add `ISendOwnerQuery` to dependency graph

* fix broken tests

* added AuthType prop to send related models with test coverage and debt cleanup

* dotnet format

* add migrations

* dotnet format

* make SendsController null safe (tech debt)

* add AuthType col to Sends table, change Emails col length to 4000, and run migrations

* dotnet format

* update SPs to expect AuthType

* include SP updates in migrations

* remove migrations not intended for merge

* Revert "remove migrations not intended for merge"

This reverts commit 7df56e346a.

undo migrations removal

* extract AuthType inference to util method and remove SQLite file

* fix lints

* address review comments

* fix incorrect assignment and adopt SQL conventions

* fix column assignment order in Send_Update.sql

* remove space added to email list

* assign SQL default value of NULL to AuthType

* update SPs to match migration changes

---------

Co-authored-by: Daniel James Smith <2670567+djsmith85@users.noreply.github.com>
Co-authored-by: Alex Dragovich <46065570+itsadrago@users.noreply.github.com>
Co-authored-by: John Harrington <84741727+harr1424@users.noreply.github.com>
2025-12-31 13:37:42 -07:00
cyprain-okeke
665be6bfb0
[PM-29611] Decouple License from Subscription Response (#6768)
* implement the ticket request

* resolve the build lint error

* Resolve the build lint error

* Address review comments

* Fixt the lint and failing unit test

* Fix NSubstitute mock - use concrete ClaimsPrincipal instead of Arg.Any in Returns()

* resolve InjectUser issues

* Fix the failing testing

* Fix the failing unit test
2025-12-31 17:30:41 +01:00
Brant DeBow
86a68ab637
Move all event integration code to Dirt (#6757)
* Move all event integration code to Dirt

* Format to fix lint
2025-12-30 10:59:19 -05:00
Shane Melton
3b5bb76800
[PM-28747] Storage limit bypass for enforce organization ownership policy (#6759)
* [PM-28747] Bypass storage limit when enforce organization data ownership policy is enabled

* [PM-28747] Unit tests for storage limit enforcement

* [PM-28747] Add feature flag check

* [PM-28747] Simplify ignore storage limits policy enforcement

* [PM-28747] Add additional test cases
2025-12-29 09:30:22 -08:00
Dave
2dc4e9a420
feat(2fa-webauthn) [PM-20109]: Increase 2FA WebAuthn Security Key Limit (#6751)
* feat(global-settings) [PM-20109]: Add WebAuthN global settings.

* feat(webauthn) [PM-20109]: Update maximum allowed WebAuthN credentials to use new settings.

* test(webauthn) [PM-20109]: Update command tests to use global configs.

* feat(global-settings) [PM-20109]: Set defaults for maximum allowed credentials.

* feat(two-factor-request-model) [PM-20109]: Remove hard-coded 5 limit on ID validation.

* Revert "test(webauthn) [PM-20109]: Update command tests to use global configs."

This reverts commit ba9f0d5fb6.

* Revert "feat(webauthn) [PM-20109]: Update maximum allowed WebAuthN credentials to use new settings."

This reverts commit d2faef0c13.

* feat(global-settings) [PM-20109]: Add WebAuthNSettings to interface for User Service consumption.

* feat(user-service) [PM-20109]: Add boundary and persistence-time validation for maximum allowed WebAuthN 2FA credentials.

* test(user-service) [PM-20109]: Update tests for WebAuthN limit scenarios.

* refactor(user-service) [PM-20109]: Typo in variable name.

* refactor(user-service) [PM-20109]: Remove unnecessary pending check.

* refactor(user-service) [PM-20109]: Pending check is necessary.

* refactor(webauthn) [PM-20109]: Re-spell WebAuthN => WebAuthn.

* refactor(user-service) [PM-20109]: Re-format pending checks for consistency.

* refactor(user-service) [PM-20109]: Fix type spelling in comments.

* test(user-service) [PM-20109]: Combine premium and non-premium test cases with AutoData.

* refactor(user-service) [PM-20109]: Swap HasPremiumAccessQuery in for CanAccessPremium.

* refactor(user-service) [PM-20109]: Convert limit check to positive, edit comments.
2025-12-29 11:55:05 -05:00
Derek Nance
0cfb68336b
[PM-28025] Revert "chore(feature-flag): [PM-19665] Remove web-push feature flag" (#6779)
Some checks failed
Scan / Check PR run (push) Has been cancelled
Collect code references / Check for secret access (push) Has been cancelled
Testing / Run tests (push) Has been cancelled
Scan / Checkmarx (push) Has been cancelled
Scan / Sonar (push) Has been cancelled
Collect code references / Code reference collection (push) Has been cancelled
This reverts commit 1c60b805bf.
2025-12-26 16:44:34 -06:00
Thomas Rittson
67534e2cda
[PM-29556] Fix: changing organization plan nulls out public and private keys (#6738)
Some checks are pending
Collect code references / Check for secret access (push) Waiting to run
Collect code references / Code reference collection (push) Blocked by required conditions
Scan / Check PR run (push) Waiting to run
Scan / Checkmarx (push) Blocked by required conditions
Scan / Sonar (push) Blocked by required conditions
Testing / Run tests (push) Waiting to run
Main fix: only assign new key value where old keys are not set
and new keys have been provided.

Refactors:
- use consistent DTO model for keypairs
- delete duplicate property assignment for new orgs
2025-12-26 10:13:12 +10:00
sneakernuts
ae3c8317e3
SRE-3582 billing cleanup (#6772) 2025-12-22 13:09:23 -07:00
Thomas Rittson
69d72c2ad3
[PM-28485] Move organization events domain to DIRT code ownership (#6685)
Some checks failed
Collect code references / Check for secret access (push) Has been cancelled
Scan / Check PR run (push) Has been cancelled
Database testing / Run tests (push) Has been cancelled
Database testing / Run validation (push) Has been cancelled
Database testing / Validate new migration naming and order (push) Has been cancelled
Testing / Run tests (push) Has been cancelled
Collect code references / Code reference collection (push) Has been cancelled
Scan / Checkmarx (push) Has been cancelled
Scan / Sonar (push) Has been cancelled
2025-12-20 07:32:51 +10:00
Jordan Aasen
457e293fdc
[PM-29017] - improve logic for cipher SaveDetailsAsync validation (#6731)
* improve logic for cipher SaveDetailsAsync validation. fix tests

* revert change

* fix test

* remove duplicate semicolon
2025-12-19 11:35:01 -08:00
Jared Snider
e6c97bd850
Revert "refactor(IdentityTokenResponse): [Auth/PM-3287] Remove deprecated res…" (#6755)
Some checks failed
Collect code references / Check for secret access (push) Has been cancelled
Scan / Check PR run (push) Has been cancelled
Database testing / Run tests (push) Has been cancelled
Database testing / Run validation (push) Has been cancelled
Database testing / Validate new migration naming and order (push) Has been cancelled
Testing / Run tests (push) Has been cancelled
Collect code references / Code reference collection (push) Has been cancelled
Scan / Checkmarx (push) Has been cancelled
Scan / Sonar (push) Has been cancelled
This reverts commit bbe682dae9.
2025-12-18 15:10:40 -05:00
Maciej Zieniuk
a92d7ac129
[PM-27280] Support v2 encryption on key-connector signups (#6712)
* account v2 registration for key connector

* use new user repository functions

* test coverage

* integration test coverage

* documentation

* code review

* missing test coverage

* fix failing test

* failing test

* incorrect ticket number

* moved back request model to Api, created dedicated data class in Core

* sql stored procedure type mismatch, simplification

* key connector authorization handler
2025-12-18 13:43:03 -05:00
Shane Melton
3511ece899
[PM-28746] Add support for Organization_ItemOrganization_Accepted/Declined event types (#6747) 2025-12-18 10:20:46 -08:00
Alex Morask
982957a2be
[PM-21421] Support legacy > current plan transition when resubscribing (#6728)
Some checks are pending
Collect code references / Check for secret access (push) Waiting to run
Collect code references / Code reference collection (push) Blocked by required conditions
Scan / Sonar (push) Blocked by required conditions
Scan / Check PR run (push) Waiting to run
Scan / Checkmarx (push) Blocked by required conditions
Testing / Run tests (push) Waiting to run
* Refactor RestartSubscriptionCommand to support legacy > modern plan transition

* Run dotnet format

* Claude feedback

* Claude feedback
2025-12-18 09:12:16 -06:00
Brant DeBow
b3437b3b30
Update requirements for RabbitMQ and Azure Service Bus configuration (#6741) 2025-12-17 13:00:05 -05:00
Jared McCannon
de504d800b
[PM-24055] - Collection Users and Groups null on Public response (#6713)
* Integration test around getting and saving collection with group/user permissions

* This adds groups to the collections returned.

* Added new stored procedures so we don't accidentally wipe out access due to null parameters.

* wrapping all calls in transaction in the event that there is an error.
2025-12-17 11:34:17 -06:00
Brant DeBow
886ba9ae6d
Refactor IntegrationHandlerResult to provide more detail around failures (#6736)
* Refactor IntegrationHandlerResult to provide more detail around failures

* ServiceUnavailable now retryable, more explicit http status handling, more consistency with different handlers, additional xmldocs

* Address PR feedback
2025-12-17 11:43:53 -05:00
Jared Snider
bbe682dae9
refactor(IdentityTokenResponse): [Auth/PM-3287] Remove deprecated resetMasterPassword property from IdentityTokenResponse (#6676)
Some checks are pending
Collect code references / Check for secret access (push) Waiting to run
Collect code references / Code reference collection (push) Blocked by required conditions
Scan / Check PR run (push) Waiting to run
Scan / Checkmarx (push) Blocked by required conditions
Scan / Sonar (push) Blocked by required conditions
Testing / Run tests (push) Waiting to run
2025-12-17 10:34:12 -05:00
Kyle Denney
794240f108
[PM-29732] (fix) storage job no longer ignores trialing and past_due statuses (#6737) 2025-12-16 09:58:57 -06:00
Alex Morask
39a6719361
[PM-27117] Sync Stripe Customer details for Organizations and Providers in API & Admin (#6679)
Some checks failed
Collect code references / Check for secret access (push) Waiting to run
Collect code references / Code reference collection (push) Blocked by required conditions
Scan / Check PR run (push) Waiting to run
Scan / Checkmarx (push) Blocked by required conditions
Scan / Sonar (push) Blocked by required conditions
Testing / Run tests (push) Waiting to run
Database testing / Run tests (push) Has been cancelled
Database testing / Run validation (push) Has been cancelled
Database testing / Validate new migration naming and order (push) Has been cancelled
* Sync Stripe customer details for Provider / Organization in API & Admin

* Remove unnecessary var

* Fix logical operator

* Remove customer ID check from callers

* Fix failing tests

* Missed conflicts
2025-12-16 07:59:05 -06:00
Rui Tomé
f7c615cc01
[PM-21411] Refactor interface for determining premium status and features (#6688)
* Removed 2FA user interface from premium method signatures

* Added some more comments for clarity and small touchups.

* Add PremiumAccessCacheCheck feature flag to Constants.cs

* Add IPremiumAccessQuery interface and PremiumAccessQuery implementation for checking user premium access status

* Add unit tests for PremiumAccessQuery to validate user premium access logic

* Add XML documentation to Premium in OrganizationUserUserDetails and User classes

* Add PremiumAccessQueries to UserServiceCollectionExtensions

* Refactor TwoFactorIsEnabledQuery to incorporate PremiumAccessQuery and feature flag for premium access checks. Enhanced user premium status retrieval logic and improved handling of user details based on feature flag state.

* Mark methods in IUserRepository and IUserService as obsolete, directing users to new methods in IPremiumAccessQuery for premium access checks.

* Rename CanAccessPremiumBulkAsync to CanAccessPremiumAsync in IPremiumAccessQuery

* Update TwoFactorIsEnabledQuery to use CanAccessPremiumAsync for premium status checks

* Refactor TwoFactorIsEnabledQuery to introduce VNextAsync methods for improved premium access checks and user detail handling. Removed obsolete feature service dependency and enhanced test coverage for new functionality.

* Refactor IPremiumAccessQuery and PremiumAccessQuery to remove the overloaded CanAccessPremiumAsync method. Update related methods to streamline premium access checks using the User object directly. Enhance test coverage by removing obsolete tests and ensuring proper functionality with the new method signatures.

* Add new sync static method to determine if TwoFactor is enabled

* Enhance XML documentation for Premium property in OrganizationUserUserDetails and User classes to clarify its usage and limitations regarding personal and organizational premium access.

* Refactor IPremiumAccessQuery and PremiumAccessQuery to replace User parameter with Guid for user ID in CanAccessPremiumAsync methods. Update related methods and tests to streamline premium access checks and improve clarity in method signatures.

* Update feature flag references in IUserRepository and IUserService to use 'PremiumAccessQuery' instead of 'PremiumAccessCacheCheck'. Adjust related XML documentation for clarity on premium access methods.

* Rename IPremiumAccessQuery to IHasPremiumAccessQuery and move to Billing owned folder

* Remove unnecessary whitespace from IHasPremiumAccessQuery interface.

* Refactor HasPremiumAccessQuery to throw NotFoundException for null users

* Add NotFoundException handling in HasPremiumAccessQuery for mismatched user counts

* Refactor TwoFactorIsEnabledQuery to optimize premium access checks and improve two-factor provider handling. Introduced bulk fetching of premium status for users with only premium providers and streamlined the logic for determining if two-factor authentication is enabled.

* Refactor TwoFactorIsEnabledQueryTests to enhance clarity and optimize test scenarios. Consolidated test cases for two-factor authentication, improved naming conventions, and ensured premium access checks are only performed when necessary.

* Add UserPremiumAccess model to represent user premium access status from personal subscriptions and memberships

* Add User_ReadPremiumAccessByIds stored procedure and UserPremiumAccessView view to enhance premium access retrieval. Updated Organization table index to include UsersGetPremium for optimized queries.

* Add SQL migration script

* Add premium access retrieval methods to IUserRepository and implementations in UserRepository classes. Introduced GetPremiumAccessByIdsAsync and GetPremiumAccessAsync methods to fetch premium status for multiple users and a single user, respectively. Updated using directives to include necessary models.

* Refactor HasPremiumAccessQuery and IHasPremiumAccessQuery to streamline premium access checks. Updated method names for clarity and improved documentation. Adjusted test cases to reflect changes in user premium access retrieval logic.

* Update IUserRepository to reflect new method names for premium access retrieval. Changed obsolete method messages to point to GetPremiumAccessByIdsAsync and GetPremiumAccessAsync. Added internal use notes for IHasPremiumAccessQuery. Improved documentation for clarity.

* Refactor TwoFactorIsEnabledQuery to utilize IFeatureService for premium access checks.

* Enhance EF UserRepository to improve premium access retrieval by including related organization data.

* Add unit tests for premium access retrieval in UserRepositoryTests.

* Optimize HasPremiumAccessQuery to eliminate duplicate user IDs before checking premium access. Updated logic to ensure accurate comparison of premium users against distinct user IDs.

* Refactor TwoFactorIsEnabledQuery to improve handling of users without two-factor providers. Added early exit for users lacking providers and streamlined premium status checks for enabled two-factor authentication.

* Update HasPremiumAccessQueryTests to use simplified exception handling and improve test clarity

* Replaced fully qualified exception references with simplified ones.
* Refactored test setup to use individual user variables for better readability.
* Ensured assertions reflect the updated user variable structure.

* Enhance TwoFactorIsEnabledQuery to throw NotFoundException for non-existent users

* Updated TwoFactorIsEnabledQuery to throw NotFoundException when a user is not found instead of returning false.
* Added a new unit test to verify that the NotFoundException is thrown when a user is not found while premium access query is enabled.

* Move premium access query to Billing owned ServiceCollectionExtensions

* Refactor IUserService to enhance premium access checks

* Updated CanAccessPremium and HasPremiumFromOrganization methods to clarify usage with the new premium access query.
* Integrated IHasPremiumAccessQuery into UserService for improved premium access handling based on feature flag.
* Adjusted method documentation to reflect changes in premium access logic.

* Update IUserRepository to clarify usage of premium access methods

* Modified Obsolete attribute messages for GetManyWithCalculatedPremiumAsync and GetCalculatedPremiumAsync to indicate that callers should use the new methods when the 'PremiumAccessQuery' feature flag is enabled.
* Enhanced documentation to improve clarity regarding premium access handling.

* Update IUserRepository and IUserService to clarify deprecation of premium access methods

* Modified Obsolete attribute messages for GetManyWithCalculatedPremiumAsync and GetCalculatedPremiumAsync in IUserRepository to indicate these methods will be removed in a future version.
* Updated Obsolete attribute message for HasPremiumFromOrganization in IUserService to reflect the same deprecation notice.

* Refactor TwoFactorIsEnabledQuery to streamline user ID retrieval

* Consolidated user ID retrieval logic to avoid redundancy.
* Ensured consistent handling of user ID checks for premium access queries.
* Improved code readability by reducing duplicate code blocks.

* Rename migration script to fix the date

* Update migration script to create the index with DROP_EXISTING = ON

* Refactor UserPremiumAccessView to use LEFT JOINs and GROUP BY for improved performance and clarity

* Update HasPremiumAccessQueryTests to return null for GetPremiumAccessAsync instead of throwing NotFoundException

* Add unit tests for premium access scenarios in UserRepositoryTests

- Implement tests for GetPremiumAccessAsync to cover various user and organization premium access combinations.
- Validate behavior when users belong to multiple organizations, including cases with and without premium access.
- Update email generation for user creation to ensure uniqueness without specific prefixes.
- Enhance assertions to verify expected premium access results across different test cases.

* Bump date on migration script

* Update OrganizationEntityTypeConfiguration to include UsersGetPremium in index properties

* Add migration scripts for OrganizationUsersGetPremiumIndex across MySQL, PostgreSQL, and SQLite

- Introduced new migration files to create the OrganizationUsersGetPremiumIndex.
- Updated the DatabaseContextModelSnapshot to include UsersGetPremium in index properties for all database types.
- Ensured consistency in index creation across different database implementations.

---------

Co-authored-by: Todd Martin <tmartin@bitwarden.com>
Co-authored-by: Patrick Pimentel <ppimentel@bitwarden.com>
2025-12-16 10:31:56 +00:00
Jared McCannon
e646b91a50
[PM-27131] Auto confirm policy requirement (#6649)
Some checks are pending
Collect code references / Check for secret access (push) Waiting to run
Collect code references / Code reference collection (push) Blocked by required conditions
Scan / Check PR run (push) Waiting to run
Scan / Checkmarx (push) Blocked by required conditions
Scan / Sonar (push) Blocked by required conditions
Testing / Run tests (push) Waiting to run
* Added Auto confirm policy enforcement requirement. Includes strict single org enforcement along with blocking provider users from joining orgs with auto confirm enabled.
2025-12-15 15:40:00 -06:00
Kyle Spearrin
bead4f1d5a
validate and email on sso privisioning (#6734) 2025-12-15 15:19:17 -05:00
Thomas Avery
3c44430979
[PM-29161] Remove ReturnErrorOnExistingKeypair feature flag (#6726)
* Remove feature flag

* Add unit test coverage
2025-12-15 13:52:34 -06:00
Bernd Schoolmann
4f7e76dac7
[PM-27279] Implement TDE Registration with V2 Keys (#6671)
* Implement TDE v2 signup

* Clean up fallback logic for account keys

* Fix broken v2 logic

* Add comment

* Update comment
2025-12-15 17:48:37 +01:00
Brant DeBow
ed76fe2ab6
Refactor configuration for azure queue service for events to include queue name (#6724)
Some checks are pending
Collect code references / Check for secret access (push) Waiting to run
Collect code references / Code reference collection (push) Blocked by required conditions
Scan / Check PR run (push) Waiting to run
Scan / Checkmarx (push) Blocked by required conditions
Scan / Sonar (push) Blocked by required conditions
Testing / Run tests (push) Waiting to run
* Refactor configuration for azure queue service for events to include queue name

* Address PR feedback

* Add check for queue name before writing to Azure Queue Service

* Fix file encoding (lint error)
2025-12-15 08:49:32 -05:00
Kyle Denney
99e1326039
[PM-24616] refactor stripe adapter (#6527)
Some checks failed
Scan / Check PR run (push) Has been cancelled
Collect code references / Check for secret access (push) Has been cancelled
Testing / Run tests (push) Has been cancelled
Scan / Checkmarx (push) Has been cancelled
Scan / Sonar (push) Has been cancelled
Collect code references / Code reference collection (push) Has been cancelled
* move billing services+tests to billing namespaces

* reorganized methods in file and added comment headers

* renamed StripeAdapter methods for better clarity

* clean up redundant qualifiers

* Upgrade Stripe.net to v48.4.0

* Update PreviewTaxAmountCommand

* Remove unused UpcomingInvoiceOptionExtensions

* Added SubscriptionExtensions with GetCurrentPeriodEnd

* Update PremiumUserBillingService

* Update OrganizationBillingService

* Update GetOrganizationWarningsQuery

* Update BillingHistoryInfo

* Update SubscriptionInfo

* Remove unused Sql Billing folder

* Update StripeAdapter

* Update StripePaymentService

* Update InvoiceCreatedHandler

* Update PaymentFailedHandler

* Update PaymentSucceededHandler

* Update ProviderEventService

* Update StripeEventUtilityService

* Update SubscriptionDeletedHandler

* Update SubscriptionUpdatedHandler

* Update UpcomingInvoiceHandler

* Update ProviderSubscriptionResponse

* Remove unused Stripe Subscriptions Admin Tool

* Update RemoveOrganizationFromProviderCommand

* Update ProviderBillingService

* Update RemoveOrganizatinoFromProviderCommandTests

* Update PreviewTaxAmountCommandTests

* Update GetCloudOrganizationLicenseQueryTests

* Update GetOrganizationWarningsQueryTests

* Update StripePaymentServiceTests

* Update ProviderBillingControllerTests

* Update ProviderEventServiceTests

* Update SubscriptionDeletedHandlerTests

* Update SubscriptionUpdatedHandlerTests

* Resolve Billing test failures

I completely removed tests for the StripeEventService as they were using a system I setup a while back that read JSON files of the Stripe event structure. I did not anticipate how frequently these structures would change with each API version and the cost of trying to update these specific JSON files to test a very static data retrieval service far outweigh the benefit.

* Resolve Core test failures

* Run dotnet format

* Remove unused provider migration

* Fixed failing tests

* Run dotnet format

* Replace the old webhook secret key with new one (#6223)

* Fix compilation failures in additions

* Run dotnet format

* Bump Stripe API version

* Fix recent addition: CreatePremiumCloudHostedSubscriptionCommand

* Fix new code in main according to Stripe update

* Fix InvoiceExtensions

* Bump SDK version to match API Version

* cleanup

* fixing items missed after the merge

* use expression body for all simple returns

* forgot fixes, format, and pr feedback

* claude pr feedback

* pr feedback and cleanup

* more claude feedback

---------

Co-authored-by: Alex Morask <amorask@bitwarden.com>
Co-authored-by: cyprain-okeke <108260115+cyprain-okeke@users.noreply.github.com>
2025-12-12 15:32:43 -06:00
Brant DeBow
196e555116
Refactor event integration service collection extensions into their own extension (#6714)
Some checks are pending
Collect code references / Check for secret access (push) Waiting to run
Collect code references / Code reference collection (push) Blocked by required conditions
Scan / Check PR run (push) Waiting to run
Scan / Checkmarx (push) Blocked by required conditions
Scan / Sonar (push) Blocked by required conditions
Testing / Run tests (push) Waiting to run
* Add CQRS and caching support for OrganizationIntegrationConfigurations

* Refactor event integration service collection extensions into their own extension
2025-12-12 16:17:43 -05:00
Dave
4fdc4b1b49
refactor(base-request-validator) [PM-28621] Unwind pm-21153 Feature Flag (#6730)
* refactor(base-request-validator) [PM-28621]: Remove feature flagged logic and constant.

* refactor(base-request-validator) [PM-28621]: Update tests to reflect unwound feature flag.
2025-12-12 15:38:21 -05:00
cyprain-okeke
5ac8536855
[PM-28662] Fix Individual Premium automatically disabled due to duplicate subscription leftover from failed payment (#6663)
* Fix the Bug

* Address the hardcode issue

* Fix the tailing test

* resolve the lint issue
2025-12-12 13:19:09 -06:00
Brant DeBow
72c8967937
Add CQRS and caching support for OrganizationIntegrationConfigurations (#6690) 2025-12-12 11:52:32 -05:00
Nick Krantz
20755f6c2f
[PM-25947] Add folders and favorites when sharing a cipher (#6402)
* add folders and favorites when sharing a cipher

* refactor folders and favorites assignment to consider existing folders/favorite assignments on a cipher

* remove unneeded string manipulation

* remove comment

* add unit test for folder/favorite sharing

* add migration for sharing a cipher to org and collect reprompt, favorite and folders

* update date timestamp of migration
2025-12-11 12:31:12 -06:00
Bernd Schoolmann
919d0be6d2
Add UpdateAccountCryptographicState repository function (#6669)
Some checks are pending
Collect code references / Check for secret access (push) Waiting to run
Collect code references / Code reference collection (push) Blocked by required conditions
Scan / Check PR run (push) Waiting to run
Scan / Checkmarx (push) Blocked by required conditions
Scan / Sonar (push) Blocked by required conditions
Database testing / Run tests (push) Waiting to run
Database testing / Run validation (push) Waiting to run
Database testing / Validate new migration naming and order (push) Waiting to run
Testing / Run tests (push) Waiting to run
* Add user repository update function for account cryptographic state

* Remove comment

* Remove transaction logic

* Fix security version

* Apply feedback

* Update tests

* Add support for external actions
2025-12-11 12:10:50 +01:00
Thomas Avery
f86d1a51dd
[PM-25652] Add endpoint to fetch key connector confirmation details (#6635)
* Add new endpoint and query for key connector

* Add unit tests
2025-12-10 14:53:38 -06:00
Alex Morask
579d8004ff
[PM-29224] Remove unused billing endpoints and code paths (#6692)
* Remove unused endpoints and code paths

* MOAR DELETE

* Run dotnet format
2025-12-09 08:46:15 -06:00
cyprain-okeke
3e12cfc6df
Resolve the failing test (#6622) 2025-12-09 15:45:03 +01:00