Skip to content

Commit 420ad82

Browse files
fix: [DevOps] CodeQL Security findings (#540)
1 parent b35d43e commit 420ad82

File tree

7 files changed

+41
-4
lines changed

7 files changed

+41
-4
lines changed

.github/workflows/continuous-integration.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ jobs:
1515

1616
continuous-integration:
1717
runs-on: ubuntu-latest
18+
permissions:
19+
contents: write
1820
steps:
1921

2022
- name: "Checkout repository"

.github/workflows/dependency-test.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ env:
1010
jobs:
1111
fetch-dependency-versions:
1212
runs-on: ubuntu-latest
13+
permissions:
14+
contents: none
1315
outputs:
1416
versions: ${{ steps.fetch-versions.outputs.VERSIONS }}
1517

@@ -75,6 +77,8 @@ jobs:
7577
matrix:
7678
version: ${{ fromJson(needs.fetch-dependency-versions.outputs.versions) }}
7779
continue-on-error: true
80+
permissions:
81+
contents: read
7882
steps:
7983
- name: "Checkout repository"
8084
uses: actions/checkout@v4

.github/workflows/deploy-snapshot.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,11 @@ on:
77

88
jobs:
99
deploy-snapshot:
10-
name: Deploy Snapshot
10+
name: "Deploy Snapshot"
1111
runs-on: ubuntu-latest
1212
timeout-minutes: 15
13+
permissions:
14+
contents: read
1315
steps:
1416
- name: "Checkout Repository"
1517
uses: actions/checkout@v4

.github/workflows/e2e-test.yaml

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ env:
1010

1111
jobs:
1212
end-to-end-tests:
13+
permissions:
14+
contents: read
1315
strategy:
1416
fail-fast: false
1517
matrix:
@@ -41,6 +43,12 @@ jobs:
4143
- name: "Run tests"
4244
id: run_tests
4345
run: |
46+
if [ "${{ matrix.environment }}" = "canary" ]; then
47+
export AICORE_SERVICE_KEY="${{ secrets.AI_CORE_CANARY }}"
48+
else
49+
export AICORE_SERVICE_KEY="${{ secrets.AI_CORE_PRODUCTION }}"
50+
fi
51+
4452
MVN_ARGS="${{ env.MVN_MULTI_THREADED_ARGS }} surefire:test -pl :spring-app -DskipTests=false"
4553
mvn $MVN_ARGS "-Daicore.landscape=${{ matrix.environment }}" | tee mvn_output.log # tee writes to both the console and a file
4654
@@ -60,10 +68,17 @@ jobs:
6068
fi
6169
env:
6270
# See "End-to-end test application instructions" on the README.md to update the secret
63-
AICORE_SERVICE_KEY: ${{ secrets[matrix.secret-name] }}
71+
AI_CORE_PRODUCTION: ${{ secrets.production }}
72+
AI_CORE_CANARY: ${{ secrets.canary }}
6473

6574
- name: "Start Application Locally"
6675
run: |
76+
if [ "${{ matrix.environment }}" = "canary" ]; then
77+
export AICORE_SERVICE_KEY="${{ secrets.AI_CORE_CANARY }}"
78+
else
79+
export AICORE_SERVICE_KEY="${{ secrets.AI_CORE_PRODUCTION }}"
80+
fi
81+
6782
cd sample-code/spring-app
6883
mvn spring-boot:run &
6984
timeout=15
@@ -77,7 +92,8 @@ jobs:
7792
done
7893
env:
7994
# See "End-to-end test application instructions" on the README.md to update the secret
80-
AICORE_SERVICE_KEY: ${{ secrets[matrix.secret-name] }}
95+
AI_CORE_PRODUCTION: ${{ secrets.production }}
96+
AI_CORE_CANARY: ${{ secrets.canary }}
8197

8298
- name: "Health Check"
8399
# print response body with headers to stdout. q:body only O:print -:stdout S:headers

.github/workflows/fosstars-report.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,10 @@ env:
1313

1414
jobs:
1515
create_fosstars_report:
16-
runs-on: ubuntu-latest
1716
name: "Security rating"
17+
runs-on: ubuntu-latest
18+
permissions:
19+
contents: read
1820
steps:
1921
- name: "Checkout repository"
2022
uses: actions/checkout@v4

.github/workflows/prepare-release.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ jobs:
2828
release-commit: ${{ steps.prepare-release.outputs.RELEASE_COMMIT_ID }}
2929
release-tag: ${{ steps.prepare-release.outputs.TAG_NAME }}
3030
runs-on: ubuntu-latest
31+
permissions:
32+
contents: write
3133
steps:
3234
- name: "Checkout Repository"
3335
uses: actions/checkout@v4
@@ -155,6 +157,9 @@ jobs:
155157
outputs:
156158
pr-url: ${{ steps.create-release-notes-pr.outputs.PR_URL }}
157159
runs-on: ubuntu-latest
160+
permissions:
161+
contents: write
162+
pull-requests: write
158163
steps:
159164
- name: "Checkout Code Repository"
160165
uses: actions/checkout@v4
@@ -233,6 +238,9 @@ jobs:
233238
outputs:
234239
pr-url: ${{ steps.create-code-pr.outputs.PR_URL }}
235240
runs-on: ubuntu-latest
241+
permissions:
242+
contents: write
243+
pull-requests: write
236244
steps:
237245
- name: "Checkout Repository"
238246
uses: actions/checkout@v4

.github/workflows/weekly-spec-update.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ on:
77
jobs:
88
update-all-specs:
99
runs-on: ubuntu-latest
10+
permissions:
11+
contents: write
12+
pull-requests: write
1013

1114
strategy:
1215
matrix:

0 commit comments

Comments
 (0)