Skip to content

Commit c7cba09

Browse files
fix: Apply security best practices from StepSecurity. (#32)
* [StepSecurity] Apply security best practices Signed-off-by: StepSecurity Bot <bot@stepsecurity.io> * build: Update dependabot.yml Signed-off-by: Ryan Parman <ryan@ryanparman.com> * Update dependency-review.yml Signed-off-by: Ryan Parman <ryan@ryanparman.com> * Update codeql.yml Signed-off-by: Ryan Parman <ryan@ryanparman.com> * Update dependency-review.yml Signed-off-by: Ryan Parman <ryan@ryanparman.com> * Delete .github/workflows/release.yml Signed-off-by: Ryan Parman <ryan@ryanparman.com> * Update scorecard.yml Signed-off-by: Ryan Parman <ryan@ryanparman.com> * Update .pre-commit-config.yaml Signed-off-by: Ryan Parman <ryan@ryanparman.com> * Update codeql.yml Signed-off-by: Ryan Parman <ryan@ryanparman.com> --------- Signed-off-by: StepSecurity Bot <bot@stepsecurity.io> Signed-off-by: Ryan Parman <ryan@ryanparman.com> Co-authored-by: Ryan Parman <ryan@ryanparman.com>
1 parent 7e8e142 commit c7cba09

11 files changed

+146
-53
lines changed

.devcontainer/Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# syntax=docker/dockerfile:1
2-
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/devcontainers/base:ubuntu AS base-builder
2+
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/devcontainers/base:ubuntu@sha256:a724e14d4175f641fd52ee317680e7b228d5c553c3ac1a558b069a3373688016 AS base-builder
33

44
# Switch to proper Bash
55
SHELL ["/bin/bash", "-euo", "pipefail", "-c"]

.github/dependabot.yml

+16-1
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,19 @@ updates:
99
- package-ecosystem: gomod # See documentation for possible values
1010
directory: / # Location of package manifests
1111
schedule:
12-
interval: weekly
12+
interval: daily
13+
14+
- package-ecosystem: docker
15+
directory: /.devcontainer
16+
schedule:
17+
interval: daily
18+
19+
- package-ecosystem: github-actions
20+
directory: /
21+
schedule:
22+
interval: daily
23+
24+
- package-ecosystem: gomod
25+
directory: /generator
26+
schedule:
27+
interval: daily

.github/workflows/codeql.yml

+63
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# For most projects, this workflow file will not need changing; you simply need
2+
# to commit it to your repository.
3+
#
4+
# You may wish to alter this file to override the set of languages analyzed,
5+
# or to provide custom queries or build logic.
6+
#
7+
# ******** NOTE ********
8+
# We have attempted to detect the languages in your repository. Please check
9+
# the `language` matrix defined below to confirm you have the correct set of
10+
# supported CodeQL languages.
11+
#
12+
name: "CodeQL"
13+
14+
on:
15+
push:
16+
branches: ["main"]
17+
pull_request:
18+
# The branches below must be a subset of the branches above
19+
branches: ["main"]
20+
schedule:
21+
- cron: "0 0 * * 1"
22+
23+
permissions:
24+
contents: read
25+
26+
jobs:
27+
analyze:
28+
name: Analyze
29+
runs-on: ubuntu-latest
30+
permissions:
31+
actions: read
32+
contents: read
33+
security-events: write
34+
35+
strategy:
36+
fail-fast: false
37+
matrix:
38+
language: ["go"]
39+
# CodeQL supports [ $supported-codeql-languages ]
40+
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
41+
42+
steps:
43+
- name: Harden Runner
44+
uses: step-security/harden-runner@1b05615854632b887b69ae1be8cbefe72d3ae423 # v2.6.0
45+
with:
46+
egress-policy: audit
47+
48+
- name: Checkout repository
49+
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
50+
51+
# Initializes the CodeQL tools for scanning.
52+
- name: Initialize CodeQL
53+
uses: github/codeql-action/init@49abf0ba24d0b7953cb586944e918a0b92074c80 # v2.22.4
54+
with:
55+
languages: ${{ matrix.language }}
56+
# If you wish to specify custom queries, you can do so here or in a config file.
57+
# By default, queries listed here will override any specified in a config file.
58+
# Prefix the list here with "+" to use these queries and those in the config file.
59+
60+
- name: Perform CodeQL Analysis
61+
uses: github/codeql-action/analyze@49abf0ba24d0b7953cb586944e918a0b92074c80 # v2.22.4
62+
with:
63+
category: "/language:${{matrix.language}}"
+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
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@1b05615854632b887b69ae1be8cbefe72d3ae423 # v2.6.0
21+
with:
22+
egress-policy: audit
23+
24+
- name: 'Checkout Repository'
25+
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
26+
27+
- name: 'Dependency Review'
28+
uses: actions/dependency-review-action@0efb1d1d84fc9633afcdaad14c485cbbc90ef46c # v2.5.1

.github/workflows/gosec.yml

+7-2
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,15 @@ jobs:
2020
runs-on: ubuntu-latest
2121
name: Run gosec
2222
steps:
23+
- name: Harden Runner
24+
uses: step-security/harden-runner@1b05615854632b887b69ae1be8cbefe72d3ae423 # v2.6.0
25+
with:
26+
egress-policy: audit
27+
2328
- name: Checkout Source
24-
uses: actions/checkout@v4
29+
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
2530

2631
- name: Run Gosec Security Scanner
27-
uses: securego/gosec@master
32+
uses: securego/gosec@5567ac4cfe9acae14f516b500e2cf229b6a8d16f # master
2833
with:
2934
args: ./...

.github/workflows/govulncheck.yml

+6-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,12 @@ jobs:
2020
runs-on: ubuntu-latest
2121
name: Run govulncheck
2222
steps:
23+
- name: Harden Runner
24+
uses: step-security/harden-runner@1b05615854632b887b69ae1be8cbefe72d3ae423 # v2.6.0
25+
with:
26+
egress-policy: audit
27+
2328
- id: govulncheck
24-
uses: golang/govulncheck-action@v1
29+
uses: golang/govulncheck-action@7da72f730e37eeaad891fcff0a532d27ed737cd4 # v1.0.1
2530
with:
2631
check-latest: true

.github/workflows/osv-scanner.yml

+7-2
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,13 @@ jobs:
2020
runs-on: ubuntu-latest
2121
name: Run osv-scanner
2222
steps:
23+
- name: Harden Runner
24+
uses: step-security/harden-runner@1b05615854632b887b69ae1be8cbefe72d3ae423 # v2.6.0
25+
with:
26+
egress-policy: audit
27+
2328
- name: Checkout Source
24-
uses: actions/checkout@v4
29+
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
2530

2631
- name: Check dependencies for security vulnerabilities
27-
uses: g-rath/check-with-osv-detector@main
32+
uses: g-rath/check-with-osv-detector@0e8c0f954d8618a3a4671eca1918b30b2d085af3 # main

.github/workflows/release.yml

-43
This file was deleted.

.github/workflows/scorecard.yml

+6-1
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,13 @@ jobs:
3232
# actions: read
3333

3434
steps:
35+
- name: Harden Runner
36+
uses: step-security/harden-runner@1b05615854632b887b69ae1be8cbefe72d3ae423 # v2.6.0
37+
with:
38+
egress-policy: audit
39+
3540
- name: Checkout code
36-
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0
41+
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
3742
with:
3843
persist-credentials: false
3944

.github/workflows/trufflehog.yml

+7-2
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,18 @@ jobs:
2020
runs-on: ubuntu-latest
2121
name: Run TruffleHog
2222
steps:
23+
- name: Harden Runner
24+
uses: step-security/harden-runner@1b05615854632b887b69ae1be8cbefe72d3ae423 # v2.6.0
25+
with:
26+
egress-policy: audit
27+
2328
- name: Checkout Source
24-
uses: actions/checkout@v4
29+
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
2530
with:
2631
fetch-depth: 0
2732

2833
- name: Check secrets with TruffleHog OSS
29-
uses: trufflesecurity/trufflehog@main
34+
uses: trufflesecurity/trufflehog@b8724e87e6c7f6785bee707a82172d03e3006efb # main
3035
with:
3136
path: ./
3237
head: HEAD

.pre-commit-config.yaml

+5
Original file line numberDiff line numberDiff line change
@@ -96,3 +96,8 @@ repos:
9696
entry: bash -c 'trufflehog git file://. --since-commit HEAD --only-verified --fail --json 2>/dev/null | jq "."'
9797
language: system
9898
stages: [commit, push]
99+
100+
- repo: https://github.com/gitleaks/gitleaks
101+
rev: v8.16.3
102+
hooks:
103+
- id: gitleaks

0 commit comments

Comments
 (0)