Skip to content

[BRE-831] migrate secrets AKV #309

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weโ€™ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Jul 11, 2025
Merged
18 changes: 15 additions & 3 deletions .github/workflows/build-swift.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ jobs:
version:
name: Get Version
runs-on: ubuntu-24.04
permissions:
contents: read
outputs:
package_version: ${{ steps.retrieve-version.outputs.package_version }}
steps:
Expand All @@ -29,6 +31,8 @@ jobs:
name: Build
runs-on: macos-14
needs: version
permissions:
contents: read
env:
_VERSION: ${{ needs.version.outputs.package_version }}
steps:
Expand Down Expand Up @@ -95,11 +99,16 @@ jobs:
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-24.04
needs: build
permissions:
contents: read
id-token: write
steps:
- name: Login to Azure - CI Subscription
uses: Azure/login@e15b166166a8746d1a47596803bd8c1b595455cf # v1.6.0
- name: Log in to Azure
uses: bitwarden/gh-actions/azure-login@main
with:
creds: ${{ secrets.AZURE_KV_CI_SERVICE_PRINCIPAL }}
subscription_id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
tenant_id: ${{ secrets.AZURE_TENANT_ID }}
client_id: ${{ secrets.AZURE_CLIENT_ID }}

- name: Retrieve github PAT secrets
id: retrieve-secret-pat
Expand All @@ -108,6 +117,9 @@ jobs:
keyvault: "bitwarden-ci"
secrets: "github-pat-bitwarden-devops-bot-repo-scope"

- name: Log out from Azure
uses: bitwarden/gh-actions/azure-logout@main

- name: Trigger Swift release
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
with:
Expand Down
15 changes: 12 additions & 3 deletions .github/workflows/build-wasm-internal.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ jobs:
build:
name: Building @bitwarden/sdk-wasm-internal
runs-on: ubuntu-24.04
permissions:
contents: read

steps:
- name: Checkout repo
Expand Down Expand Up @@ -94,11 +96,15 @@ jobs:
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-24.04
needs: build
permissions:
id-token: write
steps:
- name: Login to Azure - CI Subscription
uses: Azure/login@e15b166166a8746d1a47596803bd8c1b595455cf # v1.6.0
- name: Log in to Azure
uses: bitwarden/gh-actions/azure-login@main
with:
creds: ${{ secrets.AZURE_KV_CI_SERVICE_PRINCIPAL }}
subscription_id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
tenant_id: ${{ secrets.AZURE_TENANT_ID }}
client_id: ${{ secrets.AZURE_CLIENT_ID }}

- name: Retrieve github PAT secrets
id: retrieve-secret-pat
Expand All @@ -107,6 +113,9 @@ jobs:
keyvault: "bitwarden-ci"
secrets: "github-pat-bitwarden-devops-bot-repo-scope"

- name: Log out from Azure
uses: bitwarden/gh-actions/azure-logout@main

- name: Trigger WASM publish
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
with:
Expand Down
17 changes: 14 additions & 3 deletions .github/workflows/publish-rust-crates.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ jobs:
setup:
name: Setup
runs-on: ubuntu-24.04
permissions:
contents: read
outputs:
release-version: ${{ steps.version-output.outputs.version }}
release-tag: ${{ steps.version-output.outputs.tag_name }}
Expand Down Expand Up @@ -60,16 +62,22 @@ jobs:
name: Publish
runs-on: ubuntu-24.04
needs: setup
permissions:
id-token: write
contents: read
deployments: write
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
ref: ${{ needs.setup.outputs.release-tag }}

- name: Login to Azure
uses: Azure/login@e15b166166a8746d1a47596803bd8c1b595455cf # v1.6.0
- name: Log in to Azure
uses: bitwarden/gh-actions/azure-login@main
with:
creds: ${{ secrets.AZURE_KV_CI_SERVICE_PRINCIPAL }}
subscription_id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
tenant_id: ${{ secrets.AZURE_TENANT_ID }}
client_id: ${{ secrets.AZURE_CLIENT_ID }}

- name: Retrieve secrets
id: retrieve-secrets
Expand All @@ -78,6 +86,9 @@ jobs:
keyvault: "bitwarden-ci"
secrets: "cratesio-api-token"

- name: Log out from Azure
uses: bitwarden/gh-actions/azure-logout@main

- name: Install rust
uses: dtolnay/rust-toolchain@b3b07ba8b418998c39fb20f53e8b695cdcc8de1b # stable
with:
Expand Down
16 changes: 13 additions & 3 deletions .github/workflows/publish-wasm-internal.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ jobs:
setup:
name: Setup
runs-on: ubuntu-24.04
permissions:
contents: read
outputs:
release-version: ${{ steps.version-output.outputs.version }}
steps:
Expand Down Expand Up @@ -58,6 +60,9 @@ jobs:
name: Publish NPM
runs-on: ubuntu-24.04
needs: setup
permissions:
contents: read
id-token: write
steps:
- name: Checkout repo
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
Expand All @@ -67,10 +72,12 @@ jobs:
with:
node-version: 20

- name: Login to Azure
uses: Azure/login@e15b166166a8746d1a47596803bd8c1b595455cf # v1.6.0
- name: Log in to Azure
uses: bitwarden/gh-actions/azure-login@main
with:
creds: ${{ secrets.AZURE_KV_CI_SERVICE_PRINCIPAL }}
subscription_id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
tenant_id: ${{ secrets.AZURE_TENANT_ID }}
client_id: ${{ secrets.AZURE_CLIENT_ID }}

- name: Retrieve secrets
id: retrieve-secrets
Expand All @@ -79,6 +86,9 @@ jobs:
keyvault: "bitwarden-ci"
secrets: "npm-api-key"

- name: Log out from Azure
uses: bitwarden/gh-actions/azure-logout@main

- name: Download artifact
uses: bitwarden/gh-actions/download-artifacts@main
with:
Expand Down
31 changes: 25 additions & 6 deletions .github/workflows/release-swift.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ jobs:
validate:
name: Set Version and SHA
runs-on: ubuntu-24.04
permissions:
contents: read
outputs:
version: ${{ steps.version.outputs.version }}
sha: ${{ steps.set-sha.outputs.sha }}
Expand Down Expand Up @@ -103,6 +105,9 @@ jobs:
name: Push changed files to SDK Swift repo
runs-on: ubuntu-24.04
needs: validate
permissions:
contents: read
id-token: write
env:
_BOT_EMAIL: [email protected]
_BOT_NAME: bitwarden-devops-bot
Expand All @@ -126,10 +131,12 @@ jobs:
echo "ref=main" >> $GITHUB_OUTPUT
fi

- name: Login to Azure - Prod Subscription
uses: Azure/login@e15b166166a8746d1a47596803bd8c1b595455cf # v1.6.0
- name: Log in to Azure
uses: bitwarden/gh-actions/azure-login@main
with:
creds: ${{ secrets.AZURE_KV_CI_SERVICE_PRINCIPAL }}
subscription_id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
tenant_id: ${{ secrets.AZURE_TENANT_ID }}
client_id: ${{ secrets.AZURE_CLIENT_ID }}

- name: Retrieve secrets
id: retrieve-secrets
Expand All @@ -140,6 +147,9 @@ jobs:
github-gpg-private-key-passphrase,
github-pat-bitwarden-devops-bot-repo-scope"

- name: Log out from Azure
uses: bitwarden/gh-actions/azure-logout@main

- name: Checkout SDK-Swift repo
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
Expand Down Expand Up @@ -221,15 +231,21 @@ jobs:
needs:
- validate
- repo-sync
permissions:
actions: read
contents: write
id-token: write
env:
_PKG_VERSION: ${{ needs.validate.outputs.version }}
_RELEASE_NAME: ${{ needs.validate.outputs.release_name }}
_BUILD_RUN_ID: ${{ needs.validate.outputs.run_id }}
steps:
- name: Login to Azure - Prod Subscription
uses: Azure/login@e15b166166a8746d1a47596803bd8c1b595455cf # v1.6.0
- name: Log in to Azure
uses: bitwarden/gh-actions/azure-login@main
with:
creds: ${{ secrets.AZURE_KV_CI_SERVICE_PRINCIPAL }}
subscription_id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
tenant_id: ${{ secrets.AZURE_TENANT_ID }}
client_id: ${{ secrets.AZURE_CLIENT_ID }}

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

- name: Log out from Azure
uses: bitwarden/gh-actions/azure-logout@main

- name: Download BitwardenEFI artifact
uses: bitwarden/gh-actions/download-artifacts@main
id: download-artifact
Expand Down
44 changes: 40 additions & 4 deletions .github/workflows/scan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,23 +33,41 @@ jobs:
contents: read
pull-requests: write
security-events: write
id-token: write

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

- name: Log in to Azure
uses: bitwarden/gh-actions/azure-login@main
with:
subscription_id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
tenant_id: ${{ secrets.AZURE_TENANT_ID }}
client_id: ${{ secrets.AZURE_CLIENT_ID }}

- name: Get Azure Key Vault secrets
id: get-kv-secrets
uses: bitwarden/gh-actions/get-keyvault-secrets@main
with:
keyvault: gh-org-bitwarden
secrets: "CHECKMARX-TENANT,CHECKMARX-CLIENT-ID,CHECKMARX-SECRET"

- name: Log out from Azure
uses: bitwarden/gh-actions/azure-logout@main

- name: Scan with Checkmarx
uses: checkmarx/ast-github-action@9fda4ab4c1b67c35de380552a972a82997d97731 # 2.0.42
env:
INCREMENTAL: "${{ contains(github.event_name, 'pull_request') && '--sast-incremental' || '' }}"
with:
project_name: ${{ github.repository }}
cx_tenant: ${{ secrets.CHECKMARX_TENANT }}
cx_tenant: ${{ steps.get-kv-secrets.outputs.CHECKMARX-TENANT }}
base_uri: https://ast.checkmarx.net/
cx_client_id: ${{ secrets.CHECKMARX_CLIENT_ID }}
cx_client_secret: ${{ secrets.CHECKMARX_SECRET }}
cx_client_id: ${{ steps.get-kv-secrets.outputs.CHECKMARX-CLIENT-ID }}
cx_client_secret: ${{ steps.get-kv-secrets.outputs.CHECKMARX-SECRET }}
additional_params: |
--report-format sarif \
--filter "state=TO_VERIFY;PROPOSED_NOT_EXPLOITABLE;CONFIRMED;URGENT" \
Expand All @@ -69,6 +87,7 @@ jobs:
permissions:
contents: read
pull-requests: write
id-token: write

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

- name: Log in to Azure
uses: bitwarden/gh-actions/azure-login@main
with:
subscription_id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
tenant_id: ${{ secrets.AZURE_TENANT_ID }}
client_id: ${{ secrets.AZURE_CLIENT_ID }}

- name: Get Azure Key Vault secrets
id: get-kv-secrets
uses: bitwarden/gh-actions/get-keyvault-secrets@main
with:
keyvault: gh-org-bitwarden
secrets: "SONAR-TOKEN"

- name: Log out from Azure
uses: bitwarden/gh-actions/azure-logout@main

- name: Scan with SonarCloud
uses: sonarsource/sonarqube-scan-action@2500896589ef8f7247069a56136f8dc177c27ccf # v5.2.0
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_TOKEN: ${{ steps.get-kv-secrets.outputs.SONAR-TOKEN }}
with:
args: >
-Dsonar.organization=${{ github.repository_owner }}
Expand Down
16 changes: 13 additions & 3 deletions .github/workflows/version-bump.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ jobs:
bump_version:
name: "Bump ${{ inputs.project }} Version to v${{ inputs.version_number }}"
runs-on: ubuntu-24.04
permissions:
contents: read
id-token: write
steps:
- name: Install rust
uses: dtolnay/rust-toolchain@b3b07ba8b418998c39fb20f53e8b695cdcc8de1b # stable
Expand All @@ -34,10 +37,12 @@ jobs:
- name: Install cargo-release
run: cargo install cargo-edit --locked

- name: Login to Azure - CI Subscription
uses: Azure/login@e15b166166a8746d1a47596803bd8c1b595455cf # v1.6.0
- name: Log in to Azure
uses: bitwarden/gh-actions/azure-login@main
with:
creds: ${{ secrets.AZURE_KV_CI_SERVICE_PRINCIPAL }}
subscription_id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
tenant_id: ${{ secrets.AZURE_TENANT_ID }}
client_id: ${{ secrets.AZURE_CLIENT_ID }}

- name: Retrieve secrets
id: retrieve-secrets
Expand All @@ -48,6 +53,9 @@ jobs:
github-gpg-private-key-passphrase,
github-pat-bitwarden-devops-bot-repo-scope"

- name: Log out from Azure
uses: bitwarden/gh-actions/azure-logout@main

- name: Checkout Branch
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
Expand Down Expand Up @@ -162,6 +170,8 @@ jobs:
needs: bump_version
if: ${{ inputs.cut_rc_branch == true }}
runs-on: ubuntu-24.04
permissions:
contents: write
steps:
- name: Checkout Branch
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
Expand Down