Skip to content

Commit

Permalink
[StepSecurity] Apply security best practices (#6853)
Browse files Browse the repository at this point in the history
Signed-off-by: StepSecurity Bot <[email protected]>
  • Loading branch information
step-security-bot authored Jul 4, 2024
1 parent ec03879 commit 8d2b2a8
Show file tree
Hide file tree
Showing 6 changed files with 73 additions and 73 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,20 +30,20 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v4
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7

- id: go_version
name: Read go version
run: echo "go_version=$(cat .go-version)" >> $GITHUB_OUTPUT

- name: Install Go (${{ steps.go_version.outputs.go_version }})
uses: actions/setup-go@v5
uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1
with:
go-version: ${{ steps.go_version.outputs.go_version }}

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
uses: github/codeql-action/init@b611370bb5703a7efb587f9d136a52ea24c5c38c # v3.25.11
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
Expand All @@ -59,4 +59,4 @@ jobs:
make build
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
uses: github/codeql-action/analyze@b611370bb5703a7efb587f9d136a52ea24c5c38c # v3.25.11
36 changes: 18 additions & 18 deletions .github/workflows/nightly.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ jobs:
runs-on: ubuntu-22.04
steps:
- name: Check out code
uses: actions/checkout@v4
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7

- name: Test with Race Detector
run: CGO_ENABLED=1 make ci-go-race-detector

- name: Slack Notification
uses: 8398a7/action-slack@v3
uses: 8398a7/action-slack@28ba43ae48961b90635b50953d216767a6bea486 # v3.16.2
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_NOTIFICATION_WEBHOOK }}
if: ${{ failure() && env.SLACK_WEBHOOK_URL }}
Expand All @@ -30,14 +30,14 @@ jobs:
runs-on: ubuntu-22.04
steps:
- name: Check out code
uses: actions/checkout@v4
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7

- id: go_version
name: Read go version
run: echo "go_version=$(cat .go-version)" >> $GITHUB_OUTPUT

- name: Install Go (${{ steps.go_version.outputs.go_version }})
uses: actions/setup-go@v5
uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1
with:
go-version: ${{ steps.go_version.outputs.go_version }}

Expand All @@ -49,7 +49,7 @@ jobs:
run: find ast/testdata/fuzz ! -name '*.stmt' ! -type d -print -exec cat {} \;

- name: Slack Notification
uses: 8398a7/action-slack@v3
uses: 8398a7/action-slack@28ba43ae48961b90635b50953d216767a6bea486 # v3.16.2
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_NOTIFICATION_WEBHOOK }}
if: ${{ failure() && env.SLACK_WEBHOOK_URL }}
Expand All @@ -62,7 +62,7 @@ jobs:
runs-on: ubuntu-22.04
steps:
- name: Check out code
uses: actions/checkout@v4
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7

- name: Benchmark Test Golang
run: make ci-go-perf
Expand All @@ -71,7 +71,7 @@ jobs:
DOCKER_RUNNING: 0

- name: Slack Notification
uses: 8398a7/action-slack@v3
uses: 8398a7/action-slack@28ba43ae48961b90635b50953d216767a6bea486 # v3.16.2
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_NOTIFICATION_WEBHOOK }}
if: ${{ failure() && env.SLACK_WEBHOOK_URL }}
Expand All @@ -84,14 +84,14 @@ jobs:
runs-on: ubuntu-22.04
steps:
- name: Check out code
uses: actions/checkout@v4
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7

- name: Vendor without proxy
run: make check-go-module
timeout-minutes: 30

- name: Slack Notification
uses: 8398a7/action-slack@v3
uses: 8398a7/action-slack@28ba43ae48961b90635b50953d216767a6bea486 # v3.16.2
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_NOTIFICATION_WEBHOOK }}
if: ${{ failure() && env.SLACK_WEBHOOK_URL }}
Expand All @@ -104,14 +104,14 @@ jobs:
runs-on: ubuntu-22.04
steps:
- name: Checkout code # needed for .trivyignore file
uses: actions/checkout@v4
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7

- run: "docker pull openpolicyagent/opa:edge-static"

# Equivalent to:
# $ trivy image openpolicyagent/opa:edge-static
- name: Run Trivy scan on image
uses: aquasecurity/[email protected]
uses: aquasecurity/trivy-action@7c2007bcb556501da015201bcba5aa14069b74e2 # 0.23.0
with:
image-ref: 'openpolicyagent/opa:edge-static'
format: table
Expand All @@ -121,7 +121,7 @@ jobs:
severity: CRITICAL,HIGH

- name: Slack Notification
uses: 8398a7/action-slack@v3
uses: 8398a7/action-slack@28ba43ae48961b90635b50953d216767a6bea486 # v3.16.2
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_NOTIFICATION_WEBHOOK }}
if: ${{ failure() && env.SLACK_WEBHOOK_URL }}
Expand All @@ -134,12 +134,12 @@ jobs:
runs-on: ubuntu-22.04
steps:
- name: Checkout code
uses: actions/checkout@v4
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7

# Equivalent to:
# $ trivy fs .
- name: Run Trivy scan on repo
uses: aquasecurity/[email protected]
uses: aquasecurity/trivy-action@7c2007bcb556501da015201bcba5aa14069b74e2 # 0.23.0
with:
scan-type: fs
format: table
Expand All @@ -149,7 +149,7 @@ jobs:
severity: CRITICAL,HIGH

- name: Slack Notification
uses: 8398a7/action-slack@v3
uses: 8398a7/action-slack@28ba43ae48961b90635b50953d216767a6bea486 # v3.16.2
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_NOTIFICATION_WEBHOOK }}
if: ${{ failure() && env.SLACK_WEBHOOK_URL }}
Expand All @@ -161,21 +161,21 @@ jobs:
name: Go vulnerability check
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- id: go_version
name: Read go version
run: echo "go_version=$(cat .go-version)" >> $GITHUB_OUTPUT

- name: Install Go (${{ steps.go_version.outputs.go_version }})
uses: actions/setup-go@v5
uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1
with:
go-version: ${{ steps.go_version.outputs.go_version }}

- run: go install golang.org/x/vuln/cmd/govulncheck@latest
- run: govulncheck ./...

- name: Slack Notification
uses: 8398a7/action-slack@v3
uses: 8398a7/action-slack@28ba43ae48961b90635b50953d216767a6bea486 # v3.16.2
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_NOTIFICATION_WEBHOOK }}
if: ${{ failure() && env.SLACK_WEBHOOK_URL }}
Expand Down
22 changes: 11 additions & 11 deletions .github/workflows/post-merge.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
runs-on: ubuntu-22.04
steps:
- name: Check out code
uses: actions/checkout@v4
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
token: ${{ secrets.GH_PUSH_TOKEN }} # required to push to protected branch below

Expand Down Expand Up @@ -72,7 +72,7 @@ jobs:
needs: generate
steps:
- name: Check out code
uses: actions/checkout@v4
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7

- name: Unit Test Golang
run: make ci-go-test-coverage
Expand All @@ -84,7 +84,7 @@ jobs:
needs: generate
steps:
- name: Check out code
uses: actions/checkout@v4
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7

- name: Build Linux and Windows
run: make ci-go-ci-build-linux ci-go-ci-build-linux-static ci-go-ci-build-windows
Expand All @@ -100,7 +100,7 @@ jobs:
TELEMETRY_URL: ${{ secrets.TELEMETRY_URL }}

- name: Upload binaries
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3
if: always()
with:
name: binaries-linux-windows
Expand All @@ -112,14 +112,14 @@ jobs:
needs: generate
steps:
- name: Check out code
uses: actions/checkout@v4
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7

- id: go_version
name: Read go version
run: echo "go_version=$(cat .go-version)" >> $GITHUB_OUTPUT

- name: Install Go (${{ steps.go_version.outputs.go_version }})
uses: actions/setup-go@v5
uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1
with:
go-version: ${{ steps.go_version.outputs.go_version }}

Expand All @@ -132,7 +132,7 @@ jobs:
TELEMETRY_URL: ${{ secrets.TELEMETRY_URL }}

- name: Upload binaries (darwin)
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3
if: always()
with:
name: binaries-darwin
Expand All @@ -144,21 +144,21 @@ jobs:
needs: [release-build, release-build-darwin]
steps:
- name: Check out code
uses: actions/checkout@v4
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7

- name: Test
run: make ci-release-test
timeout-minutes: 60

- name: Download release binaries
uses: actions/download-artifact@v4
uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7
with:
pattern: binaries-*
merge-multiple: true
path: _release

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
uses: docker/setup-buildx-action@4fd812986e6c8c2a69e18311145f9371337f27d4 # v3.4.0

- name: Deploy OPA Edge
env:
Expand All @@ -178,7 +178,7 @@ jobs:
needs: generate
steps:
- name: Check out code
uses: actions/checkout@v4
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7

- name: Build and Push opa-wasm-builder
env:
Expand Down
18 changes: 9 additions & 9 deletions .github/workflows/post-tag.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
runs-on: ubuntu-22.04
steps:
- name: Check out code
uses: actions/checkout@v4
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
token: ${{ secrets.GH_PUSH_TOKEN }}

Expand All @@ -24,7 +24,7 @@ jobs:
needs: generate
steps:
- name: Check out code
uses: actions/checkout@v4
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7

- name: Build Linux and Windows
run: make ci-go-ci-build-linux ci-go-ci-build-linux-static ci-go-ci-build-windows
Expand All @@ -40,7 +40,7 @@ jobs:
TELEMETRY_URL: ${{ secrets.TELEMETRY_URL }}

- name: Upload binaries
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3
if: always()
with:
name: binaries-linux-windows
Expand All @@ -52,14 +52,14 @@ jobs:
needs: generate
steps:
- name: Check out code
uses: actions/checkout@v4
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7

- id: go_version
name: Read go version
run: echo "go_version=$(cat .go-version)" >> $GITHUB_OUTPUT

- name: Install Go (${{ steps.go_version.outputs.go_version }})
uses: actions/setup-go@v5
uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1
with:
go-version: ${{ steps.go_version.outputs.go_version }}

Expand All @@ -72,7 +72,7 @@ jobs:
TELEMETRY_URL: ${{ secrets.TELEMETRY_URL }}

- name: Upload binaries (darwin)
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3
if: always()
with:
name: binaries-darwin
Expand All @@ -84,21 +84,21 @@ jobs:
runs-on: ubuntu-22.04
steps:
- name: Check out code
uses: actions/checkout@v4
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7

- name: Set TAG_NAME in Environment
# Subsequent jobs will be have the computed tag name
run: echo "TAG_NAME=${GITHUB_REF##*/}" >> $GITHUB_ENV

- name: Download release binaries
uses: actions/download-artifact@v4
uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7
with:
pattern: binaries-*
merge-multiple: true
path: _release

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
uses: docker/setup-buildx-action@4fd812986e6c8c2a69e18311145f9371337f27d4 # v3.4.0

- name: Build and Deploy OPA Docker Images
id: build-and-deploy
Expand Down
Loading

0 comments on commit 8d2b2a8

Please sign in to comment.