Skip to content

Commit 8efa874

Browse files
authored
Merge pull request #1735 from step-security-bot/stepsecurity_remediation_1730800738
[StepSecurity] ci: Harden GitHub Actions
2 parents 3b864e0 + 6e754ab commit 8efa874

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

.github/workflows/dependabot-automerge.yml

+3
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ on:
33
merge_group:
44
pull_request:
55

6+
permissions:
7+
contents: read
8+
69
jobs:
710
dependabot:
811
runs-on: ubuntu-latest

.github/workflows/sonarcloud.yml

+13-2
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,28 @@ on:
77
pull_request:
88
types: [opened, synchronize, reopened]
99

10+
permissions:
11+
contents: read
12+
1013
jobs:
1114
sonarcloud:
15+
permissions:
16+
contents: read # for actions/checkout to fetch code
17+
pull-requests: read # for SonarSource/sonarcloud-github-action to determine which PR to decorate
1218
name: SonarCloud
1319
runs-on: ubuntu-latest
1420
steps:
15-
- uses: actions/checkout@v3
21+
- name: Harden Runner
22+
uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1
23+
with:
24+
egress-policy: audit
25+
26+
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
1627
with:
1728
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
1829

1930
- name: SonarCloud Scan
20-
uses: SonarSource/sonarcloud-github-action@master
31+
uses: SonarSource/sonarcloud-github-action@9f9bba2c7aaf7a55eac26abbac906c3021d211b2 # master
2132
env:
2233
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
2334
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

0 commit comments

Comments
 (0)