1
0
mirror of https://github.com/bitwarden/server.git synced 2025-06-11 21:50:33 -05:00

939 Commits

Author SHA1 Message Date
Thomas Rittson
61390c0553
Merge branch 'main' into user-service-test-tweaks 2025-06-11 15:26:18 +10:00
Graham Walker
4277f435ab
PM-22564 Fix Namespaces from Tools to Dirt (#5947)
* PM-22564 fixing namespaces

* PM-22564 fixing namespace in integration test

* PM-22564 fixing .sqlproj file
2025-06-10 12:36:49 -05:00
Rui Tomé
021e69bc5d
[PM-17154] Limit item deletion feature flag logic removal (#5925)
* Refactor CiphersController and related tests by removing unused IFeatureService dependency and associated feature flag checks. Cleaned up tests to reflect these changes, ensuring they focus on manage permissions without reliance on feature flags.

* Refactor CipherService and related tests by removing feature flag checks for item deletion permissions. Updated tests to focus on user manage permissions without reliance on feature flags, ensuring cleaner and more maintainable code.

* Enhance CiphersControllerTests by adding user retrieval and organization ability checks. Updated test cases to ensure proper handling of item deletion permissions based on user roles and organization settings, improving test coverage and reliability.
2025-06-10 09:57:29 +01:00
renovate[bot]
88ffc91b99
[deps] Billing: Update coverlet.collector to 6.0.4 (#5720)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-06-09 10:49:41 -05:00
Ben Bryant
20d3911b80
[PM-22380] Enable NRT for some Core project files (#5912)
* Enable NRT for Core/Jobs files

* Enable NRT for Core/HostedServices files

* Enable NRT for Core/Exceptions files

* Enable NRT for Core/NotificationHub files

---------

Co-authored-by: Bernd Schoolmann <mail@quexten.com>
2025-06-06 13:59:57 +02:00
Thomas Rittson
529e451967
PR feedback on xmldoc 2025-06-04 14:25:15 +10:00
Thomas Rittson
28606ef2d5
Merge remote-tracking branch 'origin/main' into user-service-test-tweaks 2025-06-04 14:19:08 +10:00
Jordan Aasen
2e14a46cee
[PM-22344] - fix Error: Cannot Decrypt when moving a vault item to a collection (#5911)
* use ToCipher instead of casting

* return ListResponseModel

* fix test

* remove ToArray

* have ShareManyAsync return CipherDetails

* fix test

* fix tests

* fix test

* fix test
2025-06-03 14:02:13 -07:00
Brant DeBow
59f5fafb87
[PM-17562] Add strict delay support for RabbitMQ; Refactor implementation (#5899)
* [PM-17562] Add strict delay support for RabbitMQ

* fix lint error

* Added more robust FailureReason handling and some additional tests

* Fix two issues noted by SonarQube

* Fix typo; Add alternate handling if MessageId is null or empty

* Set MessageId on all message publishers
2025-06-03 10:48:24 -04:00
Thomas Rittson
137b29f4c0
Merge remote-tracking branch 'origin/main' into user-service-test-tweaks 2025-06-03 13:00:07 +10:00
Bernd Schoolmann
14e68428f6
[PM-20225] Block no-userkey legacy users (#5640)
* Block legacy users on all clients over 2025.5

* Update message

* Fix test

* Fix test

* Update blocked version
2025-06-02 22:04:01 +02:00
Henrik
8bac7f0145
[PM-14476] Avoid multiple lookups in dictionaries (#4973)
* Avoid multiple lookups in dictionaries

* Consistency in fallback to empty CollectionIds

* Readability at the cost of lines changed

* Readability

* Changes after running dotnet format
2025-06-02 11:18:28 -05:00
Jordan Aasen
2c4393cc16
[PM-22204] - update cipher/share endpoint to return revision date (#5900)
* return ciper response model in cipher share endpoint. add tests

* return dict instead of full cipher response. adjust specs

* rename vars

* rename vars

* rename vars

* reinsert braces

* add specs

* return CipherMiniResponseModel
2025-06-02 09:05:58 -07:00
Daniel James Smith
c7b1c7f6d5
[PM-22190] Remove gathering and reporting of ReferenceEvents (#5897)
* Remove gathering and reporting of ReferenceEvents

* Fix test that relied on reference events throwing

---------

Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com>
2025-06-02 16:49:49 +02:00
Oscar Hinton
d7d90e7f3e
[PM-21079] Add support to integration tests for using sqlserver (#5823)
Adds a SqlServerApiApplicationFactory which allows you to run api tests using SqlServer. Currently a new database is create and destroyed for each test. In the future we'd like a more optimized way to do this.

The database logic is abstracted away in a ITestDatabase interface which handles the configuration, migration and teardown.
2025-06-02 11:06:16 +02:00
Justin Baur
0b2b573bd3
Add DynamicClientStore (#5670)
* Add DynamicClientStore

* Formatting

* Fix Debug assertion

* Make Identity internals visible to its unit tests

* Add installation client provider tests

* Add internal client provider tests

* Add DynamicClientStore tests

* Fix namespaces after merge

* Format

* Add docs and remove TODO comments

* Use preferred prefix for API keys

---------

Co-authored-by: Jared Snider <116684653+JaredSnider-Bitwarden@users.noreply.github.com>
2025-05-30 12:58:54 -04:00
cyprain-okeke
5972ac147e
[PM-21603]Invite Member sub text seat count does not account for sponsorships (#5889)
* Add Occupied Seats at part metadata

* resolve the failing test

Signed-off-by: Cy Okeke <cokeke@bitwarden.com>

---------

Signed-off-by: Cy Okeke <cokeke@bitwarden.com>
2025-05-29 15:06:25 +01:00
Brant DeBow
6486354fbc
[PM-17562] Add Azure Service Bus support for event integration retries (#5880)
* [PM-17562] Add Azure Service Bus support for event integration retries

* Cleanup AzureServiceBusIntegrationListenerService.cs; add nullable

* Removed IntegrationHandlerBase* since it is no longer used (We removed the subclasses previously)

* Changed strategy to assume ApplyRetry always gives us a non-null DelayUntilDate; Added test to confirm as well
2025-05-29 08:22:11 -04:00
Rui Tomé
829ce86066
[PM-18238] Add RequireTwoFactorPolicyRequirement (#5840)
* Add RequireTwoFactorPolicyRequirement and its factory with unit tests

* Implemented RequireTwoFactorPolicyRequirement to enforce two-factor authentication policies.
* Created RequireTwoFactorPolicyRequirementFactory to generate policy requirements based on user status.
* Added unit tests for the factory to validate behavior with various user statuses and policy details.

* Enhance AcceptOrgUserCommand to use IPolicyRequirementQuery for two-factor authentication validation

* Update ConfirmOrganizationUserCommand to use RequireTwoFactorPolicyRequirement to check for 2FA requirement

* Implement CanAcceptInvitation and CanBeConfirmed methods in RequireTwoFactorPolicyRequirement; update tests to reflect new logic for two-factor authentication policy handling.

* Refactor AcceptOrgUserCommand to enforce two-factor authentication policy based on feature flag; update validation logic and tests accordingly.

* Enhance ConfirmOrganizationUserCommand to validate two-factor authentication policy based on feature flag; refactor validation logic and update related tests for improved policy handling.

* Remove unused method and its dependencies from OrganizationService.

* Implement CanBeRestored method in RequireTwoFactorPolicyRequirement to determine user restoration eligibility based on two-factor authentication status; add corresponding unit tests for various scenarios.

* Update RestoreOrganizationUserCommand to use IPolicyRequirementQuery for two-factor authentication policies checks

* Remove redundant vNext tests

* Add TwoFactorPoliciesForActiveMemberships property to RequireTwoFactorPolicyRequirement and corresponding unit tests for policy retrieval based on user status

* Refactor UserService to integrate IPolicyRequirementQuery for two-factor authentication policy checks

* Add XML documentation for TwoFactorPoliciesForActiveMemberships property in RequireTwoFactorPolicyRequirement to clarify its purpose and return value.

* Add exception documentation for ValidateTwoFactorAuthenticationPolicyAsync method in ConfirmOrganizationUserCommand to clarify error handling for users without two-step login enabled.

* Update comments in AcceptOrgUserCommand and ConfirmOrganizationUserCommand to clarify handling of two-step login and 2FA policy checks.

* Add RequireTwoFactorPolicyRequirementFactory to PolicyServiceCollectionExtensions

* Refactor two-factor authentication policy checks in AcceptOrgUserCommand and ConfirmOrganizationUserCommand to streamline validation logic and improve clarity. Update RequireTwoFactorPolicyRequirement to provide a method for checking if two-factor authentication is required for an organization. Adjust related unit tests accordingly.

* Add PolicyRequirements namespace

* Update comments in AcceptOrgUserCommand and ConfirmOrganizationUserCommand to clarify two-factor authentication policy requirements and exception handling.

* Refactor RequireTwoFactorPolicyRequirement to return tuples of (OrganizationId, OrganizationUserId) for active memberships requiring two-factor authentication. Update UserService and related tests to reflect this change.

* Refactor AcceptOrgUserCommand: delegate feature flag check to the ValidateTwoFactorAuthenticationPolicyAsync method

* Skip policy check if two-step login is enabled for the user

* Refactor ConfirmOrganizationUserCommand to streamline two-factor authentication policy validation logic

* Refactor AcceptOrgUserCommand to simplify two-factor authentication check by removing intermediate variable

* Update documentation in RequireTwoFactorPolicyRequirement to clarify the purpose of the IsTwoFactorRequiredForOrganization

* Refactor AcceptOrgUserCommandTests to remove redundant two-factor authentication checks and simplify test setup

* Refactor AcceptOrgUserCommand and ConfirmOrganizationUserCommand to streamline two-factor authentication checks by removing redundant conditions and simplifying logic flow.

* Rename removeOrgUserTasks variable in UserService

* Refactor RestoreOrganizationUserCommand to simplify two-factor authentication compliance checks by consolidating logic into a new method, IsTwoFactorRequiredForOrganizationAsync.

* Remove outdated two-factor authentication validation documentation from AcceptOrgUserCommand

* Invert two-factor compliance check in RestoreOrganizationUserCommand to ensure correct validation of organization user policies.

* Refactor UserService to enhance two-factor compliance checks by optimizing organization retrieval and logging when no organizations require two-factor authentication.
2025-05-29 07:40:30 +01:00
Thomas Rittson
c7b0c30370
Bump account revision date in OrgUserRepository (#5884)
Match equivalent MSSQL logic. Also ensures that the revision date
is bumped when the user is revoked.
2025-05-29 07:30:23 +10:00
Brant DeBow
f3e637cf2d
[PM-17562] Add support for retries on event integrations (#5795)
* [PM-17562] Add support for retires on event integrations

* Add additional test coverage

* Fixed missing await call

* Remove debug organization id

* Respond to PR feedback

* Change NotBeforeUtc to DelayUntilDate. Adjust comments.

* Respond to PR feedback
2025-05-27 08:28:50 -04:00
✨ Audrey ✨
c989abdb82
[PM-21917] Introduce SendAuthenticationQuery (#5857) 2025-05-27 08:25:27 -04:00
Thomas Rittson
9c7a679d98
Add xmldoc to SutProvider 2025-05-27 08:24:07 +10:00
Thomas Rittson
33a26984c8
Combine static methods 2025-05-26 16:37:21 +10:00
Thomas Rittson
79a0073a2c
Clean up 2025-05-26 16:28:43 +10:00
Thomas Rittson
68a333c293
Delete unused code 2025-05-26 15:34:08 +10:00
Thomas Rittson
dadc227ee3
Merge remote-tracking branch 'origin/main' into user-service-test-tweaks 2025-05-26 15:30:55 +10:00
Justin Baur
542941818a
Disallow non ascii in equivalent domain (#5852)
* Test malicious domain change

* Add tests to detect non-ascii characters

* Revert "Test malicious domain change"

This reverts commit 0602bf6d844b611304aba139e9f49cd38594273a.

* Remove confusing comment from when I was going to detect problems differently

* Update test/Core.Test/Utilities/StaticStoreTests.cs

Co-authored-by: Matt Bishop <mbishop@bitwarden.com>

* Update test/Core.Test/Utilities/StaticStoreTests.cs

Co-authored-by: Matt Bishop <mbishop@bitwarden.com>

---------

Co-authored-by: Matt Bishop <mbishop@bitwarden.com>
2025-05-23 10:31:10 -04:00
Thomas Rittson
198d96e155
[PM-21612] [Unified] Fix unhandled error when editing an invited member (#5817)
* Check for UserId instead of passing potentially default value to
  bump account revision date method.

* Pass explicit UserId into CipherRepository.CreateAsync method
  used for imports.
2025-05-23 11:45:41 +10:00
Thomas Rittson
83478f9c69
[PM-13274] [Unified] Add integration tests for creating and updating collections (#5814) 2025-05-23 11:27:37 +10:00
Alex Morask
18d146406c
[PM-21099] (NO LOGIC) Organize Billing provider code (#5819)
* [NO LOGIC] Organize Billing provider code

* Run dotnet format

* Run dotnet format'

* Fixed using after merge

* Fixed test usings after merge
2025-05-21 09:04:30 -04:00
Alex Morask
e994bf2117
[PM-21383] Use Stripe to get provider pricing for display when feature flag is on (#5842)
* Use ProviderPriceAdapter when getting provider subscription

* Update test
2025-05-21 08:10:34 -04:00
Rui Tomé
725a793863
[PM-15161] Create ProviderClientOrganizationSignUpCommand command (#5764)
* Extract OrganizationService.SignupClientAsync into new ResellerClientOrganizationSignUpCommand

* Refactor ResellerClientOrganizationSignUpCommand to remove unused dependencies and simplify SignupClientAsync method signature

* Add unit tests for ResellerClientOrganizationSignUpCommand

* Rename SignUpProviderClientOrganizationCommand

* Rename ProviderClientOrganizationSignUpCommand

* Register ProviderClientOrganizationSignUpCommand for dependency injection

* Refactor ProviderService to use IProviderClientOrganizationSignUpCommand for organization signup process

* Refactor error handling in ProviderClientOrganizationSignUpCommand to use constants for error messages

* Remove SignupClientAsync method from IOrganizationService and OrganizationService, along with associated unit tests
2025-05-20 14:35:47 +01:00
Graham Walker
818934487f
PM-18939 refactoring send service to 'cqrs' (#5652)
* PM-18939 refactoring send service to 'cqrs'

* PM-18939 fixing import issue with sendValidationService

* PM-18939 fixing code based on PR comments

* PM-18339 reverting to previous code in test

* PM-18939 adding XMLdocs to services

* PM-18939 reverting send validation methods

* PM-18939 updating code to match main

* PM-18939 reverting validateUserCanSaveAsync to match main

* PM-18939 fill our param and return sections of XMLdocs

* PM-18939 updating XMLdocs based on PR comments

* Update src/Core/Tools/SendFeatures/Commands/Interfaces/IAnonymousSendCommand.cs

Co-authored-by:  Audrey  <ajensen@bitwarden.com>

* Update src/Core/Tools/SendFeatures/Commands/Interfaces/INonAnonymousSendCommand.cs

Co-authored-by:  Audrey  <ajensen@bitwarden.com>

* Update src/Core/Tools/SendFeatures/Commands/Interfaces/INonAnonymousSendCommand.cs

Co-authored-by:  Audrey  <ajensen@bitwarden.com>

* Update src/Core/Tools/SendFeatures/Services/Interfaces/ISendStorageService.cs

Co-authored-by:  Audrey  <ajensen@bitwarden.com>

* PM-18939 adding commits to change tuple to enum type

* PM-18939 resetting stream position to 0 when uploading file

* PM-18939 updating XMLdocs based on PR comments

* PM-18939 updating XMLdocs

* PM-18939 removing circular dependency

* PM-18939 fixing based on comments

* PM-18939 updating method name and documentation

---------

Co-authored-by:  Audrey  <ajensen@bitwarden.com>
2025-05-19 22:59:30 -05:00
Alex Morask
7b3e2a80f4
[PM-21092] Set tax exemption to reverse charge for non-US business-use customers (#5812)
* Set automatic tax to enabled and tax exempt to reverse where applicable when ff is on

* Fix and add tests

* Run dotnet format

* Run dotnet format

* PM-21745: Resolve defect

* PM-21770: Resolve defect

* Run dotnet format'
2025-05-19 14:53:48 -04:00
Ike
a07cce26f3
[PM-19444] Emergency access device verification email fix (#5833)
* fix: turn off New Device Verification when emergency access takeover is exercised; Also some Docs

* test: add tests for EmergencyAccessService
2025-05-19 11:59:15 -04:00
Brandon Treston
b3f7265129
[PM-21727] Add feature to plan and license constructor (#5834)
* add feature to plan

* add license to ctor for old license file creation method
2025-05-16 17:30:51 -04:00
Brandon Treston
cbf49b915b
[PM-11622] Implement UseOrganizationDomains (#5822)
* implement UseOrganizationDomains

* fix undefined error
2025-05-16 12:51:22 -04:00
cyprain-okeke
51e489ac9d
[PM 21081][Defect] Admin Sponsored Families not working in Self Host after uploading license file (#5818)
* Resolve the licence issue

Signed-off-by: Cy Okeke <cokeke@bitwarden.com>

* resolve the pr comment

* Remove unnecessary directives

Signed-off-by: Cy Okeke <cokeke@bitwarden.com>

---------

Signed-off-by: Cy Okeke <cokeke@bitwarden.com>
2025-05-16 16:05:47 +01:00
Patrick-Pimentel-Bitwarden
8d2629fe58
Auth/pm 17111/add browser to list of approving clients (#5825)
* refactor(update-auth-approving-clients): [PM-17111] Add Browser to List of Approving Clients - Refactored how it works to fit different priorities.
2025-05-16 09:50:32 -04:00
bitwarden-charlie
67f745ebc4
chore/SRE-583 Deprecate usage of Auth-Email Header (#5709)
* chore/SRE-583 Deprecate usage of Auth-Email Header

* SRE-583 cleanup function and references

* SRE-583 cleanup tests

---------

Co-authored-by: sneakernuts <671942+sneakernuts@users.noreply.github.com>
2025-05-16 07:45:04 -06:00
Jordan Aasen
97fbf21977
[PM-20543] - remove restrict-provider-access feature flag (#5700)
* remove restrict-provider-access feature flag

* remove feature flag

* re-add flag

* remove unnecessary tests

* fix bad merge

* fix bad merge

* remove RestrictProviderAccess key
2025-05-15 14:00:48 -07:00
Brandon Treston
81bff5e5cf
[PM-11622] use organization domains (#5560)
* DBO changes

* Add migration scripts

* wip

* wip

* wip

* add EF migrations

* run dotnet format

* cleanup

* revert business logic

* wip

* add update statement to mssql migration script

* fix user service tests

* increment license, add UseOrganizationDomains

* add migration helpers to seed initial value from UseSso

* clean up

* cleanup

* fix mssql migrations

* fix license version and test

* fix file names

* fix license json

* add missing property to license test

* rename file

* fix migrations

* fix migration

* add WHERE to helper scripts

* separate schema/data migrations

* restore comment

* Merge conflict

* fix migrations

* add new property to migration

* wip

* fix file names

* fix file name
2025-05-15 10:42:51 -04:00
Jared Snider
9ebe165871
fix(RegistrationViaOrgInviteWelcomeEmail): [Auth/PM-21428] Registration via Org Invite should send welcome email even if reference data isn't provided (#5796) 2025-05-14 11:13:32 -04:00
Patrick-Pimentel-Bitwarden
dd2ea41b74
Auth/pm 17111/add browser to list of approving clients (#5792)
* feat(update-auth-approving-clients): [PM-17111] Add Browser to List of Approving Clients - Initial changes.

* feat(update-auth-approving-clients): [PM-17111] Add Browser to List of Approving Clients - Updated tests.

* test(update-auth-approving-clients): [PM-17111] Add Browser to List of Approving Clients - Strengthened tests.
2025-05-13 15:43:11 -04:00
Vijay Oommen
4195baf1c5
[PM-20980] Add a note to freshdesk ticket when no user is found (#5768) 2025-05-13 09:05:22 -05:00
Alex Morask
53f7d9655e
[PM-20087] [PM-21104] Preview tax amount for organization trial initiation (#5787)
* [NO LOGIC] [PM-21104] Organize Core.Billing tax code

* Add PreviewTaxAmountCommand and expose through TaxController

* Add PreviewTaxAmountCommandTests

* Run dotnet format
2025-05-13 09:28:31 -04:00
Alex Morask
082bfa3c6a
[PM-21257] Revert MaxProjects license changes, limit MaxProjectsQuery to cloud-only for 2-person organizations (#5776)
* Revert "Add SmMaxProjects to OrganizationLicense (#5678)"

This reverts commit 7fe022e26fce3c3f032757e832df50e9478e6658.

* Use PricingClient in MaxProjectsQuery and limit to cloud-only (free 2-person)
2025-05-13 08:51:36 -04:00
Thomas Rittson
a1b22e66e5
[PM-14613] Remove account deprovisioning feature flag (#5676)
* Remove flag

* Remove old tests

* Remove old xmldoc referencing the flag

* Remove old emails
2025-05-13 07:17:54 +10:00
cyprain-okeke
e4359f071c
[PM-21097] Fix: Prevent admin-added sponsored families from appearing in individual vault settings (#5767)
* Changes to resolve sponsorship showing in individual vault

* Resolve the failing unit test

Signed-off-by: Cy Okeke <cokeke@bitwarden.com>

* Resolve the failing test

* Resolve the failing test

* Resolve the failing test

* fix make IsAdminInitiated nullable

Signed-off-by: Cy Okeke <cokeke@bitwarden.com>

* Add the isAdminInitiated property

Signed-off-by: Cy Okeke <cokeke@bitwarden.com>

* Resolve the database error

Signed-off-by: Cy Okeke <cokeke@bitwarden.com>

* Resolve the failing unit test

Signed-off-by: Cy Okeke <cokeke@bitwarden.com>

* Resolve the scan error

Signed-off-by: Cy Okeke <cokeke@bitwarden.com>

* Resolve the database issue

* resolve the database build error

* Resolve the database build error

* Resolve the synchronization issue

---------

Signed-off-by: Cy Okeke <cokeke@bitwarden.com>
2025-05-12 18:21:07 +01:00