Skip to content

Commit

Permalink
Enable codeql for github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathan-innis committed Dec 13, 2023
1 parent 53e8963 commit fa17bdb
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 33 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/approval-comment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ jobs:
if: startsWith(github.event.review.body, '/karpenter snapshot') || startsWith(github.event.review.body, '/karpenter scale') || startsWith(github.event.review.body, '/karpenter versionCompatibility')
runs-on: ubuntu-latest
steps:
- run: |

Check failure on line 10 in .github/workflows/approval-comment.yaml

View workflow job for this annotation

GitHub Actions / ci

"github.event.review.body" is potentially untrusted. avoid using it directly in inline scripts. instead, pass it through an environment variable. see https://docs.github.com/en/actions/security-guides/security-hardening-for-github-actions for more details
echo "${{ github.event.review.body }}"

Check failure

Code scanning / CodeQL

Expression injection in Actions Critical

Potential injection from the ${{ github.event.review.body }}, which may be controlled by an external user.
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
fetch-depth: 0
Expand Down
31 changes: 0 additions & 31 deletions .github/workflows/codeql-analysis.yaml

This file was deleted.

47 changes: 47 additions & 0 deletions .github/workflows/codeql.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: "CodeQL"
on:
push:
branches:
- 'main'
- 'release-v*'
pull_request:
schedule:
- cron: '0 12 * * *'
jobs:
analyze-go:
name: Analyze Go
runs-on: ubuntu-latest
permissions:
actions: read # github/codeql-action/init@v2
security-events: write # github/codeql-action/init@v2
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- uses: ./.github/actions/install-deps
- run: make vulncheck
- uses: github/codeql-action/init@df32e399139a3050671466d7d9b3cbacc1cfd034 # v2.22.8
with:
languages: go
- uses: github/codeql-action/autobuild@df32e399139a3050671466d7d9b3cbacc1cfd034 # v2.22.8
- uses: github/codeql-action/analyze@df32e399139a3050671466d7d9b3cbacc1cfd034 # v2.22.8
# Javascript is added here for evaluating Github Action vulnerabilities
# https://github.blog/2023-08-09-four-tips-to-keep-your-github-actions-workflows-secure/#2-enable-code-scanning-for-workflows
analyze-github-actions:
name: Analyze Github Actions
runs-on: ubuntu-latest
permissions:
actions: read # github/codeql-action/init@v2
security-events: write # github/codeql-action/init@v2
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- uses: github/codeql-action/init@df32e399139a3050671466d7d9b3cbacc1cfd034 # v2.22.8
with:
languages: javascript
config: |
packs:
# Use the latest version of 'codeql-javascript' published by 'advanced-security'
# This will catch things like actions that aren't pinned to a hash
- advanced-security/codeql-javascript
paths:
- '.github/workflows'
- '.github/actions'
- uses: github/codeql-action/analyze@df32e399139a3050671466d7d9b3cbacc1cfd034 # v2.22.8
2 changes: 1 addition & 1 deletion .github/workflows/e2e-soak-trigger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
outputs:
PREEXISTING_CLUSTERS: ${{ steps.list_clusters.outputs.PREEXISTING_CLUSTERS }}
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: configure aws credentials
uses: aws-actions/configure-aws-credentials@010d0da01d0b5a38af31e9c3470dbfdabdecca3a
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/resource-count.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: configure aws credentials
uses: aws-actions/[email protected]
uses: aws-actions/configure-aws-credentials@010d0da01d0b5a38af31e9c3470dbfdabdecca3a # v4.0.1
with:
role-to-assume: arn:aws:iam::${{ vars.ACCOUNT_ID }}:role/${{ vars.ROLE_NAME }}
aws-region: ${{ matrix.region }}
Expand Down

0 comments on commit fa17bdb

Please sign in to comment.