Skip to content

Commit 26b2eb1

Browse files
authored
Merge pull request #102 from step-security-bot/stepsecurity_remediation_1727858233
[StepSecurity] Apply security best practices
2 parents 903ff68 + 5dbac9d commit 26b2eb1

File tree

6 files changed

+155
-6
lines changed

6 files changed

+155
-6
lines changed

.github/dependabot.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,8 @@ updates:
55
schedule:
66
interval: "weekly"
77
open-pull-requests-limit: 15
8+
9+
- package-ecosystem: github-actions
10+
directory: /
11+
schedule:
12+
interval: daily

.github/workflows/codeql.yml

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ on:
2020
schedule:
2121
- cron: '31 21 * * 1'
2222

23+
permissions:
24+
contents: read
25+
2326
jobs:
2427
analyze:
2528
name: Analyze
@@ -39,12 +42,17 @@ jobs:
3942
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
4043

4144
steps:
45+
- name: Harden Runner
46+
uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1
47+
with:
48+
egress-policy: audit
49+
4250
- name: Checkout repository
43-
uses: actions/checkout@v3
51+
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
4452

4553
# Initializes the CodeQL tools for scanning.
4654
- name: Initialize CodeQL
47-
uses: github/codeql-action/init@v2
55+
uses: github/codeql-action/init@85b07cf1e13dd512be7c27c37a33c5864c252fcc # v2.26.10
4856
with:
4957
languages: ${{ matrix.language }}
5058
# If you wish to specify custom queries, you can do so here or in a config file.
@@ -58,7 +66,7 @@ jobs:
5866
# Autobuild attempts to build any compiled languages (C/C++, C#, Go, or Java).
5967
# If this step fails, then you should remove it and run the build manually (see below)
6068
- name: Autobuild
61-
uses: github/codeql-action/autobuild@v2
69+
uses: github/codeql-action/autobuild@85b07cf1e13dd512be7c27c37a33c5864c252fcc # v2.26.10
6270

6371
# ℹ️ Command-line programs to run using the OS shell.
6472
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
@@ -71,6 +79,6 @@ jobs:
7179
# ./location_of_script_within_repo/buildscript.sh
7280

7381
- name: Perform CodeQL Analysis
74-
uses: github/codeql-action/analyze@v2
82+
uses: github/codeql-action/analyze@85b07cf1e13dd512be7c27c37a33c5864c252fcc # v2.26.10
7583
with:
7684
category: "/language:${{matrix.language}}"
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 Runner
20+
uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1
21+
with:
22+
egress-policy: audit
23+
24+
- name: 'Checkout Repository'
25+
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
26+
- name: 'Dependency Review'
27+
uses: actions/dependency-review-action@5a2ce3f5b92ee19cbb1541a4984c76d921601d7c # v4.3.4

.github/workflows/protos.yml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,23 @@ on:
44
push:
55
branches: [ "main" ]
66

7+
permissions:
8+
contents: read
9+
710
jobs:
811
copy-proto:
12+
permissions:
13+
contents: write # for Git to git push
914
runs-on: ubuntu-latest
1015

1116
steps:
17+
- name: Harden Runner
18+
uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1
19+
with:
20+
egress-policy: audit
21+
1222
- name: Checkout Repository
13-
uses: actions/checkout@v3
23+
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
1424

1525
- name: Run Bash Script to Overwrite Proto Directory
1626
run: |
@@ -51,7 +61,7 @@ jobs:
5161
echo "Successfully copied the proto directory to $TARGET_DIR."
5262
5363
- name: Install Node.js and Dependencies
54-
uses: actions/setup-node@v3
64+
uses: actions/setup-node@1a4442cacd436585916779262731d5b162bc6ec7 # v3.8.2
5565
with:
5666
node-version: '18'
5767

.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 Runner
39+
uses: step-security/harden-runner@91182cccc01eb5e619899d80e4e971d6181294a7 # v2.10.1
40+
with:
41+
egress-policy: audit
42+
43+
- name: "Checkout code"
44+
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
45+
with:
46+
persist-credentials: false
47+
48+
- name: "Run analysis"
49+
uses: ossf/scorecard-action@dc50aa9510b46c811795eb24b2f1ba02a914e534 # v2.3.3
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@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0
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@e2b3eafc8d227b0241d48be5f425d47c2d750a13 # v3.26.10
80+
with:
81+
sarif_file: results.sarif

.pre-commit-config.yaml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
repos:
2+
- repo: https://github.com/gitleaks/gitleaks
3+
rev: v8.16.3
4+
hooks:
5+
- id: gitleaks
6+
- repo: https://github.com/jumanjihouse/pre-commit-hooks
7+
rev: 3.0.0
8+
hooks:
9+
- id: shellcheck
10+
- repo: https://github.com/pre-commit/mirrors-eslint
11+
rev: v8.38.0
12+
hooks:
13+
- id: eslint
14+
- repo: https://github.com/pre-commit/pre-commit-hooks
15+
rev: v4.4.0
16+
hooks:
17+
- id: end-of-file-fixer
18+
- id: trailing-whitespace

0 commit comments

Comments
 (0)