Skip to content

Commit e21e634

Browse files
Copilotdata-douser
andauthored
Upgrade codeql CLI and dependencies to v2.24.0 (#31)
* Initial plan * Upgrade version numbers from 2.23.9 to 2.24.0 and update codeql-pack dependencies Co-authored-by: data-douser <70299490+data-douser@users.noreply.github.com> * Update bundled dist, accept C# test baselines for csharp-all 5.4.5 - Rebuild server/dist/ with v2.24.0 VERSION constant - Accept C# CallGraphFrom/CallGraphTo .expected: new <object initializer> call - Accept C# PrintAST .expected: member index renumbering (6->7, 7->8, etc.) - Accept C# PrintCFG .expected: reordered entry nodes, new <object initializer> - Update SARIF results with v2.24.0 CLI version All tests passing: - 583/583 unit tests - 53/53 integration tests - 34/34 QL query unit tests (all 9 languages including Swift) * Fix codeql-path-test workflow: ensure gh-codeql extension installation succeeds (#34) * Initial plan * Fix codeql-path-test job by ensuring gh codeql extension is properly installed and verified Co-authored-by: data-douser <70299490+data-douser@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: data-douser <70299490+data-douser@users.noreply.github.com> * Fix attempt for codeql-path-tests job * Fix attempt 2 for codeql-path-tests job --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: data-douser <70299490+data-douser@users.noreply.github.com> Co-authored-by: Nathan Randall <data-douser@github.com>
1 parent 3c1d9f1 commit e21e634

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+304
-308
lines changed

.codeql-version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
v2.23.9
1+
v2.24.0

.github/actions/setup-codeql-environment/action.yml

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@ name: 'Setup CodeQL Environment with Languages'
22
description: 'Install and configure CodeQL CLI via GitHub CLI extension and language-specific tools with optimized caching'
33

44
inputs:
5+
add-to-path:
6+
description: 'Whether to install the CodeQL stub to PATH and set CODEQL_HOME/CODEQL_PATH environment variables. Set to false when you need only the gh-codeql extension installed (e.g. for CODEQL_PATH tests that manage PATH themselves).'
7+
required: false
8+
default: 'true'
59
install-language-runtimes:
610
description: 'Whether to install language-specific runtimes and build tools'
711
required: false
@@ -136,7 +140,13 @@ runs:
136140
exit 1
137141
fi
138142
139-
# Create a directory for the CodeQL stub and install it there
143+
echo "✅ GitHub CLI CodeQL extension installed successfully"
144+
145+
# Install the CodeQL stub to PATH (skipped when add-to-path is false)
146+
- name: Install CodeQL stub to PATH
147+
if: inputs.add-to-path == 'true'
148+
shell: bash
149+
run: |
140150
CODEQL_STUB_DIR="$HOME/.local/bin"
141151
mkdir -p "$CODEQL_STUB_DIR"
142152
@@ -147,7 +157,7 @@ runs:
147157
export PATH="$CODEQL_STUB_DIR:$PATH"
148158
echo "PATH=$PATH" >> "$GITHUB_ENV"
149159
150-
echo "✅ GitHub CLI CodeQL extension installed successfully"
160+
echo "✅ CodeQL stub installed to PATH"
151161
152162
# On Windows, gh codeql install-stub creates a bash script which is not
153163
# discoverable by Node.js child_process.spawn() or execFile(), since
@@ -157,7 +167,7 @@ runs:
157167
# This workaround can be removed once github/gh-codeql#21 is merged,
158168
# which adds native Windows support to install-stub.
159169
- name: Add CodeQL binary directory to PATH (Windows)
160-
if: runner.os == 'Windows'
170+
if: runner.os == 'Windows' && inputs.add-to-path == 'true'
161171
shell: bash
162172
run: |
163173
echo "🔧 Locating actual codeql.exe binary for Windows compatibility..."
@@ -193,6 +203,7 @@ runs:
193203
echo "✅ Added CodeQL binary directory to PATH for Windows"
194204
195205
- name: Setup CodeQL environment variables
206+
if: inputs.add-to-path == 'true'
196207
id: setup-codeql-env
197208
shell: bash
198209
run: |
@@ -243,6 +254,7 @@ runs:
243254
244255
# Verify CodeQL installation
245256
- name: Verify `codeql` CLI installation
257+
if: inputs.add-to-path == 'true'
246258
shell: bash
247259
run: |
248260
echo "=== CodeQL Installation Verification ==="

.github/skills/upgrade-codeql-cli-and-packs/SKILL.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ This skill guides you through upgrading the CodeQL CLI version used by the MCP s
2424

2525
This repository uses a **CLI-aligned versioning strategy** across all version-bearing files:
2626

27-
1. **`.codeql-version`**: Contains the target CLI version (e.g., `v2.23.9`)
28-
2. **`package.json` versions**: All `package.json` files (root, client, server) use the CLI version number without the "v" prefix (e.g., `2.23.9`)
29-
3. **`ql-mcp-*` pack versions**: Use the CLI version number without the "v" prefix (e.g., `2.23.9`)
27+
1. **`.codeql-version`**: Contains the target CLI version (e.g., `v2.24.0`)
28+
2. **`package.json` versions**: All `package.json` files (root, client, server) use the CLI version number without the "v" prefix (e.g., `2.24.0`)
29+
3. **`ql-mcp-*` pack versions**: Use the CLI version number without the "v" prefix (e.g., `2.24.0`)
3030
4. **`codeql/*-all` dependencies**: Must have `cliVersion <= target CLI version`
3131

3232
### Why Database Compatibility Matters
@@ -79,7 +79,7 @@ All `package.json` files must have their `version` field set to match the CLI ve
7979
| `client/package.json` | `version` |
8080
| `server/package.json` | `version` |
8181

82-
Example: If `.codeql-version` is `v2.23.9`, set all `package.json` versions to `"version": "2.23.9"`.
82+
Example: If `.codeql-version` is `v2.24.0`, set all `package.json` versions to `"version": "2.24.0"`.
8383

8484
After updating, regenerate the lock file:
8585

.github/workflows/client-integration-tests.yml

Lines changed: 7 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -169,40 +169,11 @@ jobs:
169169
- name: CODEQL_PATH Tests - Build server bundle
170170
run: npm run bundle -w server
171171

172-
- name: CODEQL_PATH Tests - Cache gh-codeql extension (Unix)
173-
if: runner.os != 'Windows'
174-
uses: actions/cache@v4
175-
with:
176-
path: ~/.local/share/gh-codeql
177-
key: codeql-path-tests-${{ runner.os }}-${{ hashFiles('.codeql-version') }}
178-
179-
- name: CODEQL_PATH Tests - Cache gh-codeql extension (Windows)
180-
if: runner.os == 'Windows'
181-
uses: actions/cache@v4
172+
- name: CODEQL_PATH Tests - Setup CodeQL environment
173+
uses: ./.github/actions/setup-codeql-environment
182174
with:
183-
path: ~\AppData\Local\GitHub\gh-codeql
184-
key: codeql-path-tests-${{ runner.os }}-${{ hashFiles('.codeql-version') }}
185-
186-
- name: CODEQL_PATH Tests - Install CodeQL CLI via gh codeql
187-
id: install-codeql
188-
shell: bash
189-
env:
190-
GH_TOKEN: ${{ github.token }}
191-
run: |
192-
CODEQL_VERSION=$(tr -d '[:space:]' < .codeql-version | sed 's/^v//')
193-
echo "Installing CodeQL CLI version: $CODEQL_VERSION"
194-
195-
gh extension install github/gh-codeql 2>/dev/null || true
196-
gh codeql set-version "$CODEQL_VERSION"
197-
198-
INSTALLED=$(gh codeql version --format=terse)
199-
if [[ "$INSTALLED" != "$CODEQL_VERSION" ]]; then
200-
echo "::error::Version mismatch: installed=$INSTALLED expected=$CODEQL_VERSION"
201-
exit 1
202-
fi
203-
204-
echo "✅ CodeQL CLI $INSTALLED installed via gh-codeql"
205-
echo "codeql-version=$CODEQL_VERSION" >> "$GITHUB_OUTPUT"
175+
add-to-path: false
176+
install-language-runtimes: false
206177

207178
## Locate the real CodeQL binary (not the gh-codeql bash stub).
208179
## The stub delegates to `gh codeql` and works from bash, but Node.js
@@ -237,13 +208,14 @@ jobs:
237208
238209
# Verify the binary works and reports the expected version
239210
ACTUAL=$("$CODEQL_BINARY" version --format=terse 2>/dev/null)
240-
EXPECTED="${{ steps.install-codeql.outputs.codeql-version }}"
211+
EXPECTED=$(gh codeql version --format=terse 2>/dev/null)
241212
if [[ "$ACTUAL" != "$EXPECTED" ]]; then
242213
echo "::error::Binary version mismatch: got '$ACTUAL', expected '$EXPECTED'"
243214
exit 1
244215
fi
245216
246217
echo "✅ CodeQL binary verified: $CODEQL_BINARY (version $ACTUAL)"
218+
echo "codeql-version=$ACTUAL" >> "$GITHUB_OUTPUT"
247219
echo "codeql-binary=$CODEQL_BINARY" >> "$GITHUB_OUTPUT"
248220
249221
## Build a PATH that excludes every directory containing 'codeql'.
@@ -303,6 +275,6 @@ jobs:
303275
echo "" >> $GITHUB_STEP_SUMMARY
304276
echo "| Detail | Value |" >> $GITHUB_STEP_SUMMARY
305277
echo "| ------ | ----- |" >> $GITHUB_STEP_SUMMARY
306-
echo "| CodeQL Version | ${{ steps.install-codeql.outputs.codeql-version }} |" >> $GITHUB_STEP_SUMMARY
278+
echo "| CodeQL Version | ${{ steps.locate-codeql.outputs.codeql-version }} |" >> $GITHUB_STEP_SUMMARY
307279
echo "| CodeQL Binary | \`${{ steps.locate-codeql.outputs.codeql-binary }}\` |" >> $GITHUB_STEP_SUMMARY
308280
echo "| OS | ${{ matrix.os }} |" >> $GITHUB_STEP_SUMMARY
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"$schema":"https://json.schemastore.org/sarif-2.1.0.json","version":"2.1.0","runs":[{"tool":{"driver":{"name":"CodeQL","organization":"GitHub","semanticVersion":"2.23.9","rules":[{"id":"test/query","name":"test/query","shortDescription":{"text":"ExampleQuery1"},"fullDescription":{"text":"Example query for integration testing of the codeql_test_extract MCP server tool."},"defaultConfiguration":{"enabled":true,"level":"warning"},"help":{"text":"# Query Help for JavaScript ExampleQuery1\n\nTODO\n","markdown":"# Query Help for JavaScript ExampleQuery1\n\nTODO\n"},"properties":{"tags":["mcp-integration-tests"],"description":"Example query for integration testing of the codeql_test_extract MCP server tool.","id":"test/query","kind":"problem","name":"ExampleQuery1","precision":"medium","problem.severity":"warning"}}]},"extensions":[{"name":"mcp-client-integration-tests-static-javascript-src","semanticVersion":"0.0.1+fe0e7d2a7059ebb6c6075ff8eaea04f382747656","locations":[{"uri":"file:///home/runner/work/codeql-development-mcp-server/codeql-development-mcp-server/client/integration-tests/static/javascript/src/","description":{"text":"The QL pack root directory."},"properties":{"tags":["CodeQL/LocalPackRoot"]}},{"uri":"file:///home/runner/work/codeql-development-mcp-server/codeql-development-mcp-server/client/integration-tests/static/javascript/src/codeql-pack.yml","description":{"text":"The QL pack definition file."},"properties":{"tags":["CodeQL/LocalPackDefinitionFile"]}}]},{"name":"codeql/javascript-all","semanticVersion":"2.6.11+ce9c8e6e9fd41ef0967b13849bb6ae2183caf9ad","locations":[{"uri":"file:///home/runner/.codeql/packages/codeql/javascript-all/2.6.11/","description":{"text":"The QL pack root directory."},"properties":{"tags":["CodeQL/LocalPackRoot"]}},{"uri":"file:///home/runner/.codeql/packages/codeql/javascript-all/2.6.11/qlpack.yml","description":{"text":"The QL pack definition file."},"properties":{"tags":["CodeQL/LocalPackDefinitionFile"]}}]},{"name":"codeql/threat-models","semanticVersion":"1.0.31+ce9c8e6e9fd41ef0967b13849bb6ae2183caf9ad","locations":[{"uri":"file:///home/runner/.codeql/packages/codeql/threat-models/1.0.31/","description":{"text":"The QL pack root directory."},"properties":{"tags":["CodeQL/LocalPackRoot"]}},{"uri":"file:///home/runner/.codeql/packages/codeql/threat-models/1.0.31/qlpack.yml","description":{"text":"The QL pack definition file."},"properties":{"tags":["CodeQL/LocalPackDefinitionFile"]}}]}]},"artifacts":[{"location":{"uri":"file:/home/runner/work/codeql-development-mcp-server/codeql-development-mcp-server/client/integration-tests/static/javascript/test/ExampleQuery1/ExampleQuery1.js","index":0}}],"results":[{"ruleId":"test/query","ruleIndex":0,"rule":{"id":"test/query","index":0},"message":{"text":"Example test code file found for codeql_test_extract example query."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"file:/home/runner/work/codeql-development-mcp-server/codeql-development-mcp-server/client/integration-tests/static/javascript/test/ExampleQuery1/ExampleQuery1.js","index":0}}}]}],"columnKind":"utf16CodeUnits","properties":{"semmle.formatSpecifier":"sarif-latest"}}]}
1+
{"$schema":"https://json.schemastore.org/sarif-2.1.0.json","version":"2.1.0","runs":[{"tool":{"driver":{"name":"CodeQL","organization":"GitHub","semanticVersion":"2.24.0","rules":[{"id":"test/query","name":"test/query","shortDescription":{"text":"ExampleQuery1"},"fullDescription":{"text":"Example query for integration testing of the codeql_test_extract MCP server tool."},"defaultConfiguration":{"enabled":true,"level":"warning"},"help":{"text":"# Query Help for JavaScript ExampleQuery1\n\nTODO\n","markdown":"# Query Help for JavaScript ExampleQuery1\n\nTODO\n"},"properties":{"tags":["mcp-integration-tests"],"description":"Example query for integration testing of the codeql_test_extract MCP server tool.","id":"test/query","kind":"problem","name":"ExampleQuery1","precision":"medium","problem.severity":"warning"}}]},"extensions":[{"name":"mcp-client-integration-tests-static-javascript-src","semanticVersion":"0.0.1+fe0e7d2a7059ebb6c6075ff8eaea04f382747656","locations":[{"uri":"file:///home/runner/work/codeql-development-mcp-server/codeql-development-mcp-server/client/integration-tests/static/javascript/src/","description":{"text":"The QL pack root directory."},"properties":{"tags":["CodeQL/LocalPackRoot"]}},{"uri":"file:///home/runner/work/codeql-development-mcp-server/codeql-development-mcp-server/client/integration-tests/static/javascript/src/codeql-pack.yml","description":{"text":"The QL pack definition file."},"properties":{"tags":["CodeQL/LocalPackDefinitionFile"]}}]},{"name":"codeql/javascript-all","semanticVersion":"2.6.11+ce9c8e6e9fd41ef0967b13849bb6ae2183caf9ad","locations":[{"uri":"file:///home/runner/.codeql/packages/codeql/javascript-all/2.6.11/","description":{"text":"The QL pack root directory."},"properties":{"tags":["CodeQL/LocalPackRoot"]}},{"uri":"file:///home/runner/.codeql/packages/codeql/javascript-all/2.6.11/qlpack.yml","description":{"text":"The QL pack definition file."},"properties":{"tags":["CodeQL/LocalPackDefinitionFile"]}}]},{"name":"codeql/threat-models","semanticVersion":"1.0.31+ce9c8e6e9fd41ef0967b13849bb6ae2183caf9ad","locations":[{"uri":"file:///home/runner/.codeql/packages/codeql/threat-models/1.0.31/","description":{"text":"The QL pack root directory."},"properties":{"tags":["CodeQL/LocalPackRoot"]}},{"uri":"file:///home/runner/.codeql/packages/codeql/threat-models/1.0.31/qlpack.yml","description":{"text":"The QL pack definition file."},"properties":{"tags":["CodeQL/LocalPackDefinitionFile"]}}]}]},"artifacts":[{"location":{"uri":"file:/home/runner/work/codeql-development-mcp-server/codeql-development-mcp-server/client/integration-tests/static/javascript/test/ExampleQuery1/ExampleQuery1.js","index":0}}],"results":[{"ruleId":"test/query","ruleIndex":0,"rule":{"id":"test/query","index":0},"message":{"text":"Example test code file found for codeql_test_extract example query."},"locations":[{"physicalLocation":{"artifactLocation":{"uri":"file:/home/runner/work/codeql-development-mcp-server/codeql-development-mcp-server/client/integration-tests/static/javascript/test/ExampleQuery1/ExampleQuery1.js","index":0}}}]}],"columnKind":"utf16CodeUnits","properties":{"semmle.formatSpecifier":"sarif-latest"}}]}

client/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "codeql-development-mcp-server_client",
3-
"version": "2.23.9",
3+
"version": "2.24.0",
44
"description": "MCP client for integration testing of the CodeQL development MCP server",
55
"main": "src/ql-mcp-client.js",
66
"type": "module",

docs/public.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ codeql pack download advanced-security/ql-mcp-swift-tools-src
6969
To pin a version, append `@<version>`:
7070

7171
```bash
72-
codeql pack download advanced-security/ql-mcp-javascript-tools-src@2.23.9
72+
codeql pack download advanced-security/ql-mcp-javascript-tools-src@2.24.0
7373
```
7474

7575
Each tool query pack provides AST printing, control-flow graph printing, and call-graph queries used by the MCP server to give AI assistants structural insight into CodeQL databases.
@@ -236,10 +236,10 @@ Published to the GitHub Container Registry under the `advanced-security` scope.
236236
```yaml
237237
# Example: server/ql/javascript/tools/src/codeql-pack.yml
238238
name: advanced-security/ql-mcp-javascript-tools-src
239-
version: 2.23.9
239+
version: 2.24.0
240240
library: false
241241
dependencies:
242-
codeql/javascript-all: 2.6.19
242+
codeql/javascript-all: 2.6.20
243243
```
244244
245245
## Troubleshooting

package-lock.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "codeql-development-mcp-server_repo",
3-
"version": "2.23.9",
3+
"version": "2.24.0",
44
"description": "An MCP server supporting LLM requests for CodeQL development tools and resources.",
55
"private": true,
66
"type": "module",

server/dist/codeql-development-mcp-server.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)