Skip to content

Commit b3471cc

Browse files
committed
Refactor GitHub Actions workflows: consolidate permissions and remove deprecated Defender workflow
1 parent 70e2aad commit b3471cc

File tree

4 files changed

+13
-60
lines changed

4 files changed

+13
-60
lines changed

.github/workflows/CIS-Anchore-Grype.yml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,25 +15,27 @@ env:
1515
fail-build: false # Set to true to fail the build if vulnerabilities are found
1616
imageName: "webapp01"
1717
tag: ${{ github.sha }}
18+
19+
permissions:
20+
contents: read # for actions/checkout to fetch code
21+
security-events: write # for github/codeql-action/upload-sarif to upload SARIF results
22+
actions: read # only required for a private repository by github/codeql-action/upload-sarif to get the Action run status
1823

1924
jobs:
2025
anchore-grype-scan:
2126
name: Anchore Grype Vulnerability Scan
2227

2328
runs-on: ubuntu-latest
2429

25-
permissions:
26-
contents: read # for actions/checkout to fetch code
27-
security-events: write # for github/codeql-action/upload-sarif to upload SARIF results
28-
actions: read # only required for a private repository by github/codeql-action/upload-sarif to get the Action run status
29-
3030
steps:
3131
- name: Checkout code
3232
uses: actions/checkout@v4
3333

3434
- name: Build an image from Dockerfile
3535
uses: docker/build-push-action@v4
3636
with:
37+
context: ./src/webapp01
38+
file: ./src/webapp01/Dockerfile
3739
tags: "${{ env.imageName }}:${{ env.tag }}"
3840
push: false
3941
load: true

.github/workflows/CIS-Trivy-AquaSecurity.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,17 @@ env:
1616
imageName: "webapp01"
1717
tag: ${{ github.sha }}
1818

19+
permissions:
20+
contents: read # for actions/checkout to fetch code
21+
security-events: write # for github/codeql-action/upload-sarif to upload SARIF results
22+
actions: read # only required for a private repository by github/codeql-action/upload-sarif to get the Action run status
23+
1924
jobs:
2025
trivy:
2126
name: Trivy vulnerability scanner
2227

2328
runs-on: ubuntu-latest
2429

25-
permissions:
26-
contents: read # for actions/checkout to fetch code
27-
security-events: write # for github/codeql-action/upload-sarif to upload SARIF results
28-
actions: read # only required for a private repository by github/codeql-action/upload-sarif to get the Action run status
29-
3030
steps:
3131
- name: Checkout code
3232
uses: actions/checkout@v4

.github/workflows/codeql.yml renamed to .github/workflows/SAST-GitHubAdvancedSecurity-CodeQL.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: "CodeQL Advanced"
1+
name: "SAST - Code Scanning - CodeQL Advanced"
22

33
on:
44
push:
@@ -20,10 +20,8 @@ jobs:
2020
permissions:
2121
# required for all workflows
2222
security-events: write
23-
2423
# required to fetch internal or private CodeQL packs
2524
packages: read
26-
2725
# only required for workflows in private repositories
2826
actions: read
2927
contents: read

.github/workflows/defender-for-devops.yml

Lines changed: 0 additions & 47 deletions
This file was deleted.

0 commit comments

Comments
 (0)