Skip to content

Commit

Permalink
chore(StepSecurity): Apply security best practices (#798)
Browse files Browse the repository at this point in the history
Signed-off-by: StepSecurity Bot <bot@stepsecurity.io>
  • Loading branch information
step-security-bot authored Jan 7, 2025
1 parent 8fc8250 commit 9bddf76
Show file tree
Hide file tree
Showing 8 changed files with 311 additions and 14 deletions.
11 changes: 11 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
version: 2
updates:
- package-ecosystem: github-actions
directory: /
schedule:
interval: daily

- package-ecosystem: pip
directory: /
schedule:
interval: daily
78 changes: 78 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"

on:
push:
branches: ["main"]
pull_request:
# The branches below must be a subset of the branches above
branches: ["main"]
schedule:
- cron: "0 0 * * 1"

permissions:
contents: read

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write

strategy:
fail-fast: false
matrix:
language: ["python"]
# CodeQL supports [ $supported-codeql-languages ]
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support

steps:
- name: Harden Runner
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
with:
egress-policy: audit

- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@48ab28a6f5dbc2a99bf1e0131198dd8f1df78169 # v3.28.0
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.

# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@48ab28a6f5dbc2a99bf1e0131198dd8f1df78169 # v3.28.0

# ℹ️ Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun

# If the Autobuild fails above, remove it and uncomment the following three lines.
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.

# - run: |
# echo "Run, Build Application using script"
# ./location_of_script_within_repo/buildscript.sh

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@48ab28a6f5dbc2a99bf1e0131198dd8f1df78169 # v3.28.0
with:
category: "/language:${{matrix.language}}"
27 changes: 27 additions & 0 deletions .github/workflows/dependency-review.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Dependency Review Action
#
# This Action will scan dependency manifest files that change as part of a Pull Request,
# surfacing known-vulnerable versions of the packages declared or updated in the PR.
# Once installed, if the workflow run is marked as required,
# PRs introducing known-vulnerable packages will be blocked from merging.
#
# Source repository: https://github.com/actions/dependency-review-action
name: 'Dependency Review'
on: [pull_request]

permissions:
contents: read

jobs:
dependency-review:
runs-on: ubuntu-latest
steps:
- name: Harden Runner
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
with:
egress-policy: audit

- name: 'Checkout Repository'
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: 'Dependency Review'
uses: actions/dependency-review-action@3b139cfc5fae8b618d3eae3675e383bb1769c019 # v4.5.0
74 changes: 71 additions & 3 deletions .github/workflows/linux-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ env:
BASE_DIR: '${{ github.sha }}-${{ github.run_id }}_${{ github.run_attempt }}'

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
permissions:
contents: read

jobs:

prepare:
Expand All @@ -40,13 +43,18 @@ jobs:

steps:

- name: Harden Runner
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
with:
egress-policy: audit

- name: 'checkout the monitoring-plugins repo'
uses: 'actions/checkout@v4'
uses: 'actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2'
with:
path: '${{ env.BASE_DIR }}/repos/monitoring-plugins'

- name: 'checkout the lib repo'
uses: 'actions/checkout@v4'
uses: 'actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2'
with:
repository: 'Linuxfabrik/lib'
ref: '${{ inputs.lib-repo-ref || github.ref_name }}'
Expand All @@ -66,6 +74,11 @@ jobs:

steps:

- name: Harden Runner
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
with:
egress-policy: audit

- name: 'mkdir ${{ env.BASE_DIR }}/build/debian10'
run: 'mkdir ${{ env.BASE_DIR }}/build/debian10'

Expand All @@ -86,6 +99,11 @@ jobs:

steps:

- name: Harden Runner
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
with:
egress-policy: audit

- name: 'mkdir ${{ env.BASE_DIR }}/build/debian11'
run: 'mkdir ${{ env.BASE_DIR }}/build/debian11'

Expand All @@ -106,6 +124,11 @@ jobs:

steps:

- name: Harden Runner
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
with:
egress-policy: audit

- name: 'mkdir ${{ env.BASE_DIR }}/build/debian12'
run: 'mkdir ${{ env.BASE_DIR }}/build/debian12'

Expand All @@ -127,6 +150,11 @@ jobs:

steps:

- name: Harden Runner
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
with:
egress-policy: audit

- name: 'mkdir ${{ env.BASE_DIR }}/build/rhel7'
run: 'mkdir ${{ env.BASE_DIR }}/build/rhel7'

Expand All @@ -147,6 +175,11 @@ jobs:

steps:

- name: Harden Runner
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
with:
egress-policy: audit

- name: 'mkdir ${{ env.BASE_DIR }}/build/rhel8'
run: 'mkdir ${{ env.BASE_DIR }}/build/rhel8'

Expand All @@ -167,6 +200,11 @@ jobs:

steps:

- name: Harden Runner
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
with:
egress-policy: audit

- name: 'mkdir ${{ env.BASE_DIR }}/build/rhel9'
run: 'mkdir ${{ env.BASE_DIR }}/build/rhel9'

Expand All @@ -188,6 +226,11 @@ jobs:

steps:

- name: Harden Runner
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
with:
egress-policy: audit

- name: 'mkdir ${{ env.BASE_DIR }}/build/ubuntu1804'
run: 'mkdir ${{ env.BASE_DIR }}/build/ubuntu1804'

Expand All @@ -208,6 +251,11 @@ jobs:

steps:

- name: Harden Runner
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
with:
egress-policy: audit

- name: 'mkdir ${{ env.BASE_DIR }}/build/ubuntu2004'
run: 'mkdir ${{ env.BASE_DIR }}/build/ubuntu2004'

Expand All @@ -228,6 +276,11 @@ jobs:

steps:

- name: Harden Runner
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
with:
egress-policy: audit

- name: 'mkdir ${{ env.BASE_DIR }}/build/ubuntu2204'
run: 'mkdir ${{ env.BASE_DIR }}/build/ubuntu2204'

Expand All @@ -248,6 +301,11 @@ jobs:

steps:

- name: Harden Runner
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
with:
egress-policy: audit

- name: 'mkdir ${{ env.BASE_DIR }}/build/ubuntu2404'
run: 'mkdir ${{ env.BASE_DIR }}/build/ubuntu2404'

Expand Down Expand Up @@ -280,8 +338,13 @@ jobs:

steps:

- name: Harden Runner
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
with:
egress-policy: audit

- name: 'upload the output as monitoring-plugins-linux-packages'
uses: 'actions/upload-artifact@v4'
uses: 'actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0'
with:
name: 'monitoring-plugins-linux-packages'
path: '${{ env.BASE_DIR }}/build/'
Expand All @@ -296,5 +359,10 @@ jobs:

steps:

- name: Harden Runner
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
with:
egress-policy: audit

- name: 'rm -rf ${{ env.BASE_DIR }}'
run: 'rm -rf ${{ env.BASE_DIR }}'
Loading

0 comments on commit 9bddf76

Please sign in to comment.