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

3815 Commits

Author SHA1 Message Date
Oscar Hinton
9cddb769fa
[SM-504] Fix service account not accessing secrets (#2709) 2023-02-22 11:21:07 +01:00
Brandon Maharaj
7365ca0925
[SG-783] Change organization user list to pull the user's selected color and display it in the avatar (#2630)
* work: baseline for org stuff

* fix: missed view as usual oops

* fix: refresh using sp_refreshsqlmodule
2023-02-21 15:59:50 -05:00
Oscar Hinton
146d5b1984
[SM-396] Self-enroll Secrets Manager (#2671)
* Add endpoint for self enrolling in secrets manager

* Add SecretsManager attribute

* Mark endpoint as only cloud, enable secrets manager for the current user

* Remove response
2023-02-21 18:24:49 +01:00
Colton Hurst
16bdd67cad
SM-281: Secrets Manager Trash (#2688) 2023-02-20 13:01:49 -05:00
SmithThe4th
34544f2292
[SG-1082]-Defect-Update stored procedure to properly determine is SSO is available (#2715)
* Fixed SsoAvailble bug by using the enabled column from SsoConfig table, updated the existing query for EF Core

* Added no tracking to ef query since it is read only
2023-02-17 13:19:21 -05:00
Federico Maccaroni
69511160cb
[EC-400] Code clean up Device Verification (#2601)
* EC-400 Clean up code regarding Unknown Device Verification

* EC-400 Fix formatting
2023-02-17 10:15:28 -03:00
Joseph Flinn
7594ca1122
Fix typo in the DockerHub push step (#2713) 2023-02-16 15:32:48 -08:00
Joseph Flinn
133a3f70b9
Don't upload images to DockerHub registries that don't exist (#2712)
* Don't upload images to DockerHub registries that don't exist

* Fix linting issue

* Fix conditional
2023-02-16 15:14:39 -08:00
Joseph Flinn
0fde17fc0e
Add in QA temporary ACR (#2711)
* Adding QA registry back into self-host build pipeline

* switching order of the ACR signin

* Update build pipeline to follow same patterns as build-self-host and push to both Prod and QA registries

* Add Bitwarden QA registry to the PR clean up workflow

* Fix project name and path to dockerfile

* Add a publish branch check to the tag list generator

* Fix bash env var typo
2023-02-16 14:16:32 -08:00
Jared Snider
1bbdafbe7a
Updating Org Domain events to match existing pattern of incrementing event type enum by 100 to group new types of events. (#2710) 2023-02-16 16:26:44 -05:00
cd-bitwarden
ec8476912d
[SM-381] New secrets access (#2629)
* [SM-66] Create Secret Database Table (#2144)

Objective
The purpose of this PR is to create a database table, entity, and repository for the new Secret database table.

The new Secret table will use entity framework for all database providers.

* [SM-67] Get all secrets by org ID (#2163)

Add a controller to fetch secrets associated with an organization ID.

To note, the [SecretsManager] attribute makes this controller only available for local development.

* [SM-68] Add API endpoints for getting, creating, and editing secrets (#2201)

The purpose of this PR is to add API endpoints for getting, creating, and editing secrets for the Secrets Manager project.

* Move interfaces to core (#2211)

* [SM-63] Read UTC DateTimes from databases via EF and order by revision date (#2206)

* Read UTC DateTimes from db and order by revision

* Move orderby to repo layer

* [SM-185] Add EE_Testing_env to server (#2222)

* Sm 104 project Database (#2192)

* Project DB addition and sprocs

* Adding spaces to the end of each file, fixing minor issues

* removing useless comments

* Adding soft delete proc to migration

* Project EF Scaffold

* Additional changes to use EF instead of procedures

* Adding dependency injection

* Fixing lint errors

* Bug fixes

* Adding migration scripts, removing sproc files, and setting up Entity framework code

* Adding back accidentally deleted sproc

* Removing files that shouldn't have been created

* Lint

* Small changes based on Oscar's rec (#2215)

* Migrations for making CreateDate not null

* adding space to end of file

* Making Revision date not null

* dotnet format

* Adding nonclustered indexes to SQL

* SM-104: Update PR with changes Thomas proposed

Co-authored-by: CarleyDiaz-Bitwarden <103955722+CarleyDiaz-Bitwarden@users.noreply.github.com>
Co-authored-by: Thomas Avery <tavery@bitwarden.com>
Co-authored-by: Colton Hurst <colton@coltonhurst.com>

* Removing org ID from create request body (#2243)

* SM-114: Add create & update project endpoints (#2251)

* SM-114: Initial commit with create project endpoint (for SM)

* SM-114: Add Update Project route (for SM)

* SM-114: Fix file encodings

* Fix DI issue for SM Project Create/Update commands

* Fix import ordering for linter

* SM-114: Remove unneeded lines setting DeletedDate, as it should already be null

* SM-114: Only have OrgId in route for CreateProject

* Remove unneeded using

* SM-114: Initial commit with create project endpoint (for SM)

* SM-114: Add Update Project route (for SM)

* SM-114: Fix file encodings

* Fix DI issue for SM Project Create/Update commands

* Fix import ordering for linter

* SM-114: Remove unneeded lines setting DeletedDate, as it should already be null

* SM-114: Only have OrgId in route for CreateProject

* Remove unneeded using

* Fully remove OrgId from ProjectCreateRequestModel

* [SM-64] Soft Delete Secrets (#2253)

* Bulk delete secrets with command unit tests

* Controller unit tests

* Optimize conditionals

* SM-64 bulk delete integration test

* fix test

* SM-64 code review updated

* [SM-65] Fix return empty secrets list (#2281)

* Secrets return empty list

* [SM-246] Use repository in integration test (#2285)

* [SM-190] Add integration tests to Secrets (#2292)

* Adding integration tests for the SecretsController

Co-authored-by: Hinton <hinton@users.noreply.github.com>

* Sm 95 - Adding GetProjects endpoint (#2295)

* SM-114: Initial commit with create project endpoint (for SM)

* SM-114: Add Update Project route (for SM)

* SM-114: Fix file encodings

* Fix DI issue for SM Project Create/Update commands

* Adding GetProjectsByOrg

* fixing merge conflicts

* fix

* Updating to return empty list

* removing null check

Co-authored-by: Colton Hurst <colton@coltonhurst.com>
Co-authored-by: CarleyDiaz-Bitwarden <103955722+CarleyDiaz-Bitwarden@users.noreply.github.com>

* [SM-191] Create ServiceAccount Table (#2301)

* SM-191 Create ServiceAccount Table

* [SM-207] API for listing service accounts by organization (#2307)

* SM-207 list service accounts by org

* SM-96: Add ability to get project by id (#2314)

* SM-96: Small change to allow getting project by id

* Fix whitespace issue

* Add first integration test and fix date bug

* Ensure tests are consistent

* Add more project controller integration tests

* Remove commented delete for now

* [SM-187] Create ServiceAccounts (#2323)

* SM-187 Create & Update ServiceAccounts

* Remove extra new line src/Api/Controllers/ServiceAccountsController.cs

Co-authored-by: Oscar Hinton <Hinton@users.noreply.github.com>

* [SM-218] [SM-219] SM Auth flow (#2297)

* SM-282 Delete Projects (#2335)

* SM-282 delete & bulk delete projects

* Have delete commands return tuple with object

* Fix admin project not working after secrets manager changes (#2339)

* [SM-150] proj and secrets mapping (#2286)

* Beggining of changes for Project Secrets mapping

* Beggining of changes for project and secrets mapping

* Inital changes to add Mapping table for Project Secrets

* Resolve migration not working properly

* Indent sql

* Changes to try and return projects in the GetManyByOrganizaationIDAsync on SecretRepository.

* Changes made with Oscar

* Add reversemap

* running lint and removing comments

* Lint fixes

* fixing merge issues

* Trying to fix the DB issue

* DB fixes

* fixes

* removing unused space

* fixing lint issue

* final lint fix I hope

* removing manually added sql.sqlproj

* Lint changes and fixing the sql proj issues

* adding ServiceAccount to sql proj

* Removing ON DELETE CASCADE

* remove On delete cascade

* changes for deleting project and secret inside of the Organization_DeleteById procedure.

* changes for deleting project and secret inside of the Organization_DeleteById procedure.

* migration changes

* Updating constraints

* removing void

* remove spaces

* updating cipherRepo tests to be task instead of void

* fixing

* fixing

* test

* fix

* fix

* changes to remove circular dependency

* fixes

* sending guid and string name of the project over

* Update src/Sql/dbo/Tables/Secret.sql

Co-authored-by: Oscar Hinton <Hinton@users.noreply.github.com>

* Update src/Sql/dbo/Tables/Project.sql

Co-authored-by: Oscar Hinton <Hinton@users.noreply.github.com>

* removing unused code

* Potential refactor (#2340)

* migrations

* Postgres migraiton

* Update src/Api/SecretManagerFeatures/Models/Response/SecretResponseModel.cs

Co-authored-by: Oscar Hinton <Hinton@users.noreply.github.com>

* rename file

* Update util/Migrator/DbScripts/2022-09-19_00_ProjectSecret.sql

Co-authored-by: Oscar Hinton <Hinton@users.noreply.github.com>

* Lint fixes

* removing extra semi colon

* removing circular references with projects and secrets

* adding back projects

* Add ProjectFixture

* Update util/Migrator/DbScripts/2022-09-19_00_ProjectSecret.sql

Co-authored-by: Oscar Hinton <Hinton@users.noreply.github.com>

* Update util/Migrator/DbScripts/2022-09-19_00_ProjectSecret.sql

Co-authored-by: Oscar Hinton <Hinton@users.noreply.github.com>

Co-authored-by: CarleyDiaz-Bitwarden <103955722+CarleyDiaz-Bitwarden@users.noreply.github.com>
Co-authored-by: Hinton <hinton@users.noreply.github.com>

* [SM-300] Access token endpoint (#2377)

* [SM-324] Add Organization to JWT claim (#2379)

* [SM-259] Add create access token endpoint for service accounts (#2411)

* Add create access token for service accounts

* [SM-259] Fix create access token scope initialization (#2418)

* Fix namespace for ServiceAccount command tests

* Remove "this" from SecretsManager requests

* Fix have scope be assigned a JSON list

* SM-99: Individual Project / Secrets Tab (#2399)

Co-authored-by: Oscar Hinton <Hinton@users.noreply.github.com>

* [SM-361] Add Support for never expiring ApiKeys (#2450)

* Update database to support never expiring ApiKey

* Update Api to support never expiring ApiKeys

* Fix unit test variable naming

* Remove required from model

* Fix spacing

* Add EF migrations

* Run dotnet format

* Update util/Migrator/DbScripts/2022-11-29_00_ApiKey_Never_Expire.sql

Co-authored-by: Oscar Hinton <Hinton@users.noreply.github.com>

Co-authored-by: Oscar Hinton <Hinton@users.noreply.github.com>

* [SM-359] Fix project secrets migration (#2443)

* [SM-299] Add UseSecretsManager flag (#2413)

* [SM-193] Access Policy (#2359)

* [SM-371] Fix and re-enable parallel integration tests (#2460)

* Fix and re-enable parallel integration tests

* Fix package lock files

* Move fix to ApiApplicationFactory

* Run dotnet restore --force

* Run dotnet format

* Reset packages.lock.json files

* Add project access checks for listing

* SM-99: Add CreateSecretWithProject Integration Test (#2452)

* Add GetSecretsByProjectAsync endpoint

* Add GetManyByProjectIdAsync endpoint

* Update response model for GetSecretsByProjectAsync

* Include projects when returning secrets by project id

* SM-99: Add ability to specify projectId when creating a secret

* SM-99: Update tests to accomodate for new create secret parameter

* Fix failing test

* SM-99: Handle optional projectId for new secret in ToSecret()

* SM-99: Filter out deleted secrets on GetManyByProjectIdAsync() and small refactorings

* SM-99: make CreateAsync for secret more clear

* Add CreateSecretWithProject integration test

* Fix CreateSecretWithProject integration test for SM-99

* Run dotnet format

* Undo added space

* Refactor test

* Refactor CreateSecretWithProject API Integration test again

* Change to boolean flag

* [SM-379] Add SDK device type (#2486)

* Add support for service accounts

* Improve logic for project repository

* Add remaining client types

* Experiment with separate enum for access control

* Add access checks to update project

* Rework AccessClientType

* Add access checks to fetching project

* Add checks to delete project command (untested)

* Remove some service account stuff

* Add ServiceAccount to AccessClientType

* Change CS8509 to error and 8424 to ignore

* Remove unused utcNow

* Fix delete tests

* SM-73 changes (#2422)

* testing

* test2

* testing

* trying to save the projects associated with the secret

* changes

* more changes

* Fix  EF error

* Second attempt

* Replace AddIfNotExists with Add.

* changes

* fixing await issue

* lint

* lint fixes

* suggested changes

* suggested changes

* updating tests

* fixing tests 2

* fixing tests

* fixing test

* fixing test

* fixing tests

* test

* testing

* fixing tests for the millionth time

* fixing tests

* allowing nulls for projectIds, fixing lint

* fixing tests

Co-authored-by: Hinton <hinton@users.noreply.github.com>

* fixing tests

* fixing tests

* [SM-222] [SM-357] Squash Secrets Manager migrations (#2540)

* Fix tables not being cleaned up

* Fix migration

* Squash secrets manager migrations

* Reset EF to pre SM state

* Add EF migrations

* Fix unified docker

* Add missed copy

* Fix all unit tests

* draft changes to add access checks to secrets

* updating code

* more changes

* fixing issues

* updating logic for access checks

* updating secrets controller

* changes

* changes

* merging more

* changes

* updateS

* removing unused comment

* changes requested by Thomas

* more changes suggested by Thomas

* making thomas's suggested changes

* final changes

* Run dotnet format

* fixes

* run dotnet format

* Updating tests

* Suggested changes

* lint fixes

* Test updates

* Changes

* Fixes for tests, and dotnet format

* Fixes

* test fixes

* changes

* fix

* fix

* test fix

* removing duplicate

* Removing dupe

---------

Co-authored-by: Thomas Avery <43214426+Thomas-Avery@users.noreply.github.com>
Co-authored-by: Oscar Hinton <Hinton@users.noreply.github.com>
Co-authored-by: CarleyDiaz-Bitwarden <103955722+CarleyDiaz-Bitwarden@users.noreply.github.com>
Co-authored-by: Thomas Avery <tavery@bitwarden.com>
Co-authored-by: Colton Hurst <colton@coltonhurst.com>
2023-02-16 11:42:07 -08:00
Brandon Maharaj
bcaba6652b
[SG-1022] Update min password requirements to 12 char (#2677)
* fix: update to 10

* work: 12
2023-02-16 13:15:45 -05:00
Thomas Avery
bcc2a2a1ce
[SM-502] Fix Users with no name (#2698)
* Return email if username is empty
2023-02-16 10:05:19 -06:00
Thomas Avery
f288787a45
[SM-495] Access Policies - Individual Service Account - Project Tab (#2697)
* New endpoints to support sa projects tab

* Refactor create; Add tests

* Add creation request limit
2023-02-16 09:47:34 -06:00
Oscar Hinton
770a341a61
Remove file scoped namespaces instructions (#2708) 2023-02-16 16:24:01 +01:00
Oscar Hinton
6da1b87e00
Fix name of FixOrganizationDeleteOrgDomain (#2706) 2023-02-16 15:53:28 +01:00
Oscar Hinton
7a209aa3bb
[SM-501] Add support for revoking access tokens (#2692)
* Add support for revoking access tokens
2023-02-16 10:51:02 +01:00
Colton Hurst
e6635ff590
SM-365: Fix Import Secrets Bug (#2703) 2023-02-15 23:52:50 -05:00
SmithThe4th
9a484bec07
[SG-147] Organization Domain Claiming Feature (#2704)
* [SG-696] Organization Domain Claiming DB Objects and Migrations (#2394)

* model organization domain claiming

* Added migration scripts and db objects for mssql

* create and implement sql repository abstraction

* Added ef migrations for mysql and postgres. Removed time without timezone in previous migration

* made update on sql migration to use create or alter statement

* removed active column from OrganizationDomain table and decided to go with the hard delete approach

* Ran dotnet restore evaluate

* created DNS service verification using DNSClient (#2401)

* [SG-678] Api Endpoints for Domain Claiming (#2430)

* Added stored procedure to read claimed domains

* Updated Organization Domain Repository to include method to get claimed domains

* Updated domain entity and added request model

* Implemented organization domain respository and regsitered it in the various extensions

* Added create endpoint, request, responses and command

* Added endpoint to get domain by domain entry id

* Ran lint fix

* Added new stored procedure to get domains by organizattion id

* Moved migration scripts to init migration and added new procedure

* Renamed from domainId to Id

* Added and implemented GetDomainByOrganizationId

* Completed GetDomainByOrgId endpoint and started work on verify domain endpoint

* Updated the OrganizationDomain update procedure

* Added delete command and include other endpoints in the controller

* Remove test item from controller

* Remove test item from controller

* Changed access to allow admin, owners and manage sso roles

* changed logic for setting the initial value for the NextRunCount

* Renamed NextRunCount to JobRunCount

* Renamed NextRunCount to JobRunCount on mysql

* Renamed NextRunCount to JobRunCount on postgres

* Removed chaining pattern and added logic to get next run date

* Lint fix

* Added stored procedure to get organization sso details by email address

* Added endpoint to get sso details of an organization with email

* Added organizationDomainRepository to OrganizationController test

* merged with master and fixed conflicts

* [SG-661] Background Domain Verification Service (#2455)

* Added stored procedure to read claimed domains

* Updated Organization Domain Repository to include method to get claimed domains

* Updated domain entity and added request model

* Implemented organization domain respository and regsitered it in the various extensions

* Added create endpoint, request, responses and command

* Added endpoint to get domain by domain entry id

* Ran lint fix

* Added new stored procedure to get domains by organizattion id

* Moved migration scripts to init migration and added new procedure

* Renamed from domainId to Id

* Added and implemented GetDomainByOrganizationId

* Completed GetDomainByOrgId endpoint and started work on verify domain endpoint

* Updated the OrganizationDomain update procedure

* Added delete command and include other endpoints in the controller

* Remove test item from controller

* Remove test item from controller

* Changed access to allow admin, owners and manage sso roles

* Added stored procedure to get unverified domains by nextrundate

* Renamed stored procedure name

* Added domain verification service interface

* Added GetManyByNextRunDate to repository

* Added verification domain service implementation

* changed logic for setting the initial value for the NextRunCount

* This commit should be signed using my SSH key

* Renamed NextRunCount to JobRunCount

* Renamed NextRunCount to JobRunCount on mysql

* Renamed NextRunCount to JobRunCount on postgres

* Removed chaining pattern and added logic to get next run date

* Lint fix

* Implemented EF core version on the repository

* Created background job implementation and logic

* popped stash

* Updated stored procedure and EF script

* Lint fix

* Added logic to set next job count and the next run date when a verification is false

* Added logic to set next job count and the next run date when a verification is false

* Updated stored procedure name on repository

* Removed test trigger

* Lint fix

* Added trigger for job

* Added job count update after successful domain verification

* Lint fix

* Lint fix

* [SG-682] Add Event Log Entries to Organization Domain (#2492)

* Added domain name property to Event related objects

* Added organization domain claiming event types

* Created migration script and updated related event scripts to include domanName

* Added EF Migrations

* Renamed postres script file extension

* Added DomainName property to response model

* Added abstraction to interface

* Added system name to enum

* dotnet formattinfg fix

* Added events to organization domain actions

* Added LastCheckedDate property to domain

* Migrations and stored procedure updates with new column

* Added new stored procedure to get domain by org id and domain name

* Log organization domain event abstract method

* Ef migrattion to add new LastCheckedDate column

* Added duplicate domain exception

* Modified create command to include domain verification and last checked date and renamed methods used

* removed variable

* changed service lifetime

* Renamed trigger

* Initialed property in constructor

* Ensured domain name is stored as lower case

* Fixed suggestions from review

* Fixed suggestions from review

* Return Conflict Status on Organization Domain APIs (#2498)

* Added conflict response to end point to help translate error message on the client better

* Added conflict response to end point to help translate error message on the client better

* Set message with exception message or generic message

* Added last check date to response model (#2499)

* Fix/Check to throw exception when domain is claimed by another organization (#2503)

* Added check to ensure domain claimed by another organization cannot be verified

* Made error message consistent

* [SG-660] Organization Domain Maintenance (#2502)

* Added email template

* Mail service abstraction and implementation

* Mail template model

* Initial delete job commit

* Added SPs to get all unverifed domains after 72 hours and another to delete unverified domains after 7 days

* Moved all organization domain scripts to single file

* Added new scripts implementation for sqlserver and EF core

* Renamed service

* Formatting fix

* Added background service to send warning email and delete expired domains

* Renamed variable

* Added implementation for email warning to organization admins and for deleting expired domains after 7 days

* Added formatting

* Modified read if expired script to limit result to 4 days

* Added send mail abstract method and implementation

* Model used in build mail body

* Completed maintenace service

* Added comment to make logic clear

* Fixed cron expression (#2505)

* Modified procedure and methods to handle flexible verification adn expiration period (#2517)

* Merged with master

* [SG-908] Unit Tests for Organization Domain Claiming Feature (#2522)

* added test controlleer class

* added unit test for create command

* Added query tests

* Added tests for delete and verify command

* Formated code and added some more unit tests

* Fixed lint

* Added log event assertion to create command tests

* Added log event assertion to delete command tests

* Added unit tests for organization domain controller

* Added unit tests for organization domain service

* Modified test after merge

* fixed comment

* fixed comment

* fixed lint

* Defect/SG-977 - Org domain event logs missing details (#2573)

* SG-977 - (1) Refactor EventSystemUser.SSO to be EventSystemUser.DomainVerification to better match SCIM property and for easier display and translation on web client (2) Add new DeviceType of Server to be used on SCIM and Domain Verification logs so event log will show Server as client.

* SG-977 - SCIM bugfix - Restoring / Revoking user access via Jumpcloud activation / suspension did not properly log the events as SCIM events so the client side showed Unknown for both Client and Member.

* Run autoformat to fix lint errors

* SG-977 - Fixed broken test due to new device type logic in event service

* SG-976 - Add admin log and clean up log verbiage for domain verification (#2574)

* SG-976 - Add admin log and clean up log verbiage for domain verification

* SG-976 - (1) Use logInformation extension without exception (2) Clarify verbiage of logs

* SG-955 - On domain verification error or failure, set last checked da… (#2541)

* SG-955 - On domain verification error or failure, set last checked date on the org domain.

* SG-955 - Refactoring VerifyOrganizationDomain event logging to avoid duplication and increase efficiency (based on Gbubemi's PR feedback)

* Org Domain Background Verification service - set last checked date (#2599)

* Refactored OrganizationDomain repository to work with latest changes on code base

* Fixed formatting

* [SG-957] Cannot Delete Organizations due to FK Constraint (#2602)

* Added stored procedure to fix FX contstraint issue when deleting an organization

* Update stored procedures related to organization delete with OrganizationDomain_OrganizationDelete SP

* Fixed formatting

* Updated SP

* SG-990 - Log expired domains that are going to be deleted.

* Fix lint errors with auto format

* /home/runner/work/server/server/src/Core/OrganizationFeatures/OrganizationServiceCollectionExtensions.cs(107,2): error FINALNEWLINE: Fix final newline. Insert '\n'.

* Added missing bracket to fix compile error.

* Added imports for Domain Claiming classes that were lost on merge.

* Fixing broken unit tests + adding proper behavior for newly added SCIM logic changing device type

* Fix lint errors again

* Included domain name set in constructor (#2618)

* [SG-1001] Error Thrown When Verifying Sub Domains (#2621)

* Renamed exception to a more generic name that receives error message from the dns client and also added updates to job count and next run date

* Improved error logs by adding dns client error message

* Fixed formatting

* [SG-1001] Added event logs when a domain is not verified due to thrown exception (#2623)

* Added eevent logs when a domain is not verified due to thrown exception

* Fixed formatting

* Org Domain Verification - Small refactor to improve method/model name… (#2641)

* Org Domain Verification - Small refactor to improve method/model names and method locations - required refactoring of controller routes (I confirmed all behavior still functional)

* Fixed organization test controller issue

* Fixed lint

* Autoformat org domain controller

* Removing whitespace for lint argh, why does Rider not do this.

---------

Co-authored-by: gbubemismith <gsmithwalter@gmail.com>

* Tweak name of Request model to match Response model for ClaimedOrgDomain call

* [SG-1009] Users with Custom Role and "Manage SSO" permission don't receive verification failed email (#2645)

* Modified condition to pick up unverified domains after said period

* Fix to get emails of custom users with manage sso rights

* Formatted code

* Removed return that made background job exit on successful validation (#2648)

* [SG-1014] Unit Tests for Get Organization Sso Details (#2655)

* Added unit tests for GetOrgDomainSsoDetails

* renamed variable

* Adjust OrganizationDomainSsoDetails_ReadByEmail to use outer join so … (#2657)

* Adjust OrganizationDomainSsoDetails_ReadByEmail to use outer join so that claimed domain results will come back if an org has not yet setup a policy

* Removed migration as not needed

* Updated OrganizationDomainSsoDetails_ReadByEmail from original creation migration to use outer join & handle null policy results (and still return results)

* Fixed lint formatting

---------

Co-authored-by: Jared Snider <116684653+JaredSnider-Bitwarden@users.noreply.github.com>
Co-authored-by: Jared Snider <jsnider@bitwarden.com>
Co-authored-by: Todd Martin <tmartin@bitwarden.com>
2023-02-15 14:26:41 -05:00
Michał Chęciński
9261fcc9ee
Add pull request trigger to build self-host workflow (#2701) 2023-02-15 17:04:03 +01:00
Michał Chęciński
70a7108bba
Fix Azure login in build self host workflow (#2700) 2023-02-15 17:03:51 +01:00
Michał Chęciński
b44ff27d3a
[DEVOPS-1211] Push docker only to bitwardenprod ACR (#2695)
* Push docker only to prod ACR

* Remove matrix in container registry purge
2023-02-15 11:45:46 +01:00
Michał Chęciński
8138db396b
Fix secrets retrieval in build-self-host workflow (#2696) 2023-02-15 11:45:27 +01:00
Michał Chęciński
5aa8f3db81
[DEVOPS-1161] fix the rate limiting issue in building bitwarden unified (#2694)
* Add GH_PAT secret to build

* Fix secret

* Fix

* Fix

* Maybe fix

* add cat for tags.json

* Maybe fix

* Matbe fix

* Trying to fix

* Change gh_pat path

* Fix

* Remove obsolete tags obtaining
2023-02-14 09:41:59 -07:00
github-actions[bot]
ee03ad4158
Bumped version to 2023.2.0 (#2693)
Co-authored-by: bitwarden-devops-bot <106330231+bitwarden-devops-bot@users.noreply.github.com>
2023-02-14 10:30:49 -05:00
Colton Hurst
5836c87bb4
SM-365: Add Export & Import Functionality for SM (#2591)
* SM-365: Add Export endpoint

* SM-365: Add SM Import/Export support

* SM-365: Fix DI and add temp NoAccessCheck

* SM-365: Add access checks to import / export

* SM-365: dotnet format

* SM-365: Fix import bugs

* SM-365: Fix import bug with EF & refactor based on PR comments

* SM-365: Update access permissions in export

* SM-365: Address PR comments

* SM-365: Refactor for readability and PR comments
2023-02-14 09:24:31 -05:00
Oscar Hinton
109d915d9e
Disable storage in tests (#2689) 2023-02-13 18:10:53 +01:00
Oscar Hinton
c24b086275
[SM-500] Upload sql diff for database validation (#2690) 2023-02-13 15:07:42 +01:00
Thomas Avery
35b832dbc9
[SM-485] Add access policy on project creation (#2678)
* Add bootstrap access policy on create

* Update project integration tests
2023-02-09 08:58:05 -06:00
Andreas Coroiu
04c4be8a15
[EC-489] chore: remove obsolete identifier field (#2635)
* [EC-489] chore: remove obsolete `identifier` field

* [EC-489] chore: remove identifier from org response model
2023-02-08 16:33:45 +01:00
Andreas Coroiu
e3fdb2636b
[EC-1055] [Tech Debt/Bug] Sql.sqlproj is missing sprocs (#2664)
* [EC-1055] fix: add missing sprocs to sqlproj

* [EC-1055] fix: remove duplicate sproc
2023-02-08 10:39:40 +01:00
Stepan Goremykin
d32cd79535
[PS-2425] Upgrade vulnerable packages (#2669)
* Upgrade vulnerable packages

* Added packages.lock.json files

---------

Co-authored-by: Matt Gibson <mgibson@bitwarden.com>
2023-02-07 17:44:40 -06:00
Thomas Avery
1ee14d93e6
[SM-473] Access Policies - Service Accounts (#2658)
* Add service account access policy endpoints

* Add unit & integration tests for new endpoints

* Fix formatting on response models

* Cleanup unit tests
2023-02-07 14:30:22 -06:00
Thomas Avery
cf669286ed
[SM-429] Add permission checks to access policy endpoints (#2628)
* Add permission checks to access policy endpoints

* Fix unit tests

* Add service account grant permission checks

* Add service account grant tests

* Add new endpoint unit tests

* Cleanup unit tests add integration tests

* User permission enum in create tests

* Swap to NotFoundException for access checks

* Add filter for potential grantees

* Add in AccessSecretsManager check and test it

* Add code review updates

* Code review updates

* Refactor potential grantees endpoint

* Code review updates
2023-02-06 11:26:06 -06:00
Brandon Maharaj
9110efa44e
fix: update to 10 (#2670) 2023-02-06 11:36:03 -05:00
Andreas Coroiu
113ee8a680
[EC-861] feat: Add external id to member api (#2594) 2023-02-06 15:54:44 +01:00
Andreas Coroiu
55cc022d9b
[EC-1003] feat: remove externalId from PUT/POST (#2589) 2023-02-06 10:27:40 +01:00
Kyle Spearrin
6514bdbb7e
add more CSPs to the default correction check (#2668)
* add more CSPs to the default correction check

* add Dec2020ContentSecurityPolicy
2023-02-03 16:04:03 -05:00
Kyle Spearrin
0e84678150
[PS-2416 and PS-2417] dont set CSP config value by default (#2667)
* dont set CSP config value by default

* space
2023-02-03 14:50:33 -05:00
Kyle Spearrin
7e74695afc
add timestamps to user table for security related events (#2660)
* add timestamps to user table for security related events

* ef migrations

* fix lint problems

* formatting

* add missing namespace back

* move `now` up some

* review fixes

* add missing view rebuild to migration script
2023-02-02 14:39:57 -05:00
Thomas Avery
0ce95ec147
[SM-465] Add access policy on service account creation (#2649)
* Add access policy on service account creation
2023-02-02 12:25:14 -06:00
Justin Baur
6390aaa011
Send in Guid instead of Cipher (#2662) 2023-02-02 12:12:41 -05:00
Michael Zimmermann
e019f0191d
fix bumping AccountRevisionDate when creating and updating ciphers (#2634)
When the user is not part of an organization,
`UserBumpAccountRevisionDateByCipherIdQuery` doesn't work. In that case
we have to use `UserBumpAccountRevisionDateAsync` instead.

This was already done by most parts of the code but a few more were
missing.

Fixes #2615
2023-02-02 09:33:35 -05:00
Thomas Avery
28a3d4ad92
Add EF migrations for SecretsManager flag (#2659)
* Add EF migrations for SecretsManager flag
2023-02-01 12:27:13 -06:00
Kyle Spearrin
522df6e91a
add wasm-unsafe-eval to CSP (#2656) 2023-01-31 16:21:06 -05:00
Thomas Rittson
285b2ae55b
Add explicit options to db migration script (#2637) 2023-01-31 13:41:11 -05:00
Oscar Hinton
cf25d55090
[SM-378] Enable SM on a user basis (#2590)
* Add support for giving individual users access to secrets manager
2023-01-31 18:38:53 +01:00
Kyle Spearrin
54353f8b6c
HeartbeatHostedService use cancel token (#2654) 2023-01-31 11:20:21 -05:00
Kyle Spearrin
8ba806667c
add custom dp services to more projects (#2653) 2023-01-31 11:20:05 -05:00
Kyle Spearrin
814ca7b30b
Fix HeartbeatHostedService logger (#2650) 2023-01-31 09:59:15 -05:00