Skip to content

Commit 61b18f8

Browse files
[StepSecurity] Apply security best practices
Signed-off-by: StepSecurity Bot <[email protected]>
1 parent 40a467e commit 61b18f8

23 files changed

+279
-1
lines changed

.github/workflows/build-trigger-argo-workflow.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ on:
1616
- synchronize
1717
merge_group:
1818

19+
permissions:
20+
contents: read
21+
1922
jobs:
2023
lint-test-build:
2124
runs-on: ubuntu-latest
@@ -26,6 +29,11 @@ jobs:
2629
contents: read
2730

2831
steps:
32+
- name: Harden the runner (Audit all outbound calls)
33+
uses: step-security/harden-runner@0634a2670c59f64b4a01f0f96f84700a4088b9f0 # v2.12.0
34+
with:
35+
egress-policy: audit
36+
2937
- name: Checkout code
3038
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
3139
with:

.github/workflows/check-drone-signature.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ on:
1212
type: string
1313
default: "https://drone.grafana.net"
1414

15+
permissions:
16+
contents: read
17+
1518
jobs:
1619
# This job checks if we should run the drone signature check.
1720
# If the repository is under the "grafana" org, we will run the signature check.
@@ -24,6 +27,11 @@ jobs:
2427
outputs:
2528
isFork: ${{ steps.check-if-fork.outputs.isFork }}
2629
steps:
30+
- name: Harden the runner (Audit all outbound calls)
31+
uses: step-security/harden-runner@0634a2670c59f64b4a01f0f96f84700a4088b9f0 # v2.12.0
32+
with:
33+
egress-policy: audit
34+
2735
- name: Check if forked repository
2836
id: check-if-fork
2937
run: |
@@ -55,6 +63,11 @@ jobs:
5563
needs: check-fork
5664
if: needs.check-fork.outputs.isFork == 'false'
5765
steps:
66+
- name: Harden the runner (Audit all outbound calls)
67+
uses: step-security/harden-runner@0634a2670c59f64b4a01f0f96f84700a4088b9f0 # v2.12.0
68+
with:
69+
egress-policy: audit
70+
5871
- name: Checkout repo
5972
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
6073
with:

.github/workflows/check-for-non-releasable-actions.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ on:
1111
branches:
1212
- main
1313

14+
permissions:
15+
contents: read
16+
1417
jobs:
1518
check-for-non-releasable-actions:
1619
permissions:
@@ -20,6 +23,11 @@ jobs:
2023
timeout-minutes: 5
2124

2225
steps:
26+
- name: Harden the runner (Audit all outbound calls)
27+
uses: step-security/harden-runner@0634a2670c59f64b4a01f0f96f84700a4088b9f0 # v2.12.0
28+
with:
29+
egress-policy: audit
30+
2331
- name: Checkout Code
2432
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
2533
with:

.github/workflows/codeql.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ on:
2020
# To trigger a CodeQL analysis manually
2121
workflow_dispatch:
2222

23+
permissions:
24+
contents: read
25+
2326
jobs:
2427
analyze:
2528
name: Analyze (${{ matrix.language }})
@@ -43,6 +46,11 @@ jobs:
4346
- "**/dist/**"
4447

4548
steps:
49+
- name: Harden the runner (Audit all outbound calls)
50+
uses: step-security/harden-runner@0634a2670c59f64b4a01f0f96f84700a4088b9f0 # v2.12.0
51+
with:
52+
egress-policy: audit
53+
4654
- name: Checkout repository
4755
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
4856
with:
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Dependency Review Action
2+
#
3+
# This Action will scan dependency manifest files that change as part of a Pull Request,
4+
# surfacing known-vulnerable versions of the packages declared or updated in the PR.
5+
# Once installed, if the workflow run is marked as required,
6+
# PRs introducing known-vulnerable packages will be blocked from merging.
7+
#
8+
# Source repository: https://github.com/actions/dependency-review-action
9+
name: 'Dependency Review'
10+
on: [pull_request]
11+
12+
permissions:
13+
contents: read
14+
15+
jobs:
16+
dependency-review:
17+
runs-on: ubuntu-latest
18+
steps:
19+
- name: Harden the runner (Audit all outbound calls)
20+
uses: step-security/harden-runner@0634a2670c59f64b4a01f0f96f84700a4088b9f0 # v2.12.0
21+
with:
22+
egress-policy: audit
23+
24+
- name: 'Checkout Repository'
25+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
26+
- name: 'Dependency Review'
27+
uses: actions/dependency-review-action@67d4f4bd7a9b17a0db54d2a7519187c65e339de8 # v4

.github/workflows/lint-pr-title.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ on:
1010

1111
merge_group:
1212

13+
permissions:
14+
contents: read
15+
1316
jobs:
1417
lint-pr-title:
1518
permissions:
@@ -19,6 +22,11 @@ jobs:
1922
runs-on: ubuntu-latest
2023

2124
steps:
25+
- name: Harden the runner (Audit all outbound calls)
26+
uses: step-security/harden-runner@0634a2670c59f64b4a01f0f96f84700a4088b9f0 # v2.12.0
27+
with:
28+
egress-policy: audit
29+
2230
- name: Checkout
2331
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
2432
with:

.github/workflows/lint-shared-workflows.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ on:
1414

1515
name: Lint shared-workflows
1616

17+
permissions:
18+
contents: read
19+
1720
jobs:
1821
lint:
1922
name: Lint all shared workflows
@@ -24,6 +27,11 @@ jobs:
2427

2528
runs-on: ubuntu-latest
2629
steps:
30+
- name: Harden the runner (Audit all outbound calls)
31+
uses: step-security/harden-runner@0634a2670c59f64b4a01f0f96f84700a4088b9f0 # v2.12.0
32+
with:
33+
egress-policy: audit
34+
2735
- name: Checkout
2836
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
2937
with:
@@ -58,6 +66,11 @@ jobs:
5866
options: --user root
5967

6068
steps:
69+
- name: Harden the runner (Audit all outbound calls)
70+
uses: step-security/harden-runner@0634a2670c59f64b4a01f0f96f84700a4088b9f0 # v2.12.0
71+
with:
72+
egress-policy: audit
73+
6174
- name: Checkout
6275
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
6376
with:

.github/workflows/publish-techdocs.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,21 @@ on:
4646
default: "ops"
4747
type: string
4848

49+
permissions:
50+
contents: read
51+
4952
jobs:
5053
generate-and-publish-docs:
5154
runs-on: ubuntu-latest
5255
permissions:
5356
contents: "read"
5457
id-token: "write"
5558
steps:
59+
- name: Harden the runner (Audit all outbound calls)
60+
uses: step-security/harden-runner@0634a2670c59f64b4a01f0f96f84700a4088b9f0 # v2.12.0
61+
with:
62+
egress-policy: audit
63+
5664
- id: checkout
5765
name: Checkout
5866
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

.github/workflows/release.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ on:
55
branches:
66
- main
77

8+
permissions:
9+
contents: read
10+
811
jobs:
912
release-please:
1013
runs-on: ubuntu-latest
@@ -14,6 +17,11 @@ jobs:
1417
pull-requests: write # Needed to create release PRs
1518

1619
steps:
20+
- name: Harden the runner (Audit all outbound calls)
21+
uses: step-security/harden-runner@0634a2670c59f64b4a01f0f96f84700a4088b9f0 # v2.12.0
22+
with:
23+
egress-policy: audit
24+
1725
- uses: googleapis/release-please-action@a02a34c4d625f9be7cb89156071d8567266a2445 # v4.2.0
1826
id: release
1927
with:

.github/workflows/renovate.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ on:
2929
default: false
3030
type: boolean
3131

32+
permissions:
33+
contents: read
34+
3235
jobs:
3336
renovate:
3437
permissions:
@@ -38,6 +41,11 @@ jobs:
3841
timeout-minutes: 5
3942

4043
steps:
44+
- name: Harden the runner (Audit all outbound calls)
45+
uses: step-security/harden-runner@0634a2670c59f64b4a01f0f96f84700a4088b9f0 # v2.12.0
46+
with:
47+
egress-policy: audit
48+
4149
- name: Checkout Code
4250
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
4351
with:

.github/workflows/reusable-zizmor.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,11 @@ jobs:
5555
MIN_CONFIDENCE: ${{ inputs.min-confidence }}
5656

5757
steps:
58+
- name: Harden the runner (Audit all outbound calls)
59+
uses: step-security/harden-runner@0634a2670c59f64b4a01f0f96f84700a4088b9f0 # v2.12.0
60+
with:
61+
egress-policy: audit
62+
5863
- name: Checkout code
5964
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
6065
with:

.github/workflows/scorecards.yml

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
# This workflow uses actions that are not certified by GitHub. They are provided
2+
# by a third-party and are governed by separate terms of service, privacy
3+
# policy, and support documentation.
4+
5+
name: Scorecard supply-chain security
6+
on:
7+
# For Branch-Protection check. Only the default branch is supported. See
8+
# https://github.com/ossf/scorecard/blob/main/docs/checks.md#branch-protection
9+
branch_protection_rule:
10+
# To guarantee Maintained check is occasionally updated. See
11+
# https://github.com/ossf/scorecard/blob/main/docs/checks.md#maintained
12+
schedule:
13+
- cron: '20 7 * * 2'
14+
push:
15+
branches: ["main"]
16+
17+
# Declare default permissions as read only.
18+
permissions: read-all
19+
20+
jobs:
21+
analysis:
22+
name: Scorecard analysis
23+
runs-on: ubuntu-latest
24+
permissions:
25+
# Needed to upload the results to code-scanning dashboard.
26+
security-events: write
27+
# Needed to publish results and get a badge (see publish_results below).
28+
id-token: write
29+
contents: read
30+
actions: read
31+
# To allow GraphQL ListCommits to work
32+
issues: read
33+
pull-requests: read
34+
# To detect SAST tools
35+
checks: read
36+
37+
steps:
38+
- name: Harden the runner (Audit all outbound calls)
39+
uses: step-security/harden-runner@0634a2670c59f64b4a01f0f96f84700a4088b9f0 # v2.12.0
40+
with:
41+
egress-policy: audit
42+
43+
- name: "Checkout code"
44+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
45+
with:
46+
persist-credentials: false
47+
48+
- name: "Run analysis"
49+
uses: ossf/scorecard-action@62b2cac7ed8198b15735ed49ab1e5cf35480ba46 # v2.4.0
50+
with:
51+
results_file: results.sarif
52+
results_format: sarif
53+
# (Optional) "write" PAT token. Uncomment the `repo_token` line below if:
54+
# - you want to enable the Branch-Protection check on a *public* repository, or
55+
# - you are installing Scorecards on a *private* repository
56+
# To create the PAT, follow the steps in https://github.com/ossf/scorecard-action#authentication-with-pat.
57+
# repo_token: ${{ secrets.SCORECARD_TOKEN }}
58+
59+
# Public repositories:
60+
# - Publish results to OpenSSF REST API for easy access by consumers
61+
# - Allows the repository to include the Scorecard badge.
62+
# - See https://github.com/ossf/scorecard-action#publishing-results.
63+
# For private repositories:
64+
# - `publish_results` will always be set to `false`, regardless
65+
# of the value entered here.
66+
publish_results: true
67+
68+
# Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF
69+
# format to the repository Actions tab.
70+
- name: "Upload artifact"
71+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
72+
with:
73+
name: SARIF file
74+
path: results.sarif
75+
retention-days: 5
76+
77+
# Upload the results to GitHub's code scanning dashboard.
78+
- name: "Upload to code-scanning"
79+
uses: github/codeql-action/upload-sarif@28deaeda66b76a05916b6923827895f2b14ab387 # v3.28.16
80+
with:
81+
sarif_file: results.sarif

.github/workflows/self-zizmor.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ on:
33
push:
44
pull_request:
55

6+
permissions:
7+
contents: read
8+
69
jobs:
710
zizmor:
811
name: Run zizmor from current branch (self test)

.github/workflows/test-find-pr-for-commit.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,11 @@ jobs:
4646
pull-requests: read
4747

4848
steps:
49+
- name: Harden the runner (Audit all outbound calls)
50+
uses: step-security/harden-runner@0634a2670c59f64b4a01f0f96f84700a4088b9f0 # v2.12.0
51+
with:
52+
egress-policy: audit
53+
4954
- name: Checkout code
5055
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
5156
with:

.github/workflows/test-get-vault-secrets.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ on:
2020

2121
merge_group:
2222

23+
permissions:
24+
contents: read
25+
2326
jobs:
2427
test:
2528
strategy:
@@ -42,6 +45,11 @@ jobs:
4245
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.owner.login == 'grafana'
4346

4447
steps:
48+
- name: Harden the runner (Audit all outbound calls)
49+
uses: step-security/harden-runner@0634a2670c59f64b4a01f0f96f84700a4088b9f0 # v2.12.0
50+
with:
51+
egress-policy: audit
52+
4553
- name: Checkout code
4654
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
4755
with:
@@ -76,6 +84,11 @@ jobs:
7684
permissions:
7785
contents: read
7886
steps:
87+
- name: Harden the runner (Audit all outbound calls)
88+
uses: step-security/harden-runner@0634a2670c59f64b4a01f0f96f84700a4088b9f0 # v2.12.0
89+
with:
90+
egress-policy: audit
91+
7992
- name: Checkout code
8093
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
8194
with:

0 commit comments

Comments
 (0)