Skip to content

Commit de183ce

Browse files
zizmor security actions
1 parent ae33040 commit de183ce

File tree

4 files changed

+32
-16
lines changed

4 files changed

+32
-16
lines changed

.github/workflows/dependabot-automerge.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131
steps:
3232
- name: Generate token
3333
id: generate-token
34-
uses: tibdex/github-app-token@v1
34+
uses: tibdex/github-app-token@32691ba7c9e7063bd457bd8f2a5703138591fa58 # v1
3535
continue-on-error: true
3636
with:
3737
app_id: ${{ secrets.DEPENDABOTREVIEWER_ID }}
@@ -40,9 +40,10 @@ jobs:
4040
id: dependabot-metadata
4141
uses: dependabot/fetch-metadata@v1.5.1
4242
- name: Enable auto-merge for Dependabot PRs
43-
run: gh pr merge --auto --${{ inputs.repository-merge-method }} "$PR_URL"
43+
run: gh pr merge --auto --${MERGE_METHOD} "$PR_URL"
4444
env:
4545
GITHUB_TOKEN: ${{ steps.generate-token.outputs.token || secrets.envPAT || secrets.GITHUB_TOKEN}}
46+
MERGE_METHOD: ${{ inputs.repository-merge-method }}
4647
- name: Approve patch updates
4748
if: ${{ steps.dependabot-metadata.outputs.update-type == 'version-update:semver-patch' }}
4849
run: gh pr review $PR_URL --approve -b "**Approving** patch update"

.github/workflows/self-zizmor.yaml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: zizmor GitHub Actions static analysis
2+
on:
3+
push:
4+
pull_request:
5+
6+
jobs:
7+
zizmor:
8+
name: Run zizmor from current branch (self test)
9+
10+
permissions:
11+
actions: read
12+
contents: read
13+
14+
pull-requests: write
15+
security-events: write
16+
17+
uses: grafana/shared-workflows/.github/workflows/reusable-zizmor.yml@5946b80e86f32bb4d208c2483c58345bbeef03d2
18+
with:
19+
codeql-enabled: false

.github/workflows/snyk_monitor.yml

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,23 +7,17 @@ on:
77
required: true
88
jobs:
99
snyk_scans:
10-
1110
runs-on: ubuntu-latest
1211

1312
steps:
14-
- uses: actions/checkout@v3
13+
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3
14+
with:
15+
persist-credentials: false
1516
- name: Run Snyk to import ${{ github.event.repository.name }} to Snyk
1617
continue-on-error: true
17-
uses: snyk/actions/golang@master
18+
uses: snyk/actions/golang@4a528b5c534bb771b6e3772656a8e0e9dc902f8b # master
1819
env:
1920
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
2021
with:
2122
command: monitor
22-
args: --strict-out-of-sync=false --all-projects --exclude=devenv --tags=repo=${{ github.event.repository.name }}
23-
24-
25-
26-
27-
28-
29-
23+
args: --strict-out-of-sync=false --all-projects --exclude=devenv --tags=repo=${{ github.event.repository.name }}

trivy/action.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,14 +69,16 @@ runs:
6969
- name: "Comment the Trivy diff"
7070
env:
7171
GITHUB_TOKEN: ${{ inputs.github-token }}
72-
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
72+
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
73+
PR_NUMBER: ${{ github.event.pull_request.number }}
74+
BASE_REF: ${{ github.base_ref }}
7375
run: |
7476
output=$(cat output.txt)
7577
if [ "$output" == "No new vulnerabilities found." ]; then
7678
echo "No new vulnerabilities found."
7779
exit 0
7880
else
79-
comment=$(echo -e "### New vulnerabilities introduced in branch $BRANCH_NAME compared to ${{ github.base_ref }}\n\n" ; jq -r '.[] | "* \(.VulnerabilityID), Severity: \(.Severity), Package: \(.PkgName), Installed: \(.InstalledVersion), Fixed: \(.FixedVersion // "N/A")"' output.txt)
80-
gh pr comment ${{ github.event.pull_request.number }} --body "$comment"
81+
comment=$(echo -e "### New vulnerabilities introduced in branch $BRANCH_NAME compared to $BASE_REF\n\n" ; jq -r '.[] | "* \(.VulnerabilityID), Severity: \(.Severity), Package: \(.PkgName), Installed: \(.InstalledVersion), Fixed: \(.FixedVersion // "N/A")"' output.txt)
82+
gh pr comment $PR_NUMBER --body "$comment"
8183
fi
8284
shell: bash

0 commit comments

Comments
 (0)