Skip to content

Commit 81493f3

Browse files
authored
[BRE-831] migrate secrets AKV (#309)
1 parent 91f6fe5 commit 81493f3

File tree

7 files changed

+132
-25
lines changed

7 files changed

+132
-25
lines changed

.github/workflows/build-swift.yml

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ jobs:
1313
version:
1414
name: Get Version
1515
runs-on: ubuntu-24.04
16+
permissions:
17+
contents: read
1618
outputs:
1719
package_version: ${{ steps.retrieve-version.outputs.package_version }}
1820
steps:
@@ -29,6 +31,8 @@ jobs:
2931
name: Build
3032
runs-on: macos-14
3133
needs: version
34+
permissions:
35+
contents: read
3236
env:
3337
_VERSION: ${{ needs.version.outputs.package_version }}
3438
steps:
@@ -95,11 +99,16 @@ jobs:
9599
if: github.ref == 'refs/heads/main'
96100
runs-on: ubuntu-24.04
97101
needs: build
102+
permissions:
103+
contents: read
104+
id-token: write
98105
steps:
99-
- name: Login to Azure - CI Subscription
100-
uses: Azure/login@e15b166166a8746d1a47596803bd8c1b595455cf # v1.6.0
106+
- name: Log in to Azure
107+
uses: bitwarden/gh-actions/azure-login@main
101108
with:
102-
creds: ${{ secrets.AZURE_KV_CI_SERVICE_PRINCIPAL }}
109+
subscription_id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
110+
tenant_id: ${{ secrets.AZURE_TENANT_ID }}
111+
client_id: ${{ secrets.AZURE_CLIENT_ID }}
103112

104113
- name: Retrieve github PAT secrets
105114
id: retrieve-secret-pat
@@ -108,6 +117,9 @@ jobs:
108117
keyvault: "bitwarden-ci"
109118
secrets: "github-pat-bitwarden-devops-bot-repo-scope"
110119

120+
- name: Log out from Azure
121+
uses: bitwarden/gh-actions/azure-logout@main
122+
111123
- name: Trigger Swift release
112124
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
113125
with:

.github/workflows/build-wasm-internal.yml

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ jobs:
1818
build:
1919
name: Building @bitwarden/sdk-wasm-internal
2020
runs-on: ubuntu-24.04
21+
permissions:
22+
contents: read
2123

2224
steps:
2325
- name: Checkout repo
@@ -94,11 +96,15 @@ jobs:
9496
if: github.ref == 'refs/heads/main'
9597
runs-on: ubuntu-24.04
9698
needs: build
99+
permissions:
100+
id-token: write
97101
steps:
98-
- name: Login to Azure - CI Subscription
99-
uses: Azure/login@e15b166166a8746d1a47596803bd8c1b595455cf # v1.6.0
102+
- name: Log in to Azure
103+
uses: bitwarden/gh-actions/azure-login@main
100104
with:
101-
creds: ${{ secrets.AZURE_KV_CI_SERVICE_PRINCIPAL }}
105+
subscription_id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
106+
tenant_id: ${{ secrets.AZURE_TENANT_ID }}
107+
client_id: ${{ secrets.AZURE_CLIENT_ID }}
102108

103109
- name: Retrieve github PAT secrets
104110
id: retrieve-secret-pat
@@ -107,6 +113,9 @@ jobs:
107113
keyvault: "bitwarden-ci"
108114
secrets: "github-pat-bitwarden-devops-bot-repo-scope"
109115

116+
- name: Log out from Azure
117+
uses: bitwarden/gh-actions/azure-logout@main
118+
110119
- name: Trigger WASM publish
111120
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
112121
with:

.github/workflows/publish-rust-crates.yml

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ jobs:
2323
setup:
2424
name: Setup
2525
runs-on: ubuntu-24.04
26+
permissions:
27+
contents: read
2628
outputs:
2729
release-version: ${{ steps.version-output.outputs.version }}
2830
release-tag: ${{ steps.version-output.outputs.tag_name }}
@@ -60,16 +62,22 @@ jobs:
6062
name: Publish
6163
runs-on: ubuntu-24.04
6264
needs: setup
65+
permissions:
66+
id-token: write
67+
contents: read
68+
deployments: write
6369
steps:
6470
- name: Checkout
6571
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
6672
with:
6773
ref: ${{ needs.setup.outputs.release-tag }}
6874

69-
- name: Login to Azure
70-
uses: Azure/login@e15b166166a8746d1a47596803bd8c1b595455cf # v1.6.0
75+
- name: Log in to Azure
76+
uses: bitwarden/gh-actions/azure-login@main
7177
with:
72-
creds: ${{ secrets.AZURE_KV_CI_SERVICE_PRINCIPAL }}
78+
subscription_id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
79+
tenant_id: ${{ secrets.AZURE_TENANT_ID }}
80+
client_id: ${{ secrets.AZURE_CLIENT_ID }}
7381

7482
- name: Retrieve secrets
7583
id: retrieve-secrets
@@ -78,6 +86,9 @@ jobs:
7886
keyvault: "bitwarden-ci"
7987
secrets: "cratesio-api-token"
8088

89+
- name: Log out from Azure
90+
uses: bitwarden/gh-actions/azure-logout@main
91+
8192
- name: Install rust
8293
uses: dtolnay/rust-toolchain@b3b07ba8b418998c39fb20f53e8b695cdcc8de1b # stable
8394
with:

.github/workflows/publish-wasm-internal.yml

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ jobs:
2424
setup:
2525
name: Setup
2626
runs-on: ubuntu-24.04
27+
permissions:
28+
contents: read
2729
outputs:
2830
release-version: ${{ steps.version-output.outputs.version }}
2931
steps:
@@ -58,6 +60,9 @@ jobs:
5860
name: Publish NPM
5961
runs-on: ubuntu-24.04
6062
needs: setup
63+
permissions:
64+
contents: read
65+
id-token: write
6166
steps:
6267
- name: Checkout repo
6368
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
@@ -67,10 +72,12 @@ jobs:
6772
with:
6873
node-version: 20
6974

70-
- name: Login to Azure
71-
uses: Azure/login@e15b166166a8746d1a47596803bd8c1b595455cf # v1.6.0
75+
- name: Log in to Azure
76+
uses: bitwarden/gh-actions/azure-login@main
7277
with:
73-
creds: ${{ secrets.AZURE_KV_CI_SERVICE_PRINCIPAL }}
78+
subscription_id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
79+
tenant_id: ${{ secrets.AZURE_TENANT_ID }}
80+
client_id: ${{ secrets.AZURE_CLIENT_ID }}
7481

7582
- name: Retrieve secrets
7683
id: retrieve-secrets
@@ -79,6 +86,9 @@ jobs:
7986
keyvault: "bitwarden-ci"
8087
secrets: "npm-api-key"
8188

89+
- name: Log out from Azure
90+
uses: bitwarden/gh-actions/azure-logout@main
91+
8292
- name: Download artifact
8393
uses: bitwarden/gh-actions/download-artifacts@main
8494
with:

.github/workflows/release-swift.yml

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ jobs:
3232
validate:
3333
name: Set Version and SHA
3434
runs-on: ubuntu-24.04
35+
permissions:
36+
contents: read
3537
outputs:
3638
version: ${{ steps.version.outputs.version }}
3739
sha: ${{ steps.set-sha.outputs.sha }}
@@ -103,6 +105,9 @@ jobs:
103105
name: Push changed files to SDK Swift repo
104106
runs-on: ubuntu-24.04
105107
needs: validate
108+
permissions:
109+
contents: read
110+
id-token: write
106111
env:
107112
_BOT_EMAIL: [email protected]
108113
_BOT_NAME: bitwarden-devops-bot
@@ -126,10 +131,12 @@ jobs:
126131
echo "ref=main" >> $GITHUB_OUTPUT
127132
fi
128133
129-
- name: Login to Azure - Prod Subscription
130-
uses: Azure/login@e15b166166a8746d1a47596803bd8c1b595455cf # v1.6.0
134+
- name: Log in to Azure
135+
uses: bitwarden/gh-actions/azure-login@main
131136
with:
132-
creds: ${{ secrets.AZURE_KV_CI_SERVICE_PRINCIPAL }}
137+
subscription_id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
138+
tenant_id: ${{ secrets.AZURE_TENANT_ID }}
139+
client_id: ${{ secrets.AZURE_CLIENT_ID }}
133140

134141
- name: Retrieve secrets
135142
id: retrieve-secrets
@@ -140,6 +147,9 @@ jobs:
140147
github-gpg-private-key-passphrase,
141148
github-pat-bitwarden-devops-bot-repo-scope"
142149

150+
- name: Log out from Azure
151+
uses: bitwarden/gh-actions/azure-logout@main
152+
143153
- name: Checkout SDK-Swift repo
144154
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
145155
with:
@@ -221,15 +231,21 @@ jobs:
221231
needs:
222232
- validate
223233
- repo-sync
234+
permissions:
235+
actions: read
236+
contents: write
237+
id-token: write
224238
env:
225239
_PKG_VERSION: ${{ needs.validate.outputs.version }}
226240
_RELEASE_NAME: ${{ needs.validate.outputs.release_name }}
227241
_BUILD_RUN_ID: ${{ needs.validate.outputs.run_id }}
228242
steps:
229-
- name: Login to Azure - Prod Subscription
230-
uses: Azure/login@e15b166166a8746d1a47596803bd8c1b595455cf # v1.6.0
243+
- name: Log in to Azure
244+
uses: bitwarden/gh-actions/azure-login@main
231245
with:
232-
creds: ${{ secrets.AZURE_KV_CI_SERVICE_PRINCIPAL }}
246+
subscription_id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
247+
tenant_id: ${{ secrets.AZURE_TENANT_ID }}
248+
client_id: ${{ secrets.AZURE_CLIENT_ID }}
233249

234250
- name: Retrieve secrets
235251
id: retrieve-secrets
@@ -238,6 +254,9 @@ jobs:
238254
keyvault: ${{ env._KEY_VAULT }}
239255
secrets: "github-pat-bitwarden-devops-bot-repo-scope"
240256

257+
- name: Log out from Azure
258+
uses: bitwarden/gh-actions/azure-logout@main
259+
241260
- name: Download BitwardenEFI artifact
242261
uses: bitwarden/gh-actions/download-artifacts@main
243262
id: download-artifact

.github/workflows/scan.yml

Lines changed: 40 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,23 +33,41 @@ jobs:
3333
contents: read
3434
pull-requests: write
3535
security-events: write
36+
id-token: write
3637

3738
steps:
3839
- name: Check out repo
3940
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
4041
with:
4142
ref: ${{ github.event.pull_request.head.sha }}
4243

44+
- name: Log in to Azure
45+
uses: bitwarden/gh-actions/azure-login@main
46+
with:
47+
subscription_id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
48+
tenant_id: ${{ secrets.AZURE_TENANT_ID }}
49+
client_id: ${{ secrets.AZURE_CLIENT_ID }}
50+
51+
- name: Get Azure Key Vault secrets
52+
id: get-kv-secrets
53+
uses: bitwarden/gh-actions/get-keyvault-secrets@main
54+
with:
55+
keyvault: gh-org-bitwarden
56+
secrets: "CHECKMARX-TENANT,CHECKMARX-CLIENT-ID,CHECKMARX-SECRET"
57+
58+
- name: Log out from Azure
59+
uses: bitwarden/gh-actions/azure-logout@main
60+
4361
- name: Scan with Checkmarx
4462
uses: checkmarx/ast-github-action@9fda4ab4c1b67c35de380552a972a82997d97731 # 2.0.42
4563
env:
4664
INCREMENTAL: "${{ contains(github.event_name, 'pull_request') && '--sast-incremental' || '' }}"
4765
with:
4866
project_name: ${{ github.repository }}
49-
cx_tenant: ${{ secrets.CHECKMARX_TENANT }}
67+
cx_tenant: ${{ steps.get-kv-secrets.outputs.CHECKMARX-TENANT }}
5068
base_uri: https://ast.checkmarx.net/
51-
cx_client_id: ${{ secrets.CHECKMARX_CLIENT_ID }}
52-
cx_client_secret: ${{ secrets.CHECKMARX_SECRET }}
69+
cx_client_id: ${{ steps.get-kv-secrets.outputs.CHECKMARX-CLIENT-ID }}
70+
cx_client_secret: ${{ steps.get-kv-secrets.outputs.CHECKMARX-SECRET }}
5371
additional_params: |
5472
--report-format sarif \
5573
--filter "state=TO_VERIFY;PROPOSED_NOT_EXPLOITABLE;CONFIRMED;URGENT" \
@@ -69,6 +87,7 @@ jobs:
6987
permissions:
7088
contents: read
7189
pull-requests: write
90+
id-token: write
7291

7392
steps:
7493
- name: Check out repo
@@ -77,10 +96,27 @@ jobs:
7796
fetch-depth: 0
7897
ref: ${{ github.event.pull_request.head.sha }}
7998

99+
- name: Log in to Azure
100+
uses: bitwarden/gh-actions/azure-login@main
101+
with:
102+
subscription_id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
103+
tenant_id: ${{ secrets.AZURE_TENANT_ID }}
104+
client_id: ${{ secrets.AZURE_CLIENT_ID }}
105+
106+
- name: Get Azure Key Vault secrets
107+
id: get-kv-secrets
108+
uses: bitwarden/gh-actions/get-keyvault-secrets@main
109+
with:
110+
keyvault: gh-org-bitwarden
111+
secrets: "SONAR-TOKEN"
112+
113+
- name: Log out from Azure
114+
uses: bitwarden/gh-actions/azure-logout@main
115+
80116
- name: Scan with SonarCloud
81117
uses: sonarsource/sonarqube-scan-action@2500896589ef8f7247069a56136f8dc177c27ccf # v5.2.0
82118
env:
83-
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
119+
SONAR_TOKEN: ${{ steps.get-kv-secrets.outputs.SONAR-TOKEN }}
84120
with:
85121
args: >
86122
-Dsonar.organization=${{ github.repository_owner }}

.github/workflows/version-bump.yml

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ jobs:
2222
bump_version:
2323
name: "Bump ${{ inputs.project }} Version to v${{ inputs.version_number }}"
2424
runs-on: ubuntu-24.04
25+
permissions:
26+
contents: read
27+
id-token: write
2528
steps:
2629
- name: Install rust
2730
uses: dtolnay/rust-toolchain@b3b07ba8b418998c39fb20f53e8b695cdcc8de1b # stable
@@ -34,10 +37,12 @@ jobs:
3437
- name: Install cargo-release
3538
run: cargo install cargo-edit --locked
3639

37-
- name: Login to Azure - CI Subscription
38-
uses: Azure/login@e15b166166a8746d1a47596803bd8c1b595455cf # v1.6.0
40+
- name: Log in to Azure
41+
uses: bitwarden/gh-actions/azure-login@main
3942
with:
40-
creds: ${{ secrets.AZURE_KV_CI_SERVICE_PRINCIPAL }}
43+
subscription_id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
44+
tenant_id: ${{ secrets.AZURE_TENANT_ID }}
45+
client_id: ${{ secrets.AZURE_CLIENT_ID }}
4146

4247
- name: Retrieve secrets
4348
id: retrieve-secrets
@@ -48,6 +53,9 @@ jobs:
4853
github-gpg-private-key-passphrase,
4954
github-pat-bitwarden-devops-bot-repo-scope"
5055

56+
- name: Log out from Azure
57+
uses: bitwarden/gh-actions/azure-logout@main
58+
5159
- name: Checkout Branch
5260
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
5361
with:
@@ -162,6 +170,8 @@ jobs:
162170
needs: bump_version
163171
if: ${{ inputs.cut_rc_branch == true }}
164172
runs-on: ubuntu-24.04
173+
permissions:
174+
contents: write
165175
steps:
166176
- name: Checkout Branch
167177
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

0 commit comments

Comments
 (0)