Skip to content

Commit

Permalink
issue #172: vault integration
Browse files Browse the repository at this point in the history
  • Loading branch information
ThomasCardin committed Dec 6, 2024
1 parent b968d2d commit 7d1f7c7
Showing 1 changed file with 35 additions and 12 deletions.
47 changes: 35 additions & 12 deletions .github/workflows/workflow-detect-secret-leaks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,45 @@ on:
workflow_call:
push:
branches:
- "**"
pull_request:
branches:
- "**"
- '**'

jobs:
detect-secret-leaks:
runs-on: ubuntu-latest
runs-on: gh-runner
permissions:
contents: read
id-token: write
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Authenticate with Vault using GitHub OIDC
id: vault_auth
uses: hashicorp/[email protected]
with:
url: http://vault.vault.svc.cluster.local:8200
caCertificate: ${{ secrets.VAULT_CA_CERT }}
method: github
githubToken: ${{ secrets.VAULT_TOKEN }}

# https://github.com/hashicorp/vault-action?tab=readme-ov-file#multiple-secrets
- name: Retrieve secrets from Vault
id: get_secrets
uses: hashicorp/[email protected]
with:
url: ${{ secrets.VAULT_ADDR }}
method: jwt
role: github-actions
secrets: |
secret/kv/fertiscan/frontend * | API_KEY_ ;
secret/kv/fertiscan/frontend * | API_KEY_ ;
secret/kv/fertiscan/database * | API_KEY_ ;
secret/kv/fertiscan-dev * | API_KEY_ ;
secret/kv/nachet * | API_KEY_ ;
secret/kv/finesse * | API_KEY_
env:
VAULT_TOKEN: ${{ steps.vault_auth.outputs.vault_token }}

- name: Install git-secrets
run: |
sudo apt-get update
Expand All @@ -30,14 +57,10 @@ jobs:
git secrets --install
- name: Add API keys to git-secrets
env:
API_KEYS: ${{ secrets.AI_CFIA_API_KEYS }}
run: |
echo "$API_KEYS" > api_keys.txt
while IFS= read -r api_key; do
git secrets --add --literal "$api_key"
done < api_keys.txt
rm -f api_keys.txt
for var in $(compgen -e API_KEY_); do
git secrets --add --literal "${!var}"
done
- name: Scan repository for secrets
run: |
Expand Down

0 comments on commit 7d1f7c7

Please sign in to comment.