1
0
mirror of https://github.com/bitwarden/server.git synced 2024-11-22 12:15:36 +01:00
Commit Graph

874 Commits

Author SHA1 Message Date
Thomas Rittson
19217679cf
Fix migration script date to be merge date (#4028) 2024-04-29 07:08:31 -06:00
Thomas Rittson
ba36b2d26a
[AC-2172] Member modal - limit admin access (#3934)
* update OrganizationUsersController PUT and POST
* enforces new collection access checks when updating members
* refactor BulkCollectionAuthorizationHandler to avoid repeated db calls
2024-04-29 11:02:06 +10:00
Rui Tomé
b3e5076128
[AC-1978] Flexible collections: EF data migrations for deprecated permissions (#3969)
* [AC-1682] Added MySql migration and script

(cherry picked from commit d367f6de6b)

* [AC-1682] Added Postgres migration and script

(cherry picked from commit 9bde1604da)

* [AC-1682] Added Sqlite migration and script

(cherry picked from commit 262887f9c3)

* [AC-1682] dotnet format

(cherry picked from commit 00eea0621c)

* [AC-1682] Fixed Sqlite query

(cherry picked from commit 26f5bf8afd)

* [AC-1682] Drop temp tables if they exist when starting the scripts

(cherry picked from commit c20912f95c)

* [AC-1682] Removed MySql transaction from script because EF migration already wraps it under its own transaction

(cherry picked from commit 7b54d78d67)

* [AC-1682] Setting FlexibleCollections = 1 only for Orgs that had data migrated in previous steps

(cherry picked from commit 28bba94d81)

* [AC-1682] Updated queries to check for OrganizationId

(cherry picked from commit a957530d5e)

* [AC-1682] Fixed MySql script

(cherry picked from commit deee483ab7)

* [AC-1682] Fixed Postgres query

(cherry picked from commit c3ca9ec3c8)

* [AC-1682] Fix Sqlite query

(cherry picked from commit fada0a81bf)

* [AC-1682] Reverted scripts back to enabling Flexible Collections to all existing Orgs

(cherry picked from commit bd3b21b969)

* [AC-1682] Removed dropping temporary table from scripts

(cherry picked from commit eb7794d592)

* [AC-1682] Removed other temp table drops

(cherry picked from commit 26768b7bf8)

* [AC-1978] Fix issue that allows the web app to have the user type Manager available

(cherry picked from commit 2890f78870)

* [AC-1682] Bump dates on migration scripts

---------

Co-authored-by: Thomas Rittson <31796059+eliykat@users.noreply.github.com>
2024-04-26 14:11:29 +01:00
Rui Tomé
d2abf5b2d7
[AC-2323] Flexible collections: automatically migrate data for all Organizations (#3927)
* [AC-2323] Added script to migrate all sql organizations to use flexible collections

* [AC-2323] Overriding FlexibleCollectionsSignup to true for local usage

* [AC-2323] Fix script comment

* [AC-2323] Fixed typo

* [AC-2323] Bump up date on migration script

* [AC-2323] Bump migration script date

---------

Co-authored-by: Thomas Rittson <31796059+eliykat@users.noreply.github.com>
2024-04-26 14:11:00 +01:00
MtnBurrit0
122d1b7ed7
Remove ComposeVersion from template (#3972) 2024-04-15 14:38:39 -06:00
renovate[bot]
0512102189
[deps] Tools: Update Handlebars.Net to v2.1.6 (#3982)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-04-15 16:56:50 +02:00
Matt Bishop
2790687dc2
[PM-6938] Allow certain database operations to be skipped (#3914)
* Centralize database migration logic

* Clean up unused usings

* Prizatize

* Remove verbose flag from Docker invocation

* Allow certain database operations to be skipped

* Readonly
2024-03-27 11:20:54 -04:00
Michał Chęciński
fd71ed8584
[DEVOPS-1218] Add dryrun mode to MsSqlMigratorUtility (#3795)
* Add dryrun mode to MsSqlMigratorUtility

* Fix

* Update util/MsSqlMigratorUtility/Program.cs

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

* Update util/MsSqlMigratorUtility/Program.cs

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

* Update util/MsSqlMigratorUtility/Program.cs

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

* Fixes

* Fix using

* Format

* Update util/MsSqlMigratorUtility/Program.cs

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

* Fixes

* Fix after merge

* Fix

* Fix

* Remove unnecessary param name

---------

Co-authored-by: Matt Bishop <mbishop@bitwarden.com>
2024-03-25 10:22:02 -04:00
Shane Melton
6a0f6e1dac
[PM-2383] Bulk collection assignment (#3919)
* [PM-2383] Add bulk add/remove collection cipher repository methods

* [PM-2383] Add additional authorization helpers for CiphersControlle

* [PM-2383] Add /bulk-collections endpoint to CiphersController.cs

* [PM-2383] Add EF implementation for new CollectionCipherRepository methods

* [PM-2383] Ensure V1 logic only applies when the flag is enabled for new bulk functionality
2024-03-22 13:16:34 -07:00
Matt Bishop
743465273c
[PM-6909] Centralize database migration logic (#3910)
* Centralize database migration logic

* Clean up unused usings

* Prizatize

* Remove verbose flag from Docker invocation

* Allow argument passthrough still

Co-authored-by: Michał Chęciński <mchecinski@bitwarden.com>

* Allow DI logger

---------

Co-authored-by: Michał Chęciński <mchecinski@bitwarden.com>
2024-03-22 10:54:13 -04:00
Alex Morask
9f7e05869e
[AC-1900] Update Vault DB to support provider billing (#3875)
* Add Gateway columns to Provider table

* Add ProviderId column to Transaction table

* Create ProviderPlan table

* Matt's feedback

* Rui's feedback

* Fixed Gateway parameter on Provider
2024-03-21 11:15:49 -04:00
Daniel James Smith
2b440ed840
Update mssql to CU12 to support linux kernel 6.7.x (#3904)
Co-authored-by: Daniel James Smith <djsmith85@users.noreply.github.com>
2024-03-15 13:02:31 -06:00
Tom
997af0f6ab
[PM-221] Adding CipherId to the Send table, create/update sprocs, and added mi… (#3646)
* Adding CipherId to the Send table, create/update sprocs, and added migrations

* changing migrator script to drop create sprocs

* fixing double brackets

* Revert "changing migrator script to drop create sprocs"

This reverts commit 2d5171e7e5.

* Remove comment I nitpicked

* Script best practices

* Fix typo

* Try recreate again

* Fix missing output

* Revert "Try recreate again"

This reverts commit 38257ebeaa.

---------

Co-authored-by: Matt Bishop <mbishop@bitwarden.com>
Co-authored-by: federicom09 <fmonesiglio@bitwarden.com>
2024-03-04 19:31:33 -05:00
Thomas Avery
1499d1e2c6
[SM-713] Add database support for secret access policies (#3681)
* mssql add column and migration

* Add secret access policies to EF models and config

* Clear new access policies on service account delete

* Add SM cleanup code on delete

* Fix EF org user bulk delete

* Run EF migrations
2024-02-22 10:06:39 -06:00
renovate[bot]
3a6b2d85d3
[deps] DevOps: Update CommandDotNet to v7.0.3 (#3824)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-02-20 15:59:55 -05:00
renovate[bot]
4e6360cc4f
[deps] DbOps: Update EntityFrameworkCore (#3823)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-02-20 09:42:30 -05:00
rkac-bw
744d21ec5e
[PM-4767] Update Grant_Save procedure (#3641)
* modify grant_save sql script to migration and Auth SQL scripts to not use merge

* Update formatting for sql files

* Fix formatting for sql files

* Format using Prettier

* Rename 2024-01-03_00_FixGrantSave.sql to 2024-02-12_00_FixGrantSave.sql

---------

Co-authored-by: Matt Bishop <mbishop@bitwarden.com>
2024-02-14 09:48:58 -07:00
Alex Morask
97018e2501
Upgrade logging packages for .NET 8 (#3798) 2024-02-13 14:34:55 -05:00
github-actions[bot]
ae4fcfc204
Move DbScripts_finalization to DbScripts (#3675)
Co-authored-by: bitwarden-devops-bot <106330231+bitwarden-devops-bot@users.noreply.github.com>
Co-authored-by: Vince Grassia <593223+vgrassia@users.noreply.github.com>
2024-02-12 14:00:09 -05:00
renovate[bot]
615d6a1cd0
[deps] DbOps: Update dbup-sqlserver to v5.0.40 (#3708)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-02-09 12:08:20 -05:00
Shane Melton
636f716d62
[AC-1124] Restrict admins from accessing items in Collections tab (#3676)
* [AC-1124] Add GetManyUnassignedOrganizationDetailsByOrganizationIdAsync to the CipherRepository

* [AC-1124] Introduce IOrganizationCiphersQuery.cs to replace some CipherService queries

* [AC-1124] Add additional CipherDetails model that includes CollectionIds

* [AC-1124] Update CiphersController and response models
- Add new endpoint for assigned ciphers
- Update existing endpoint to only return all ciphers when feature flag is enabled the user has access

* [AC-1124] Add migration script

* [AC-1124] Add follow up ticket for Todos

* [AC-1124] Fix feature service usage after merge with main

* [AC-1124] Optimize unassigned ciphers query

* [AC-1124] Update migration script date

* [AC-1124] Update migration script date

* [AC-1124] Formatting
2024-02-08 14:07:58 -08:00
Colton Hurst
7cbe888b82
SM-1012: Removing SM Beta (Phase 2) (#3663)
* SM-1012: Phase 2, removing SM Beta from the server (but not db)

* SM-1012: Add migration for RemoveSMBetaFromOrganization

* SM-1012: Dotnet format

* SM-1012: Undo RemoveSMBetaFromOrganization EF migration

* SM-1012: Redo RemoveSMBetaFromOrganization EF migration

* SM-1012: Ran dotnet format
2024-02-05 15:51:31 -05:00
Matt Bishop
ae1fdb0992
[PM-5052] Upgrade to .NET 8 (#3461)
* Upgrade to .NET 8

* Linting

* Clean up old JSON deserialization code

* More .NET 8-oriented linting

* Light feedback

* Get rid of old test we don't know the root issue for

* Fix a new test

* Remove now-unnecessary Renovate constraint

* Use Any()

* Somehow a 6.0 tooling config we don't need snuck back in

* Space out properties that always change per release

* Bump a few core packages since the last update
2024-02-05 13:03:42 -05:00
Matt Bishop
472b1f8d44
[PM-5313] Upgrade to SQL Server 2022 (#3580)
* Upgrade to SQL Server 2022

* CU11
2024-02-02 09:35:00 -05:00
Matt Bishop
b20b8099a7
[PM-5314] Upgrade MSSQL cumulative update (#3548)
* Upgrade MSSQL cumulative update

* Go to 24
2024-02-02 08:57:19 -05:00
Rui Tomé
7bf17a20f4
[AC-2104] Add flexible collections properties to provider organizations sync response (#3717) 2024-01-29 14:04:45 -06:00
Rui Tomé
bac06763f5
[AC-1682] Flexible collections: data migrations for deprecated permissions (#3437)
* [AC-1682] Data migrations for OrgUsers or Groups with AccessAll enabled

* [AC-1682] Added script to update [dbo].[CollectionUser] with [Manage] = 1 for all users with Manager role or 'EditAssignedCollections' permission

* [AC-1682] Updated sql data migration procedures with performance recommendations

* [AC-1682] Moved data migration scripts to DbScripts_transition folder

* Apply suggestions from code review: Remove Manage permission from Collection assignments

Co-authored-by: Thomas Rittson <31796059+eliykat@users.noreply.github.com>

* [AC-1682] Removed unnecessary Collection table join on ManagersEditAssignedCollectionUsers sql script

* [AC-1682] Change JOIN to INNER JOIN in SQL scripts

* [AC-1682] Renamed sql script to recent date and added correct order to file name

* [AC-1682] Add new rows to CollectionUser for Managers and users with EditAssignedCollections permission assigned to groups with collection access

* [AC-1682] Update FC data migration scripts to clear AccessAll flags and set all Managers to Users

* [AC-1682] Updated data migration scripts to bump the account revision date

* [AC-1682] Created Organization_EnableCollectionEnhancements to migrate organization data for flexible collections

* [AC-1682] Added script to migrate all organization data for flexible collections

* [AC-1682] Deleted old data migration scripts

* Revert "[AC-1682] Deleted old data migration scripts"

This reverts commit 54cc6fab8f.

* [AC-1682] Modified AccessAllCollectionUsers script to bump revision date by each OrgUser

* [AC-1682] Update data migration script to only enable collection enhancements for organizations that have not yet migrated

* [AC-1682] Updated AccessAllCollectionGroups migration script to use User_BumpAccountRevisionDateByCollectionId

* [AC-1682] Bumped up the date on data migration scripts

* [AC-1682] Added back batching system to AccessAllCollectionUsers data migration script

* [AC-1682] Added data migration script to set FlexibleCollections = 1 for all orgs

* [AC-1682] Modified data migration script to contain multiple transactions

* [AC-1682] Deleted old data migration scripts

* [AC-1682] Placed temp tables outside transactions

* [AC-1682] Removed batching from AllOrgsEnableCollectionEnhancements script

* [AC-1682] Removed bulk data migration script

* [AC-1682] Refactor stored procedure to enable collection enhancements

* [AC-1682] Added missing where clause

* [AC-1682] Modified data migration script to have just one big transaction

* [AC-1682] Combining all updated OrganizationUserIds to bump all revision dates at the same time

* Update src/Sql/dbo/Stored Procedures/Organization_EnableCollectionEnhancements.sql

Co-authored-by: Thomas Rittson <31796059+eliykat@users.noreply.github.com>

* [AC-1682] Renamed aliases

* [AC-1682] Simplified inner queries

* [AC-1682] Bumping each modified groups RevisionDate

* [AC-1682] Removed updating CollectionUser existing records with [ReadOnly] = 0 and [HidePasswords] = 0

* [AC-1682] Updating OrganizationUser RevisionDate

* [AC-1682] Updated the stored procedure file

* [AC-1682] Selecting distinct values to insert into CollectionUser table

* Revert "[AC-1682] Removed updating CollectionUser existing records with [ReadOnly] = 0 and [HidePasswords] = 0"

This reverts commit 086c88f3c6.

* [AC-1682] Bumped up the date on the migration script

* [AC-1682] Updating OrganizationUser RevisionDate

---------

Co-authored-by: Thomas Rittson <31796059+eliykat@users.noreply.github.com>
2024-01-25 14:08:09 +00:00
Thomas Avery
880ceafe9f
[BEEEP] [SM-1059] Add missing auth table indexes to EF config (#3625)
* Add missing indexes to EF auth tables

* Add EF migrations
2024-01-17 10:42:43 -06:00
Matt Bishop
b97a1a9ed2
[PM-5519] [PM-5526] [PM-5624] [PM-5600] More Grant SQL fixes (#3668)
* SQLite scripts to apply autoincrementing Id key

* Drop erroneous Id column if created
2024-01-16 09:08:55 -05:00
renovate[bot]
2df5fe1340
[deps] SM: Update EntityFrameworkCore to v7.0.15 (#3666)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-01-12 16:30:23 -07:00
Matt Bishop
db4d7aa609
[PM-5519] [PM-5526] [PM-5624] [PM-5600] Tweak EF settings for MySQL grant auto-increment (#3662)
* Tweak EF settings for grant auto-increment

* Go back to zero generated default as that doesn't matter

* Explicit value generation callout

* Go with custom SQL for direct automatic increment

* Proper column creation

* Lint
2024-01-11 16:06:29 -05:00
Thomas Rittson
b829812a3f
[AC-2025] Add Organization.FlexibleCollections to database and sprocs (#3642)
* Add Organization.FlexibleCollections property and column

* Add new property to OrganizationAbility

* Add SQL and EF migrations
2024-01-11 13:25:57 +10:00
Thomas Avery
3392ede534
[BEEEP][SM-1062] Add missing table indexes to EF config (#3628)
* Add missing EF indexes

* Add EF migrations

* move configs

* regenerate migrations
2024-01-10 12:03:16 -06:00
Thomas Avery
a480bd16e4
[BEEEP] [SM-1060] Add missing tools table indexes to EF config (#3626)
* Add missing indexes

* Add EF migrations
2024-01-09 09:46:45 -06:00
renovate[bot]
bfa9269b42
[PM-5294][deps]: Update Duende.IdentityServer to v6.3.7 (#3499)
* [deps]: Update Duende.IdentityServer to v6.3.6

* Fix test

* Grant table changes

* Reassert view

* EF migrations

* Restore non-null key and simpler index

* Master SQL sync

* Lint

* Fix ID setting since the property isn't exposed

* Bump to .7

* Point to new Duende package

* Drop unused indexes first

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Matt Bishop <mbishop@bitwarden.com>
2023-12-28 15:04:45 -05:00
Thomas Rittson
e20f533b10
[AC-1985] Fix collection permissions when editing items (#3599)
* Fix broken cipher permissions in UserCipherDetails_V2

* Re-create all sprocs that reference UserCipherDetails_V2
2023-12-28 13:08:03 +10:00
Vincent Salucci
71def39015
[AC-1809] Update OrganizationAbility with Collection Management Settings (#3571)
* feat: Update OrganizationAbility with LimitCollectionCreationDeletion, refs AC-1809

* feat: Update OrganizationAbility constructor usage to pass feature flag state, refs AC-1809

* feat: Update EF retrieval of org abilities to include new property from database, refs AC-1809

* feat: Update sproc to include LimitCollectionCreationDeletion property and create migration, refs AC-1809

* feat: Inject ApplicationCache into handler accessing LimitCollectionCreationDeletion, refs AC-1809

* feat: remove collection management settings from CurrentContextOrganization and update tests, refs AC-1809

* feat: add AllowAdminAccessToAllCollectionItems to OrganizationAbility pipeline, refs AC-1809

---------

Co-authored-by: Thomas Rittson <trittson@bitwarden.com>
Co-authored-by: Thomas Rittson <31796059+eliykat@users.noreply.github.com>
2023-12-28 10:07:06 +10:00
Ike
9b50cf89b7
[PM-3505][PM-4587] Update Delete Organization and User SPROCs and EF methods (#3604)
* update Organization_DeleteById SPROC

* Add migration for user delete

* Updated delete methods for EF support

* added WITH RECOMPILE

* updating sprocs in sql project

* Add recompile
2023-12-27 07:08:49 -08:00
Jared Snider
d2808b2615
Auth/PM-1658 - Dynamic Org Invite Link to accelerate users through org invite accept process (#3378)
* PM-1658 - Create User_ReadByEmails stored proc

* PM-1658 - Update UserRepository.cs with dapper and EF implementations of GetManyByEmailsAsync using new stored proc

* PM-1658 - OrganizationService.cs - Proved out that the new GetManyByEmailsAsync along with a hash set will allow me to generate a a dict mapping org user ids to a bool representing if they have an org user account or not.

* PM-1658 - OrganizationService.cs - re-implement all send invites logic as part of rebase

* PM-1658 - Add new User_ReadByEmails stored proc to SQL project

* PM-1658 - HandlebarsMailService.cs - (1) Remove unnecessary SendOrganizationInviteEmailAsync method as we can simply use the bulk method for one or more emails (2) Refactor BulkSendOrganizationInviteEmailAsync parameters into new OrganizationInvitesInfo class

* PM-1658 - OrganizationService.cs - rebase commit 2

* PM-1658 - rebase commit 3 - org service + IMailService conflicts resolved

* PM-1658 - Update HandlebarsMailService.cs and OrganizationUserInvitedViewModel.cs to include new query params required client side for accelerating the user through the org invite accept process.

* dotnet format

* PM-1658 - rebase commit 4 -  Fix broken OrganizationServiceTests.cs

* PM-1658 TODO cleanup

* PM-1658 - Remove noop for deleted method.

* rebase commit 5 - fix NoopMailService merge conflicts

* PM-1658 - Fix SQL formatting with proper indentations

* PM-1658 - Rename BulkSendOrganizationInviteEmailAsync to SendOrganizationInviteEmailsAsync per PR feedback

* PM-1658 - Per PR Feedback, refactor OrganizationUserInvitedViewModel creation to use new static factory function for better encapsulation of the creation process.

* PM-1658 - Rename OrganizationInvitesInfo.Invites to OrgUserTokenPairs b/c that just makes sense.

* PM-1658 - Per PR feedback, simplify query params sent down to client. Always include whether the user exists but only include the org sso identifier if it is meant to be used (b/c sso is enabled and sso required policy is on)

* dotnet format

* PM-1658 - OrganizationServiceTests.cs - Fix mysteriously failing tests - several tests were falling into logic which created n org users using the organizationUserRepository.CreateAsync instead of the organizationUserRepository.CreateManyAsync method.  This meant that I had to add a new mock helper to ensure that those created org users had valid and distinct guids to avoid aggregate exceptions due to my added dict in the latter parts of the invite process.

* PM-1658 - Resolve errors from mistakes made during rebase merge conflict resolutions

* PM-1658 - OrganizationServiceTests.cs - fix new test with mock to make guids unique.

* dotnet format

---------

Co-authored-by: Matt Bishop <mbishop@bitwarden.com>
2023-12-18 11:16:17 -05:00
Thomas Rittson
985c438f03
[AC-1330] [AC-1850] Deprecate AccessAll in UserCollectionDetails and related sprocs (#3505) 2023-12-13 19:22:30 -05:00
Ike
8bf798a79f
added webauthncredential ef migrations (#3555) 2023-12-13 07:03:42 -08:00
Matt Bishop
890a09804f
Stop using lockfiles (#3550) 2023-12-12 09:09:42 -05:00
renovate[bot]
43eea0d297
[deps] Billing: Update Braintree to v5.21.0 (#3537)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-12-08 14:46:39 -05:00
renovate[bot]
62bf2a146f
[deps] Tools: Update MailKit to v4.3.0 (#3533)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-12-08 18:21:26 +01:00
renovate[bot]
baafbe4576
[deps] Tools: Update SendGrid to v9.28.1 (#3534)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-12-08 18:07:33 +01:00
renovate[bot]
3e323ae3d9
[deps] Platform: Update dotnet monorepo to v6.0.25 (#3507)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-12-08 12:04:13 -05:00
renovate[bot]
3ecec808b6
[deps] Billing: Update Serilog.Extensions.Logging.File to v3 (#3069)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-12-08 11:54:20 -05:00
Thomas Rittson
dbf8907bfc
[AC-1330] [AC-1816] Deprecate AccessAll in CollectionCipher sprocs (#3480) 2023-12-06 11:10:39 +10:00
github-actions[bot]
26e6093c14
Bumped version to 2023.12.0 (#3519)
Co-authored-by: bitwarden-devops-bot <106330231+bitwarden-devops-bot@users.noreply.github.com>
2023-12-05 10:55:20 -05:00
renovate[bot]
b05bdbac01
[deps] SM: Update Dapper to v2.1.24 (#3482)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2023-12-04 16:36:54 -06:00