-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[StepSecurity] Apply security best practices (#35)
Signed-off-by: StepSecurity Bot <[email protected]>
- Loading branch information
1 parent
c6f5acc
commit accae59
Showing
5 changed files
with
41 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,6 +20,9 @@ env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
GITHUB_SHA: ${{ github.sha }} | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
build-app: | ||
runs-on: ubuntu-latest | ||
|
@@ -28,24 +31,29 @@ jobs: | |
packages: write | ||
|
||
steps: | ||
- name: Harden Runner | ||
uses: step-security/harden-runner@63c24ba6bd7ba022e95695ff85de572c04a18142 # v2.7.0 | ||
with: | ||
egress-policy: audit | ||
|
||
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | ||
|
||
- name: Log in to the Container registry | ||
uses: docker/[email protected] | ||
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0 | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
# Will create and boot a builder that can be used in the build-push action. | ||
- name: Set up QEMU | ||
uses: docker/[email protected] | ||
uses: docker/setup-qemu-action@68827325e0b33c7199eb31dd4e31fbe9023e06e3 # v3.0.0 | ||
- name: Set up Docker Buildx | ||
uses: docker/[email protected] | ||
uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 # v3.0.0 | ||
|
||
- name: Extract metadata (tags, labels) for Docker | ||
id: meta | ||
uses: docker/[email protected] | ||
uses: docker/metadata-action@8e5442c4ef9f78752691e2d8f8d19755c6f78e81 # v5.5.1 | ||
with: | ||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | ||
tags: | | ||
|
@@ -56,7 +64,7 @@ jobs: | |
# Run the build and outputs a test coverage file | ||
- name: Build and push Docker image | ||
uses: docker/[email protected] | ||
uses: docker/build-push-action@4a13e500e55cf31b7a5d59a38ab2040ab0f42f56 # v5.1.0 | ||
with: | ||
file: Dockerfile | ||
push: false | ||
|
@@ -66,7 +74,7 @@ jobs: | |
outputs: | | ||
type=local,dest=. | ||
- uses: codecov/[email protected] | ||
- uses: codecov/codecov-action@e0b68c6749509c5f83f984dd99a76a1c1a231044 # v4.0.1 | ||
with: | ||
token: ${{ secrets.CODECOV_TOKEN }} | ||
files: ./coverage.out | ||
|
@@ -77,7 +85,7 @@ jobs: | |
# since the context is based on the Git reference. Use the Path context to remove this restriction. | ||
# https://github.com/marketplace/actions/build-and-push-docker-images#git-context | ||
- name: Build and push Docker image | ||
uses: docker/[email protected] | ||
uses: docker/build-push-action@4a13e500e55cf31b7a5d59a38ab2040ab0f42f56 # v5.1.0 | ||
with: | ||
file: Dockerfile | ||
push: true | ||
|
@@ -88,13 +96,18 @@ jobs: | |
runs-on: ubuntu-latest | ||
needs: ['build-app'] | ||
steps: | ||
- name: Harden Runner | ||
uses: step-security/harden-runner@63c24ba6bd7ba022e95695ff85de572c04a18142 # v2.7.0 | ||
with: | ||
egress-policy: audit | ||
|
||
- name: Checkout repository | ||
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | ||
|
||
# Security scanner | ||
# https://github.com/aquasecurity/trivy-action | ||
- name: Run container image vulnerability scanner | ||
uses: aquasecurity/trivy-action@master | ||
uses: aquasecurity/trivy-action@1f6384b6ceecbbc6673526f865b818a2a06b07c9 # master | ||
with: | ||
# image-ref: ${{ fromJSON(steps.meta.outputs.json).tags[0] }} | ||
image-ref: '${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:sha-${{ github.sha }}' | ||
|
@@ -115,6 +128,11 @@ jobs: | |
contents: write | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Harden Runner | ||
uses: step-security/harden-runner@63c24ba6bd7ba022e95695ff85de572c04a18142 # v2.7.0 | ||
with: | ||
egress-policy: audit | ||
|
||
- name: Checkout | ||
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | ||
with: | ||
|
@@ -126,15 +144,15 @@ jobs: | |
git config user.email "[email protected]" | ||
- name: Install Helm | ||
uses: azure/setup-helm@v3 | ||
uses: azure/setup-helm@5119fcb9089d432beecbf79bb2c7915207344b78 # v3.5 | ||
|
||
- uses: actions/setup-python@v4 | ||
- uses: actions/setup-python@65d7f2d534ac1bc67fcd62888c5f4f3d2cb2b236 # v4.7.1 | ||
with: | ||
python-version: '3.9' | ||
check-latest: true | ||
|
||
- name: Set up chart-testing | ||
uses: helm/[email protected] | ||
uses: helm/chart-testing-action@afea100a513515fbd68b0e72a7bb0ae34cb62aec # v2.3.1 | ||
|
||
- name: Run chart-testing (list-changed) | ||
id: list-changed | ||
|
@@ -148,7 +166,7 @@ jobs: | |
run: ct lint --config ct.yaml --target-branch ${{ github.event.repository.default_branch }} | ||
|
||
- name: Create kind cluster | ||
uses: helm/[email protected] | ||
uses: helm/kind-action@9e8295d178de23cbfbd8fa16cf844eec1d773a07 # v1.4.0 | ||
if: steps.list-changed.outputs.changed == 'true' | ||
|
||
- name: Run chart-testing (install) | ||
|
@@ -160,7 +178,7 @@ jobs: | |
cat charts/kapparmor/values.yaml | ||
- name: Run chart-releaser | ||
uses: helm/[email protected] | ||
uses: helm/chart-releaser-action@be16258da8010256c6e82849661221415f031968 # v1.5.0 | ||
env: | ||
CR_TOKEN: "${{ env.GITHUB_TOKEN }}" | ||
with: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,12 +16,12 @@ jobs: | |
name: lint | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/[email protected] | ||
- uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0 | ||
with: | ||
go-version: 1.22 | ||
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | ||
- name: golangci-lint | ||
uses: golangci/[email protected] | ||
uses: golangci/golangci-lint-action@3cfe3a4abbb849e10058ce4af15d205b6da42804 # v4.0.0 | ||
with: | ||
# Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version | ||
version: latest | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters