Skip to content

Commit fcdfc1d

Browse files
dschomjcheetham
authored andcommitted
winget: switch to using an Azure KeyVault (#702)
Instead of storing the Personal Access Token in an environment secret, store it in Azure KeyVault instead. This allows for much better auditing when (and where) the secret is used. Ideally, we would even switch away from using a Personal Access Token in the first place. But there is no alternative, such as a Managed Identity on GitHub, where one could define in a fine-grained way which usage scenario can be performed using that identity, and recent reorgs at GitHub suggest that adding such an alternative may not be on the list of priorities at all. So let's just stay with a Personal Access Token, but do safeguard it better by putting it into a KeyVault that can only be accessed by a narrowly-scoped GitHub Actions environment.
2 parents 8a9d221 + a98c3d7 commit fcdfc1d

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

.github/workflows/release-winget.yml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,21 @@ on:
1010
required: true
1111
default: 'latest'
1212

13+
permissions:
14+
id-token: write # required for Azure login via OIDC
15+
1316
jobs:
1417
release:
1518
runs-on: windows-latest
1619
environment: release
1720
steps:
21+
- name: Log into Azure
22+
uses: azure/login@v2
23+
with:
24+
client-id: ${{ secrets.AZURE_CLIENT_ID }}
25+
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
26+
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
27+
1828
- name: Publish manifest with winget-create
1929
run: |
2030
# Get correct release asset
@@ -37,5 +47,5 @@ jobs:
3747
3848
# Submit manifests
3949
$manifestDirectory = Split-Path "$manifestPath"
40-
.\wingetcreate.exe submit -t "${{ secrets.WINGET_TOKEN }}" $manifestDirectory
50+
.\wingetcreate.exe submit -t "(az keyvault secret show --name ${{ secrets.WINGET_TOKEN_SECRET_NAME }} --vault-name ${{ secrets.AZURE_VAULT }} --query "value")" $manifestDirectory
4151
shell: powershell

0 commit comments

Comments
 (0)