Skip to content

Commit 4f405e1

Browse files
authored
Merge branch 'main' into vault/pm-28190/sdk-sharing-feature-flag
2 parents 4d66f08 + 0e72257 commit 4f405e1

212 files changed

Lines changed: 17589 additions & 1432 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.checkmarx/config.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,7 @@ checkmarx:
1111
filter: "!test"
1212
kics:
1313
filter: "!dev,!.devcontainer"
14+
sca:
15+
filter: "!dev,!.devcontainer"
16+
containers:
17+
filter: "!dev,!.devcontainer"

.devcontainer/community_dev/devcontainer.json

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,12 @@
33
"dockerComposeFile": "../../.devcontainer/bitwarden_common/docker-compose.yml",
44
"service": "bitwarden_server",
55
"workspaceFolder": "/workspace",
6+
"initializeCommand": "mkdir -p dev/.data/keys dev/.data/mssql dev/.data/azurite dev/helpers/mssql",
67
"features": {
78
"ghcr.io/devcontainers/features/node:1": {
8-
"version": "16"
9-
}
9+
"version": "22"
10+
},
11+
"ghcr.io/devcontainers/features/rust:1": {}
1012
},
1113
"mounts": [
1214
{
@@ -21,5 +23,27 @@
2123
"extensions": ["ms-dotnettools.csdevkit"]
2224
}
2325
},
24-
"postCreateCommand": "bash .devcontainer/community_dev/postCreateCommand.sh"
26+
"postCreateCommand": "bash .devcontainer/community_dev/postCreateCommand.sh",
27+
"forwardPorts": [1080, 1433, 3306, 5432],
28+
"portsAttributes": {
29+
"default": {
30+
"onAutoForward": "ignore"
31+
},
32+
"1080": {
33+
"label": "Mail Catcher",
34+
"onAutoForward": "notify"
35+
},
36+
"1433": {
37+
"label": "SQL Server",
38+
"onAutoForward": "notify"
39+
},
40+
"3306": {
41+
"label": "MySQL",
42+
"onAutoForward": "notify"
43+
},
44+
"5432": {
45+
"label": "PostgreSQL",
46+
"onAutoForward": "notify"
47+
}
48+
}
2549
}

.devcontainer/community_dev/postCreateCommand.sh

Lines changed: 41 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,46 @@ export DEV_DIR=/workspace/dev
33
export CONTAINER_CONFIG=/workspace/.devcontainer/community_dev
44
git config --global --add safe.directory /workspace
55

6+
if [[ -z "${CODESPACES}" ]]; then
7+
allow_interactive=1
8+
else
9+
echo "Doing non-interactive setup"
10+
allow_interactive=0
11+
fi
12+
13+
get_option() {
14+
# Helper function for reading the value of an environment variable
15+
# primarily but then falling back to an interactive question if allowed
16+
# and lastly falling back to a default value input when either other
17+
# option is available.
18+
name_of_var="$1"
19+
question_text="$2"
20+
default_value="$3"
21+
is_secret="$4"
22+
23+
if [[ -n "${!name_of_var}" ]]; then
24+
# If the env variable they gave us has a value, then use that value
25+
echo "${!name_of_var}"
26+
elif [[ "$allow_interactive" == 1 ]]; then
27+
# If we can be interactive, then use the text they gave us to request input
28+
if [[ "$is_secret" == 1 ]]; then
29+
read -r -s -p "$question_text" response
30+
echo "$response"
31+
else
32+
read -r -p "$question_text" response
33+
echo "$response"
34+
fi
35+
else
36+
# If no environment variable and not interactive, then just give back default value
37+
echo "$default_value"
38+
fi
39+
}
40+
641
get_installation_id_and_key() {
742
pushd ./dev >/dev/null || exit
843
echo "Please enter your installation id and key from https://bitwarden.com/host:"
9-
read -r -p "Installation id: " INSTALLATION_ID
10-
read -r -p "Installation key: " INSTALLATION_KEY
44+
INSTALLATION_ID="$(get_option "INSTALLATION_ID" "Installation id: " "00000000-0000-0000-0000-000000000001")"
45+
INSTALLATION_KEY="$(get_option "INSTALLATION_KEY" "Installation key: " "" 1)"
1146
jq ".globalSettings.installation.id = \"$INSTALLATION_ID\" |
1247
.globalSettings.installation.key = \"$INSTALLATION_KEY\"" \
1348
secrets.json.example >secrets.json # create/overwrite secrets.json
@@ -30,11 +65,10 @@ configure_other_vars() {
3065
}
3166

3267
one_time_setup() {
33-
read -r -p \
34-
"Would you like to configure your secrets and certificates for the first time?
68+
do_secrets_json_setup="$(get_option "SETUP_SECRETS_JSON" "Would you like to configure your secrets and certificates for the first time?
3569
WARNING: This will overwrite any existing secrets.json and certificate files.
36-
Proceed? [y/N] " response
37-
if [[ "$response" =~ ^([yY][eE][sS]|[yY])+$ ]]; then
70+
Proceed? [y/N] " "n")"
71+
if [[ "$do_secrets_json_setup" =~ ^([yY][eE][sS]|[yY])+$ ]]; then
3872
echo "Running one-time setup script..."
3973
sleep 1
4074
get_installation_id_and_key
@@ -50,11 +84,4 @@ Proceed? [y/N] " response
5084
fi
5185
}
5286

53-
# main
54-
if [[ -z "${CODESPACES}" ]]; then
55-
one_time_setup
56-
else
57-
# Ignore interactive elements when running in codespaces since they are not supported there
58-
# TODO Write codespaces specific instructions and link here
59-
echo "Running in codespaces, follow instructions here: https://contributing.bitwarden.com/getting-started/server/guide/ to continue the setup"
60-
fi
87+
one_time_setup

.devcontainer/internal_dev/devcontainer.json

Lines changed: 79 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,12 @@
66
],
77
"service": "bitwarden_server",
88
"workspaceFolder": "/workspace",
9+
"initializeCommand": "mkdir -p dev/.data/keys dev/.data/mssql dev/.data/azurite dev/helpers/mssql",
910
"features": {
1011
"ghcr.io/devcontainers/features/node:1": {
11-
"version": "16"
12-
}
12+
"version": "22"
13+
},
14+
"ghcr.io/devcontainers/features/rust:1": {}
1315
},
1416
"mounts": [
1517
{
@@ -24,9 +26,18 @@
2426
"extensions": ["ms-dotnettools.csdevkit"]
2527
}
2628
},
29+
"onCreateCommand": "bash .devcontainer/internal_dev/onCreateCommand.sh",
2730
"postCreateCommand": "bash .devcontainer/internal_dev/postCreateCommand.sh",
28-
"forwardPorts": [1080, 1433, 3306, 5432, 10000, 10001, 10002],
31+
"forwardPorts": [
32+
1080, 1433, 3306, 5432, 10000, 10001, 10002,
33+
4000, 4001, 33656, 33657, 44519, 44559,
34+
46273, 46274, 50024, 51822, 51823,
35+
54103, 61840, 61841, 62911, 62912
36+
],
2937
"portsAttributes": {
38+
"default": {
39+
"onAutoForward": "ignore"
40+
},
3041
"1080": {
3142
"label": "Mail Catcher",
3243
"onAutoForward": "notify"
@@ -48,12 +59,76 @@
4859
"onAutoForward": "notify"
4960
},
5061
"10001": {
51-
"label": "Azurite Storage Queue ",
62+
"label": "Azurite Storage Queue",
5263
"onAutoForward": "notify"
5364
},
5465
"10002": {
5566
"label": "Azurite Storage Table",
5667
"onAutoForward": "notify"
68+
},
69+
"4000": {
70+
"label": "Api (Cloud)",
71+
"onAutoForward": "notify"
72+
},
73+
"4001": {
74+
"label": "Api (SelfHost)",
75+
"onAutoForward": "notify"
76+
},
77+
"33656": {
78+
"label": "Identity (Cloud)",
79+
"onAutoForward": "notify"
80+
},
81+
"33657": {
82+
"label": "Identity (SelfHost)",
83+
"onAutoForward": "notify"
84+
},
85+
"44519": {
86+
"label": "Billing",
87+
"onAutoForward": "notify"
88+
},
89+
"44559": {
90+
"label": "Scim",
91+
"onAutoForward": "notify"
92+
},
93+
"46273": {
94+
"label": "Events (Cloud)",
95+
"onAutoForward": "notify"
96+
},
97+
"46274": {
98+
"label": "Events (SelfHost)",
99+
"onAutoForward": "notify"
100+
},
101+
"50024": {
102+
"label": "Icons",
103+
"onAutoForward": "notify"
104+
},
105+
"51822": {
106+
"label": "Sso (Cloud)",
107+
"onAutoForward": "notify"
108+
},
109+
"51823": {
110+
"label": "Sso (SelfHost)",
111+
"onAutoForward": "notify"
112+
},
113+
"54103": {
114+
"label": "EventsProcessor",
115+
"onAutoForward": "notify"
116+
},
117+
"61840": {
118+
"label": "Notifications (Cloud)",
119+
"onAutoForward": "notify"
120+
},
121+
"61841": {
122+
"label": "Notifications (SelfHost)",
123+
"onAutoForward": "notify"
124+
},
125+
"62911": {
126+
"label": "Admin (Cloud)",
127+
"onAutoForward": "notify"
128+
},
129+
"62912": {
130+
"label": "Admin (SelfHost)",
131+
"onAutoForward": "notify"
57132
}
58133
}
59134
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/usr/bin/env bash
2+
export REPO_ROOT="$(git rev-parse --show-toplevel)"
3+
4+
file="$REPO_ROOT/dev/custom-root-ca.crt"
5+
6+
if [ -e "$file" ]; then
7+
echo "Adding custom root CA"
8+
sudo cp "$file" /usr/local/share/ca-certificates/
9+
sudo update-ca-certificates
10+
else
11+
echo "No custom root CA found, skipping..."
12+
fi

.devcontainer/internal_dev/postCreateCommand.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ Press <Enter> to continue."
108108
fi
109109

110110
run_mssql_migrations="$(get_option "RUN_MSSQL_MIGRATIONS" "Would you like us to run MSSQL Migrations for you? [y/N] " "n")"
111-
if [[ "$do_azurite_setup" =~ ^([yY][eE][sS]|[yY])+$ ]]; then
111+
if [[ "$run_mssql_migrations" =~ ^([yY][eE][sS]|[yY])+$ ]]; then
112112
echo "Running migrations..."
113113
sleep 5 # wait for DB container to start
114114
dotnet run --project "$REPO_ROOT/util/MsSqlMigratorUtility" "$SQL_CONNECTION_STRING"

.github/CODEOWNERS

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111
**/docker-compose.yml @bitwarden/team-appsec @bitwarden/dept-bre
1212
**/entrypoint.sh @bitwarden/team-appsec @bitwarden/dept-bre
1313

14+
# Scanning tools
15+
.checkmarx/ @bitwarden/team-appsec
16+
1417
## BRE team owns these workflows ##
1518
.github/workflows/publish.yml @bitwarden/dept-bre
1619

@@ -94,9 +97,7 @@ src/Admin/Views/Tools @bitwarden/team-billing-dev
9497
.github/workflows/test-database.yml @bitwarden/team-platform-dev
9598
.github/workflows/test.yml @bitwarden/team-platform-dev
9699
**/*Platform* @bitwarden/team-platform-dev
97-
**/.dockerignore @bitwarden/team-platform-dev
98-
**/Dockerfile @bitwarden/team-platform-dev
99-
**/entrypoint.sh @bitwarden/team-platform-dev
100+
100101
# The PushType enum is expected to be editted by anyone without need for Platform review
101102
src/Core/Platform/Push/PushType.cs
102103

.github/renovate.json5

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,6 @@
2121
commitMessagePrefix: "[deps] AC:",
2222
reviewers: ["team:team-admin-console-dev"],
2323
},
24-
{
25-
matchFileNames: ["src/Admin/package.json", "src/Sso/package.json"],
26-
description: "Admin & SSO npm packages",
27-
commitMessagePrefix: "[deps] Auth:",
28-
reviewers: ["team:team-auth-dev"],
29-
},
3024
{
3125
matchPackageNames: [
3226
"DuoUniversal",
@@ -182,6 +176,14 @@
182176
matchUpdateTypes: ["minor"],
183177
addLabels: ["hold"],
184178
},
179+
{
180+
groupName: "Admin and SSO npm dependencies",
181+
matchFileNames: ["src/Admin/package.json", "src/Sso/package.json"],
182+
matchUpdateTypes: ["minor", "patch"],
183+
description: "Admin & SSO npm packages",
184+
commitMessagePrefix: "[deps] Auth:",
185+
reviewers: ["team:team-auth-dev"],
186+
},
185187
{
186188
matchPackageNames: ["/^Microsoft\\.EntityFrameworkCore\\./", "/^dotnet-ef/"],
187189
groupName: "EntityFrameworkCore",

.github/workflows/build.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131
persist-credentials: false
3232

3333
- name: Set up .NET
34-
uses: actions/setup-dotnet@2016bd2012dba4e32de620c46fe006a3ac9f0602 # v5.0.1
34+
uses: actions/setup-dotnet@baa11fbfe1d6520db94683bd5c7a3818018e4309 # v5.1.0
3535

3636
- name: Verify format
3737
run: dotnet format --verify-no-changes
@@ -119,10 +119,10 @@ jobs:
119119
fi
120120
121121
- name: Set up .NET
122-
uses: actions/setup-dotnet@2016bd2012dba4e32de620c46fe006a3ac9f0602 # v5.0.1
122+
uses: actions/setup-dotnet@baa11fbfe1d6520db94683bd5c7a3818018e4309 # v5.1.0
123123

124124
- name: Set up Node
125-
uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f # v6.1.0
125+
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
126126
with:
127127
cache: "npm"
128128
cache-dependency-path: "**/package-lock.json"
@@ -245,7 +245,7 @@ jobs:
245245

246246
- name: Install Cosign
247247
if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main'
248-
uses: sigstore/cosign-installer@7e8b541eb2e61bf99390e1afd4be13a184e9ebc5 # v3.10.1
248+
uses: sigstore/cosign-installer@faadad0cce49287aee09b3a48701e75088a2c6ad # v4.0.0
249249

250250
- name: Sign image with Cosign
251251
if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main'
@@ -263,14 +263,14 @@ jobs:
263263
264264
- name: Scan Docker image
265265
id: container-scan
266-
uses: anchore/scan-action@3c9a191a0fbab285ca6b8530b5de5a642cba332f # v7.2.2
266+
uses: anchore/scan-action@0d444ed77d83ee2ba7f5ced0d90d640a1281d762 # v7.3.0
267267
with:
268268
image: ${{ steps.image-tags.outputs.primary_tag }}
269269
fail-build: false
270270
output-format: sarif
271271

272272
- name: Upload Grype results to GitHub
273-
uses: github/codeql-action/upload-sarif@5d4e8d1aca955e8d8589aabd499c5cae939e33c7 # v4.31.9
273+
uses: github/codeql-action/upload-sarif@cdefb33c0f6224e58673d9004f47f7cb3e328b89 # v4.31.10
274274
with:
275275
sarif_file: ${{ steps.container-scan.outputs.sarif }}
276276
sha: ${{ contains(github.event_name, 'pull_request') && github.event.pull_request.head.sha || github.sha }}
@@ -294,7 +294,7 @@ jobs:
294294
persist-credentials: false
295295

296296
- name: Set up .NET
297-
uses: actions/setup-dotnet@2016bd2012dba4e32de620c46fe006a3ac9f0602 # v5.0.1
297+
uses: actions/setup-dotnet@baa11fbfe1d6520db94683bd5c7a3818018e4309 # v5.1.0
298298

299299
- name: Log in to Azure
300300
uses: bitwarden/gh-actions/azure-login@main
@@ -420,7 +420,7 @@ jobs:
420420
persist-credentials: false
421421

422422
- name: Set up .NET
423-
uses: actions/setup-dotnet@2016bd2012dba4e32de620c46fe006a3ac9f0602 # v5.0.1
423+
uses: actions/setup-dotnet@baa11fbfe1d6520db94683bd5c7a3818018e4309 # v5.1.0
424424

425425
- name: Print environment
426426
run: |

0 commit comments

Comments
 (0)