From 4c681207b7c9e004d0766e3a7732469769723504 Mon Sep 17 00:00:00 2001 From: Piotr Halama Date: Mon, 12 Oct 2026 11:15:08 +0200 Subject: [PATCH 1/2] Add CodeQL workflow and build-for-codeql Makefile target --- .github/workflows/codeql.yml | 70 ++++++++++++++++++++++++++++++++++++ Makefile | 4 +++ 2 files changed, 74 insertions(+) create mode 100644 .github/workflows/codeql.yml diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml new file mode 100644 index 000000000..1a9bcbdfa --- /dev/null +++ b/.github/workflows/codeql.yml @@ -0,0 +1,70 @@ +name: CodeQL + +on: + push: + branches: + - "main" + - "release-*" + paths-ignore: + - "docs/**" + - "**/*.md" + - "OWNERS" + - "CODEOWNERS" + - "external-images.yaml" + - "sec-scanners-config.yaml" + - "renovate.json" + pull_request: + branches: + - "main" + - "release-*" + paths-ignore: + - "docs/**" + - "**/*.md" + - "OWNERS" + - "CODEOWNERS" + - "external-images.yaml" + - "sec-scanners-config.yaml" + - "renovate.json" + schedule: + - cron: '35 7 * * 1' + +jobs: + analyze: + name: Analyze (${{ matrix.language }}) + runs-on: ubuntu-latest + permissions: + security-events: write + packages: read + actions: read + contents: read + + strategy: + fail-fast: false + matrix: + include: + - language: actions + build-mode: none + - language: go + build-mode: manual + - language: javascript-typescript + build-mode: none + + steps: + - name: Checkout repository + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + + - name: Initialize CodeQL + uses: github/codeql-action/init@24c54180a607b1449ed407dd24f251e4e9147c8d # v4.38.3 + with: + languages: ${{ matrix.language }} + build-mode: ${{ matrix.build-mode }} + + - name: Run manual build steps + if: matrix.build-mode == 'manual' + shell: bash + run: make build-for-codeql + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@24c54180a607b1449ed407dd24f251e4e9147c8d # v4.38.3 + with: + category: "/language:${{matrix.language}}" diff --git a/Makefile b/Makefile index 128f04979..d201dfa59 100644 --- a/Makefile +++ b/Makefile @@ -31,6 +31,10 @@ verify: ## Run all verification checks. build: ## Build the kyma CLI binary. GOFIPS140=v1.0.0 go build -ldflags="-X github.com/kyma-project/cli.v3/internal/cmd/version.version=local-$(shell git rev-parse --short HEAD)" -o bin/kyma main.go +.PHONY: build-for-codeql +build-for-codeql: ## Build all binaries for CodeQL analysis. + go build -o /dev/null ./... + .PHONY: docs docs: ## Generate CLI documentation. go mod tidy From 3ef05ec381f46dc907232eb56049f0f864fd3c19 Mon Sep 17 00:00:00 2001 From: Piotr Halama Date: Mon, 12 Oct 2026 11:32:36 +0200 Subject: [PATCH 2/2] Update CodeQL workflow: stagger cron, remove sec-scanners ignore, add codeql config --- .github/codeql/codeql-config.yaml | 9 +++++++++ .github/workflows/codeql.yml | 3 +-- 2 files changed, 10 insertions(+), 2 deletions(-) create mode 100644 .github/codeql/codeql-config.yaml diff --git a/.github/codeql/codeql-config.yaml b/.github/codeql/codeql-config.yaml new file mode 100644 index 000000000..90bf25727 --- /dev/null +++ b/.github/codeql/codeql-config.yaml @@ -0,0 +1,9 @@ +name: "CodeQL configuration" + +paths-ignore: + - "**/zz_generated*.go" + - "**/fake/**" + - "testdata/" + +queries: + - uses: security-extended diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 1a9bcbdfa..69cdbe906 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -11,7 +11,6 @@ on: - "OWNERS" - "CODEOWNERS" - "external-images.yaml" - - "sec-scanners-config.yaml" - "renovate.json" pull_request: branches: @@ -23,7 +22,6 @@ on: - "OWNERS" - "CODEOWNERS" - "external-images.yaml" - - "sec-scanners-config.yaml" - "renovate.json" schedule: - cron: '35 7 * * 1' @@ -58,6 +56,7 @@ jobs: with: languages: ${{ matrix.language }} build-mode: ${{ matrix.build-mode }} + config-file: .github/codeql/codeql-config.yaml - name: Run manual build steps if: matrix.build-mode == 'manual'