@@ -5,6 +5,7 @@ Custom CodeQL analysis action with repository-specific configurations and custom
55## Overview
66
77This action provides flexible CodeQL scanning with:
8+
89- ** Automatic language detection** via GitHub API
910- ** Repository-specific configurations** in ` repo-configs/ `
1011- ** Custom query suites** for specialized security analysis
@@ -21,16 +22,16 @@ The action works as part of the security scanning workflow:
2122
2223## Inputs
2324
24- | Input | Required | Description |
25- | -------| ---------- | -------------|
26- | ` repo ` | ✅ | Repository name (format: ` owner/repo ` ) |
27- | ` language ` | ✅ | Language to scan (e.g., ` javascript-typescript ` , ` java-kotlin ` , ` python ` ) |
28- | ` paths_ignored ` | ❌ | Newline-delimited paths to ignore |
29- | ` rules_excluded ` | ❌ | Newline-delimited CodeQL rule IDs to exclude |
30- | ` build_mode ` | ❌ | Build mode: ` none ` , ` autobuild ` , or ` manual ` |
31- | ` build_command ` | ❌ | Build command for ` manual ` build mode |
32- | ` version ` | ❌ | Language/runtime version (e.g., ` 21 ` for Java, ` 3.10 ` for Python) |
33- | ` distribution ` | ❌ | Distribution (e.g., ` temurin ` , ` zulu ` for Java) |
25+ | Input | Required | Description |
26+ | ---------------- | -------- | ------------------------------------------------------------------------- |
27+ | ` repo ` | ✅ | Repository name (format: ` owner/repo ` ) |
28+ | ` language ` | ✅ | Language to scan (e.g., ` javascript-typescript ` , ` java-kotlin ` , ` python ` ) |
29+ | ` paths_ignored ` | ❌ | Newline-delimited paths to ignore |
30+ | ` rules_excluded ` | ❌ | Newline-delimited CodeQL rule IDs to exclude |
31+ | ` build_mode ` | ❌ | Build mode: ` none ` , ` autobuild ` , or ` manual ` |
32+ | ` build_command ` | ❌ | Build command for ` manual ` build mode |
33+ | ` version ` | ❌ | Language/runtime version (e.g., ` 21 ` for Java, ` 3.10 ` for Python) |
34+ | ` distribution ` | ❌ | Distribution (e.g., ` temurin ` , ` zulu ` for Java) |
3435
3536## Usage
3637
@@ -87,23 +88,26 @@ const config = {
8788 build_mode: 'manual',
8889 build_command: './gradlew :coordinator:app:build',
8990 version: '21',
90- distribution: 'temurin'
91+ distribution: 'temurin',
9192 },
9293 {
9394 language: 'javascript-typescript',
9495 // Uses default config (no build needed)
9596 },
9697 {
9798 language: 'cpp',
98- ignore: true // Skip C++ scanning
99- }
99+ ignore: true, // Skip C++ scanning
100+ },
100101 ],
101102
102103 // CodeQL query suites
103104 queries: [
104105 { name: 'Base security queries', uses: './query-suites/base.qls' },
105- { name: 'Custom queries', uses: './custom-queries/query-suites/custom-queries.qls' }
106- ]
106+ {
107+ name: 'Custom queries',
108+ uses: './custom-queries/query-suites/custom-queries.qls',
109+ },
110+ ],
107111};
108112
109113export default config;
@@ -121,45 +125,49 @@ The action includes sensible defaults for common languages:
121125
122126` ` ` javascript
123127const DEFAULT_CONFIGS = {
124- ' javascript' : { language: 'javascript-typescript' },
125- ' typescript' : { language: 'javascript-typescript' },
126- ' python' : { language: 'python' },
127- 'go' : { language: 'go' },
128- ' java' : {
128+ javascript: { language: 'javascript-typescript' },
129+ typescript: { language: 'javascript-typescript' },
130+ python: { language: 'python' },
131+ go : { language: 'go' },
132+ java: {
129133 language: 'java-kotlin',
130134 build_mode: 'manual',
131- build_command: './mvnw compile'
135+ build_command: './mvnw compile',
132136 },
133- ' cpp' : { language: 'cpp' },
134- ' csharp' : { language: 'csharp' },
135- ' ruby' : { language: 'ruby' }
137+ cpp: { language: 'cpp' },
138+ csharp: { language: 'csharp' },
139+ ruby: { language: 'ruby' },
136140};
137141` ` `
138142
139143# # Supported Languages
140144
141- | GitHub Language | CodeQL Language | Build Required |
142- |-----------------| -----------------| ----------------|
143- | JavaScript | `javascript-typescript` | No |
144- | TypeScript | `javascript-typescript` | No |
145- | Python | `python` | No |
146- | Java | `java-kotlin` | Yes (defaults to `./mvnw compile`) |
147- | Kotlin | `java-kotlin` | Yes |
148- | Go | `go` | No |
149- | C/C++ | `cpp` | Yes |
150- | C# | `csharp` | Yes |
151- | Ruby | `ruby` | No |
145+ | GitHub Language | CodeQL Language | Build Required |
146+ | --------------- | -- --------------------- | ---------------------------------- |
147+ | JavaScript | `javascript-typescript` | No |
148+ | TypeScript | `javascript-typescript` | No |
149+ | Python | `python` | No |
150+ | Java | `java-kotlin` | Yes (defaults to `./mvnw compile`) |
151+ | Kotlin | `java-kotlin` | Yes |
152+ | Go | `go` | No |
153+ | C/C++ | `cpp` | Yes |
154+ | C# | `csharp` | Yes |
155+ | Ruby | `ruby` | No |
152156
153157# # Build Modes
154158
155159# ## `none`
160+
156161No build needed (interpreted languages like JavaScript, Python)
157162
158163# ## `autobuild`
164+
159165CodeQL automatically detects and runs build (works for simple projects)
160166
161167# ## `manual`
168+
162169Specify exact build command :
170+
163171` ` ` javascript
164172{
165173 language: 'java-kotlin',
@@ -173,38 +181,45 @@ Specify exact build command:
173181Query suites define which CodeQL queries to run :
174182
175183**Built-in suites:**
184+
176185- ` ./query-suites/base.qls` - Standard security queries
177186- ` ./query-suites/linea-monorepo.qls` - Project-specific queries
178187
179188**Custom queries:**
189+
180190- Checked out from `metamask/CodeQL-Queries` repository
181191- Available at `./custom-queries/query-suites/custom-queries.qls`
182192
183193# # Troubleshooting
184194
185195# ## Config not loading
196+
186197- Filename must match repo : ` owner/repo` → `repo.js`
187198- Must use ESM : ` export default config`
188199- Check logs : ` [config-loader] Loading config for repository: ...`
189200
190201# ## Build failures
202+
191203- Verify `build_command` works locally
192204- Check Java version matches `version` input
193205- Review build step logs in Actions
194206
195207# ## Language not detected
208+
196209- Check GitHub language stats (repo → Insights → Languages)
197210- Add language manually via `languages_config` in repo config
198211- Verify language mapping in `language-detector/src/job-configurator.js`
199212
200213# ## SARIF upload errors
214+
201215- Ensure workflow has `security-events : write` permission
202216- Check SARIF file is generated in `${{ steps.codeql-analysis.outputs.sarif-output }}`
203217- Review CodeQL analysis logs
204218
205219# # Security
206220
207221See [SECURITY.md](../../SECURITY.md) for :
222+
208223- Threat model and security boundaries
209224- Input validation approach
210225- Token permissions model
0 commit comments