This directory contains example workshops demonstrating the standard workshop structure.
Language: C++
Topic: Null Pointer Dereferences
Complexity: Beginner
Stages: 3
A minimal workshop teaching basic CodeQL concepts:
- Pattern matching (finding expressions)
- Value constraints (identifying null literals)
- Local data flow analysis
Perfect for understanding the standard workshop structure.
Study these examples to understand:
- Directory structure and file organization
- Query progression from simple to complex
- Test file formats and expected results
- Documentation patterns
Copy and adapt these examples:
cp -r example-cpp-simple /path/to/new-workshop
cd /path/to/new-workshop
# Modify queries, tests, and documentationUse these to test the MCP server tools:
# Test solutions
codeql test run example-cpp-simple/solutions-tests/
# Compile exercises
codeql query compile example-cpp-simple/exercises/Exercise1.qlStructure:
- 3 exercises (Exercise1, Exercise2, Exercise3)
- Shared test code in tests-common/
- Minimal dependencies (only codeql/cpp-all)
- No graphs/ content (not needed for simple queries)
Decomposition Pattern: Building Blocks
- Stage 1: Find component A (dereferences)
- Stage 2: Find component B (null literals)
- Stage 3: Connect A and B (data flow)
Key Files:
exercises/Exercise1.ql- Incomplete query with TODOssolutions/Exercise1.ql- Complete implementationexercises-tests/Exercise1/Exercise1.expected- Expected resultstests-common/test.cpp- Shared test code
When creating example workshops for this skill:
- Keep them simple: Examples should be educational, not comprehensive
- One language each: Don't try to demonstrate all languages in one example
- Different patterns: Each example should demonstrate different decomposition patterns
- Complete and tested: All solutions should pass tests
- Well-documented: README should explain the learning progression
Additional examples that could be added:
- example-java-simple: SQL injection with taint tracking
- example-javascript-simple: XSS with client-side sources
- example-python-simple: Command injection
- example-go-simple: Race conditions
- example-csharp-simple: Resource leaks
Each would demonstrate different:
- Language-specific patterns
- Decomposition strategies
- Complexity levels
- CodeQL features
When contributing new example workshops:
- Follow the standard structure
- Test thoroughly (100% passing solutions)
- Document the learning progression
- Keep it focused and simple
- Add entry to this README