Skip to content

Commit 949b625

Browse files
committed
addressing feeback around token permissions
1 parent 21a356e commit 949b625

File tree

5 files changed

+29
-38
lines changed

5 files changed

+29
-38
lines changed

.github/workflows/assertion.yml

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,23 +26,14 @@ jobs:
2626
runs-on: ubuntu-22.04
2727
if: ${{ !github.event.pull_request.head.repo.fork }}
2828
permissions:
29-
id-token: write
30-
contents: read
31-
env:
32-
GOPROXY: "https://${{ secrets.ARTIFACTORY_USER }}:${{ secrets.ARTIFACTORY_TOKEN }}@${{ secrets.ARTIFACTORY_URL }}"
29+
contents: read # Needed to download artifacts
3330
strategy:
3431
matrix:
3532
osarch: [amd64, arm64]
3633
steps:
3734
- name: Checkout Repository
3835
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
3936

40-
- name: Set up Go
41-
uses: actions/setup-go@4dc6199c7b1a012772edbd06daecab0f50c9053c # v6.1.0
42-
with:
43-
go-version-file: 'go.mod'
44-
cache: false
45-
4637
- name: Download nginx-agent binary artifacts
4738
if: ${{ inputs.runId != '' }}
4839
uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # 7.0.0

.github/workflows/ci.yml

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -106,9 +106,6 @@ jobs:
106106
unit-test:
107107
name: Unit Tests
108108
runs-on: ubuntu-22.04
109-
permissions:
110-
id-token: write
111-
contents: write
112109
steps:
113110
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
114111
- name: Get Secrets from Azure Key Vault
@@ -142,8 +139,6 @@ jobs:
142139
race-condition-test:
143140
name: Unit tests with race condition detection
144141
runs-on: ubuntu-22.04
145-
permissions:
146-
id-token: write
147142
steps:
148143
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
149144
- name: Get Secrets from Azure Key Vault
@@ -172,8 +167,6 @@ jobs:
172167
build-unsigned-snapshot:
173168
name: Build Unsigned Snapshot
174169
runs-on: ubuntu-22.04
175-
permissions:
176-
id-token: write
177170
steps:
178171
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
179172
with:
@@ -219,7 +212,7 @@ jobs:
219212
needs: build-unsigned-snapshot
220213
runs-on: ubuntu-22.04
221214
permissions:
222-
id-token: write
215+
id-token: write # for OIDC authentication
223216
strategy:
224217
matrix:
225218
container:
@@ -280,8 +273,6 @@ jobs:
280273
name: Upgrade Tests
281274
needs: build-unsigned-snapshot
282275
runs-on: ubuntu-22.04
283-
permissions:
284-
id-token: write
285276
strategy:
286277
matrix:
287278
container:
@@ -343,8 +334,6 @@ jobs:
343334
needs: build-unsigned-snapshot
344335
if: ${{ !github.event.pull_request.head.repo.fork && !startsWith(github.head_ref, 'dependabot-') }}
345336
runs-on: ubuntu-22.04
346-
permissions:
347-
id-token: write
348337
strategy:
349338
matrix:
350339
container:
@@ -414,8 +403,6 @@ jobs:
414403
needs: build-unsigned-snapshot
415404
if: ${{ !github.event.pull_request.head.repo.fork && !startsWith(github.head_ref, 'dependabot-') }}
416405
runs-on: ubuntu-22.04
417-
permissions:
418-
id-token: write
419406
strategy:
420407
matrix:
421408
container:
@@ -512,8 +499,6 @@ jobs:
512499
needs: build-unsigned-snapshot
513500
if: ${{ !github.event.pull_request.head.repo.fork && !startsWith(github.head_ref, 'dependabot-') }}
514501
runs-on: ubuntu-22.04
515-
permissions:
516-
id-token: write
517502
strategy:
518503
matrix:
519504
container:
@@ -583,8 +568,6 @@ jobs:
583568
needs: build-unsigned-snapshot
584569
if: ${{ !github.event.pull_request.head.repo.fork && !startsWith(github.head_ref, 'dependabot-') }}
585570
runs-on: ubuntu-22.04
586-
permissions:
587-
id-token: write
588571
strategy:
589572
matrix:
590573
container:
@@ -678,7 +661,6 @@ jobs:
678661
runs-on: ubuntu-22.04
679662
needs: build-unsigned-snapshot
680663
permissions:
681-
id-token: write
682664
contents: write # Needed for pushing benchmark results to github branch
683665
steps:
684666
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
@@ -725,7 +707,6 @@ jobs:
725707
name: Load Tests
726708
if: ${{ !github.event.pull_request.head.repo.fork && !startsWith(github.head_ref, 'dependabot-') }}
727709
permissions:
728-
id-token: write
729710
contents: write # Needed for pushing benchmark results to github branch
730711
runs-on: ubuntu-22.04
731712
needs: build-unsigned-snapshot

.github/workflows/release-branch.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ on:
4545

4646
env:
4747
NFPM_VERSION: 'v2.35.3'
48-
GOPROXY: "https://${{ secrets.ARTIFACTORY_USER }}:${{ secrets.ARTIFACTORY_TOKEN }}@${{ secrets.ARTIFACTORY_URL_PROD }}"
4948

5049
defaults:
5150
run:
@@ -213,6 +212,15 @@ jobs:
213212
with:
214213
ref: ${{ inputs.releaseBranch }}
215214

215+
- name: Get Secrets from Azure Key Vault
216+
uses: ./.github/actions/az-sync
217+
with:
218+
az_client_id: ${{ secrets.AZ_KEYVAULT_CLIENT_ID }}
219+
az_tenant_id: ${{ secrets.AZ_KEYVAULT_TENANT_ID }}
220+
az_subscription_id: ${{ secrets.AZ_SUBSCRIPTION_ID }}
221+
keyvault: ${{ secrets.AZ_KEYVAULT_AGENT }}
222+
secrets-filter: 'artifactory'
223+
216224
- name: Setup go
217225
uses: actions/setup-go@4dc6199c7b1a012772edbd06daecab0f50c9053c # v6.1.0
218226
with:

.github/workflows/upload-release-assets.yml

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,21 @@ jobs:
5959
with:
6060
ref: ${{ inputs.releaseBranch }}
6161

62+
- name: Get Secrets from Azure Key Vault
63+
uses: ./.github/actions/az-sync
64+
with:
65+
az_client_id: ${{ secrets.AZ_KEYVAULT_CLIENT_ID }}
66+
az_tenant_id: ${{ secrets.AZ_KEYVAULT_TENANT_ID }}
67+
az_subscription_id: ${{ secrets.AZ_SUBSCRIPTION_ID }}
68+
keyvault: ${{ secrets.AZ_KEYVAULT_COMMON }}
69+
secrets-filter: 'nginx-pkg'
70+
6271
- name: Download Packages
6372
run:
6473
|
6574
echo "Checking Packages in ${{inputs.pkgRepo}}/nginx-agent"
66-
echo "${{secrets.PUBTEST_CERT}}" > pubtest.crt
67-
echo "${{secrets.PUBTEST_KEY}}" > pubtest.key
75+
echo "${{ env.nginx-pkg-certificate }}" > pubtest.crt
76+
echo "${{ env.nginx-pkg-key }}" > pubtest.key
6877

6978
DL=1 PKG_REPO=${{inputs.pkgRepo}} \
7079
CERT=pubtest.crt KEY=pubtest.key \
@@ -73,7 +82,7 @@ jobs:
7382
- name: GitHub Upload
7483
if: ${{ needs.vars.outputs.github_release == 'true' }}
7584
env:
76-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
85+
GITHUB_TOKEN: ${{ github.token }}
7786
# clobber overwrites existing assets of the same name
7887
run: |
7988
gh release list
@@ -92,16 +101,18 @@ jobs:
92101
with:
93102
inlineScript: |
94103
echo "Uploading tarball... nginx-agent/release-${{ inputs.pkgVersion }}/nginx-agent.tar.gz"
95-
az storage blob upload --auth-mode=login -f "${{ inputs.pkgRepo }}/nginx-agent/nginx-agent.tar.gz" \
104+
az storage blob upload --auth-mode=login \
105+
-f "${{ inputs.pkgRepo }}/nginx-agent/nginx-agent.tar.gz" \
96106
-c ${{ secrets.AZURE_CONTAINER_NAME }} \
97-
--account-name ${{ secrets.AZURE_ACCOUNT_NAME }} --overwrite -n nginx-agent/release-${{ inputs.pkgVersion }}/nginx-agent.tar.gz
107+
--account-name ${{ secrets.AZURE_ACCOUNT_NAME }} \
108+
--overwrite -n nginx-agent/release-${{ inputs.pkgVersion }}/nginx-agent.tar.gz
98109
99110
echo "Uploading packages..."
100111
for i in $(find ${{ inputs.pkgRepo }}/nginx-agent | grep -e "nginx-agent[_-]${{ inputs.pkgVersion }}"); do
101112
dest="nginx-agent/release-${{ inputs.pkgVersion }}/${i##*/}"
102113
echo "Uploading ${i} to ${dest}"
103114
az storage blob upload --auth-mode=login -f "$i" -c ${{ secrets.AZURE_CONTAINER_NAME }} \
104-
--account-name ${{ secrets.AZURE_ACCOUNT_NAME }} --overwrite -n ${dest}
115+
--account-name ${{ secrets.AZURE_ACCOUNT_NAME }} --overwrite -n ${dest}
105116
done
106117
107118
- name: Azure Logout

.github/workflows/vulncheck.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5.0.1
2929
with:
3030
fetch-depth: 0
31-
ref: ${{ inputs.targetBranch || 'main' }}
31+
ref: ${{ inputs.target-branch || 'main' }}
3232

3333
- name: Check Go version
3434
id: get-go-version

0 commit comments

Comments
 (0)