From 9e78ebfa14a5c40624c75b8a2cbc97beda1eb1e8 Mon Sep 17 00:00:00 2001 From: StepSecurity Bot Date: Sat, 9 Sep 2023 15:48:01 -0700 Subject: [PATCH] ci(security): apply best practices by step security (#8) * [StepSecurity] Apply security best practices Signed-off-by: StepSecurity Bot * Update and rename dependency-review.yml to deps-review.yml * Update deps-renovate.yaml --------- Signed-off-by: StepSecurity Bot Co-authored-by: Ahmed AbouZaid <6760103+aabouzaid@users.noreply.github.com> --- .github/workflows/deps-renovate.yaml | 5 ++++- .github/workflows/deps-review.yml | 27 +++++++++++++++++++++++++++ .github/workflows/sec-codeql.yml | 3 +++ .pre-commit-config.yaml | 14 ++++++++++++++ 4 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/deps-review.yml create mode 100644 .pre-commit-config.yaml diff --git a/.github/workflows/deps-renovate.yaml b/.github/workflows/deps-renovate.yaml index be9daf4..cdcc82f 100644 --- a/.github/workflows/deps-renovate.yaml +++ b/.github/workflows/deps-renovate.yaml @@ -1,4 +1,4 @@ -name: Deps - Renovate +name: Dependency - Renovate on: pull_request: @@ -6,6 +6,9 @@ on: - '.github/renovate.json5' workflow_dispatch: { } +permissions: + contents: read + jobs: check: name: Check renovate config diff --git a/.github/workflows/deps-review.yml b/.github/workflows/deps-review.yml new file mode 100644 index 0000000..69951e1 --- /dev/null +++ b/.github/workflows/deps-review.yml @@ -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@8ca2b8b2ece13480cda6dacd3511b49857a23c09 # v2.5.1 + with: + egress-policy: audit + + - name: 'Checkout Repository' + uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0 + - name: 'Dependency Review' + uses: actions/dependency-review-action@0efb1d1d84fc9633afcdaad14c485cbbc90ef46c # v2.5.1 diff --git a/.github/workflows/sec-codeql.yml b/.github/workflows/sec-codeql.yml index 072982a..ab32b63 100644 --- a/.github/workflows/sec-codeql.yml +++ b/.github/workflows/sec-codeql.yml @@ -10,6 +10,9 @@ on: - cron: '11 0 * * 5' workflow_dispatch: +permissions: + contents: read + jobs: analyze: name: Analyze Code diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..919f2c4 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,14 @@ +repos: +- repo: https://github.com/gitleaks/gitleaks + rev: v8.16.3 + hooks: + - id: gitleaks +- repo: https://github.com/golangci/golangci-lint + rev: v1.52.2 + hooks: + - id: golangci-lint +- repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.4.0 + hooks: + - id: end-of-file-fixer + - id: trailing-whitespace