Skip to content

Commit 53d4a41

Browse files
authored
Update GHA for OpenSSF score analysis (#75)
* Update GHA for OpenSSF score analysis Signed-off-by: Arrobo, Gabriel <gabriel.arrobo@intel.com> * Address Copilot's comment Signed-off-by: Arrobo, Gabriel <gabriel.arrobo@intel.com> --------- Signed-off-by: Arrobo, Gabriel <gabriel.arrobo@intel.com>
1 parent 1f8460e commit 53d4a41

2 files changed

Lines changed: 37 additions & 9 deletions

File tree

.github/workflows/scorecard-analysis.yml

Lines changed: 36 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,47 @@ on:
1010
required: false
1111
type: string
1212
default: ${{ github.ref }}
13+
publish_results:
14+
description: "Whether to publish results for badge generation"
15+
required: false
16+
type: boolean
17+
default: true
18+
retention_days:
19+
description: "Days to retain SARIF artifact"
20+
required: false
21+
type: number
22+
default: 5
23+
allowed_orgs:
24+
description: "Comma-separated list of allowed repository owners"
25+
required: false
26+
type: string
27+
default: "omec-project"
1328

1429
permissions: read-all
1530

1631
jobs:
1732
score-analysis:
1833
runs-on: ubuntu-latest
19-
if: github.repository_owner == 'omec-project'
34+
if: contains(fromJSON(format('["{0}"]', join('","', split(inputs.allowed_orgs, ',')))), github.repository_owner)
2035
permissions:
36+
# Needed to upload the results to code-scanning dashboard.
2137
security-events: write
38+
# Needed to publish results and get a badge (see publish_results below).
2239
id-token: write
40+
contents: read
41+
actions: read
42+
# To allow GraphQL ListCommits to work
43+
issues: read
44+
pull-requests: read
45+
# To detect SAST tools
46+
checks: read
2347

2448
steps:
49+
- name: Harden the runner (Audit all outbound calls)
50+
uses: step-security/harden-runner@v2.13.2
51+
with:
52+
egress-policy: audit
53+
2554
- uses: actions/checkout@v6
2655
with:
2756
ref: ${{ inputs.branch_name }}
@@ -32,17 +61,16 @@ jobs:
3261
with:
3362
results_file: results.sarif
3463
results_format: sarif
35-
publish_results: true
64+
publish_results: ${{ inputs.publish_results }}
3665

3766
- name: Upload artifact
3867
uses: actions/upload-artifact@v5.0.0
3968
with:
4069
name: SARIF file
4170
path: results.sarif
42-
retention-days: 5
71+
retention-days: ${{ inputs.retention_days }}
4372

44-
# Disabling upload to code-scanning
45-
# - name: Upload to code-scanning
46-
# uses: github/codeql-action/upload-sarif@v3
47-
# with:
48-
# sarif_file: results.sarif
73+
- name: Upload to code-scanning
74+
uses: github/codeql-action/upload-sarif@v3
75+
with:
76+
sarif_file: results.sarif

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.0.2-dev
1+
0.0.2

0 commit comments

Comments
 (0)