Skip to content

Commit a736b6a

Browse files
committed
Don't leak (revoked) VAULT_TOKEN environment variable
Made possible by [hashicorp/vault-action][1] now making its token available as an _output_. [1]: https://github.com/hashicorp/vault-action
1 parent e76d708 commit a736b6a

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
- name: Generate SSH client certificate
2323
if: github.ref == 'refs/heads/main'
2424
id: ssh_cert
25-
uses: andreaso/vault-oidc-ssh-cert-action@v0.6
25+
uses: andreaso/vault-oidc-ssh-cert-action@v0.7
2626
with:
2727
vault_server: https://vault.example.com:8200
2828
oidc_backend: github-oidc

action.yaml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ runs:
5050
shell: python
5151

5252
- name: Authenticate towards Vault
53+
id: vault_auth
5354
uses: hashicorp/vault-action@v2.7.0
5455
with:
5556
method: jwt
@@ -58,20 +59,20 @@ runs:
5859
url: ${{ inputs.vault_server }}
5960
path: ${{ inputs.oidc_backend }}
6061
role: ${{ inputs.oidc_role }}
61-
exportToken: true
62+
outputToken: true
6263

6364
- name: Generate and sign SSH client certificate
6465
id: generator
6566
shell: bash
6667
run: ${{ github.action_path }}/generate-and-sign
6768
env:
6869
VAULT_SERVER: ${{ inputs.vault_server }}
70+
VAULT_TOKEN: ${{ steps.vault_auth.outputs.vault_token }}
6971
SSH_BACKEND: ${{ inputs.ssh_backend }}
7072
SSH_ROLE: ${{ inputs.ssh_role }}
7173
RUNNER_TEMP: ${{ runner.temp }}
7274

7375
- name: Revoke Vault token
7476
shell: bash
7577
run: |
76-
curl --fail --silent --show-error --header "X-Vault-Token: $VAULT_TOKEN" --data "" "${{ inputs.vault_server }}/v1/auth/token/revoke-self"
77-
echo "VAULT_TOKEN=revoked" >> "$GITHUB_ENV"
78+
curl --fail --silent --show-error --header "X-Vault-Token: ${{ steps.vault_auth.outputs.vault_token }}" --data "" "${{ inputs.vault_server }}/v1/auth/token/revoke-self"

0 commit comments

Comments
 (0)