* Fix null reference when restoring invited users in Free orgs
Add null check before querying for other free org ownership. Invited
users don't have a UserId yet, causing NullReferenceException.
* Add regression test for restoring revoked invited users with null UserId.
* Exclude invited users from claimed domain checks.
These users should be excluded by the JOIN on
UserId, but it's a known issue that some invited
users have this FK set.
* Add sproc to create multiple default collections.
SqlBulkCopy implementation is overkill for most cases.
This provides a lighter weight sproc implementation for smaller
data sets.
* DRY up collection arrangement
* DRY up tests because bulk and non-bulk share same behavior
* use EF native AddRange instead of bulk insert, because
we expect smaller data sizes on self-host
* Add Entity Framework migration validation to verify_migrations script
Enhances dev/verify_migrations.ps1 to validate EF migration files in addition to SQL migrations. The script now validates migrations in util/MySqlMigrations, util/PostgresMigrations, and util/SqliteMigrations directories.
Validation includes:
- Correct naming format (YYYYMMDDHHMMSS_Description.cs)
- Both .cs and .Designer.cs files exist as pairs
- Chronological ordering of timestamps
- Excludes DatabaseContextModelSnapshot.cs files
The script provides comprehensive reporting for all migration types with a summary showing which validations passed or failed.
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
* Fix: Validate all EF migration files instead of silently ignoring malformed names
Previously, migration files that didn't match the expected pattern were silently
ignored during validation. This could allow incorrectly named files to slip through.
Now the script explicitly tracks and reports any migration files that don't match
the required YYYYMMDDHHMMSS_Description.cs format, ensuring all new migration files
are properly validated.
Addresses feedback from PR review to prevent malformed migration files from being
overlooked.
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
* Add some integration tests for the Server project
* Not sure why this project got removed?
* Format
* capture debug output
* Update tests to work with the now legacy WebHostBuilder
- I accidentally had the updated Program locally and that was why tests were working for me locally
* Formatting...again
* feat(sso-persisted-grants) [PM-23572]: Stub PersistedGrantStore.
* feat(sso-persisted-grants) [PM-23572]: Update service reigtration with named cache.
* feat(sso-persisted-grants) [PM-23572]: Add unit tests for DistributedCachePersistedGrantStore.
* feat(sso-persisted-grants) [PM-23572]: Add additional tests.
* feat(sso-persisted-grants) [PM-23572]: Add some additional clarifying comments on ExtendedCache vs InMemoryCaching for Duende.
* feat(sso-persistent-grants) [PM-23572]: Spelling in a comment for cache key name.
* feat(sso-persisted-grants) [PM-23572]: Add cache key constant and remove explicit skip distributed cache on set for default configuration.
---------
Co-authored-by: bnagawiecki <107435978+bnagawiecki@users.noreply.github.com>
* 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
* remove FF, update SendAuthQuery, and update tests
* new endpoints added but lack test coverage
* dotnet format
* add PutRemoveAuth endpoint with test coverage and tests for new non-anon endpoints
* update RequireFeatureFlag comment for clarity
* respond to Claude's findings
* add additional validation logic to new auth endpoints
* enforce auth policies on individual action methods
* remove JsonConverter directive for AuthType
* remove tools-send-email-otp-listing feature flag
---------
Co-authored-by: ✨ Audrey ✨ <audrey@audreyality.com>
Co-authored-by: ✨ Audrey ✨ <ajensen@bitwarden.com>
Co-authored-by: Daniel James Smith <2670567+djsmith85@users.noreply.github.com>
Co-authored-by: Alex Dragovich <46065570+itsadrago@users.noreply.github.com>
We want to reduce the amount of business critical test data in the company. One way of doing that is to generate test data on demand prior to client side testing.
Clients will request a scene to be set up with a JSON body set of options, specific to a given scene. Successful seed requests will be responded to with a mangleMap which maps magic strings present in the request to the mangled, non-colliding versions inserted into the database. This way, the server is solely responsible for understanding uniqueness requirements in the database. scenes also are able to return custom data, depending on the scene. For example, user creation would benefit from a return value of the userId for further test setup on the client side.
Clients will indicate they are running tests by including a unique header, x-play-id which specifies a unique testing context. The server uses this PlayId as the seed for any mangling that occurs. This allows the client to decide it will reuse a given PlayId if the test context builds on top of previously executed tests. When a given context is no longer needed, the API user will delete all test data associated with the PlayId by calling a delete endpoint.
---------
Co-authored-by: Matt Gibson <mgibson@bitwarden.com>
* Updated organization licenses to save the correct values from the token
* Added additional test cases around licenses
* Added missing properties from Organization to UpdateOrganizationLicenseCommand.UpdateLicenseAsync()
* Add tests to validate license property synchronization pipeline
* `dotnet format`
* 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.
* 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
* 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