Skip to content

Commit be06080

Browse files
committed
Add advanced CodeQL Workflow
Signed-off-by: egibs <20933572+egibs@users.noreply.github.com>
1 parent 39bbdab commit be06080

1 file changed

Lines changed: 92 additions & 0 deletions

File tree

.github/workflows/codeql.yaml

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
# Copyright 2025 Chainguard, Inc.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
name: "CodeQL Advanced"
5+
6+
on:
7+
pull_request:
8+
push:
9+
branches: ["main"]
10+
schedule:
11+
- cron: "35 23 * * 0"
12+
13+
env:
14+
CODEQL_EXTRACTOR_GO_BUILD_TRACING: "on"
15+
16+
permissions: {}
17+
18+
jobs:
19+
analyze:
20+
if: ${{ github.repository }} == 'chainguard-dev/malcontent'
21+
runs-on: mal-ubuntu-latest-8-core
22+
permissions:
23+
actions: read
24+
contents: read
25+
packages: read
26+
security-events: write
27+
steps:
28+
- uses: step-security/harden-runner@0634a2670c59f64b4a01f0f96f84700a4088b9f0 # v2.12.0
29+
with:
30+
egress-policy: audit
31+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
32+
- name: Checkout virusTotal/yara-x
33+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
34+
with:
35+
fetch-depth: 0
36+
fetch-tags: true
37+
repository: virusTotal/yara-x
38+
path: yara-x
39+
ref: refs/tags/v0.14.0
40+
- name: Install Rust for yara-x-capi
41+
uses: dtolnay/rust-toolchain@888c2e1ea69ab0d4330cbf0af1ecc7b68f368cc1
42+
with:
43+
toolchain: stable
44+
- name: Install cargo-c and yara-x-capi
45+
run: |
46+
cd ${{ github.workspace }}/yara-x
47+
cargo install cargo-c --locked
48+
sudo -E env "PATH=$PATH" cargo cinstall -p yara-x-capi --features=native-code-serialization --release
49+
sudo ldconfig -v
50+
cd ${{ github.workspace }}
51+
sudo rm -rf ${{ github.workspace }}/yara-x
52+
- name: Set up Go
53+
uses: actions/setup-go@0aaccfd150d50ccaeb58ebd88d36e91967a5f35b # v5.4.0
54+
with:
55+
go-version-file: "go.mod"
56+
check-latest: true
57+
cache: false
58+
- name: Initialize CodeQL
59+
uses: github/codeql-action/init@28deaeda66b76a05916b6923827895f2b14ab387 # v3.28.16
60+
with:
61+
languages: go
62+
build-mode: manual
63+
- run: |
64+
go build -o /dev/null ./...
65+
go test -o /dev/null -c ./...
66+
- name: Perform CodeQL Analysis
67+
uses: github/codeql-action/analyze@28deaeda66b76a05916b6923827895f2b14ab387 # v3.28.16
68+
with:
69+
category: "/language:go"
70+
analyze-actions:
71+
if: ${{ github.repository }} == 'chainguard-dev/malcontent'
72+
runs-on: ubuntu-latest
73+
permissions:
74+
actions: read
75+
contents: read
76+
packages: read
77+
security-events: write
78+
steps:
79+
- uses: step-security/harden-runner@0634a2670c59f64b4a01f0f96f84700a4088b9f0 # v2.12.0
80+
with:
81+
egress-policy: audit
82+
- name: Checkout repository
83+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
84+
- name: Initialize CodeQL
85+
uses: github/codeql-action/init@28deaeda66b76a05916b6923827895f2b14ab387 # v3.28.16
86+
with:
87+
languages: actions
88+
build-mode: none
89+
- name: Perform CodeQL Analysis
90+
uses: github/codeql-action/analyze@28deaeda66b76a05916b6923827895f2b14ab387 # v3.28.16
91+
with:
92+
category: "/language:actions"

0 commit comments

Comments
 (0)