AGENTIC MEMORY

Skills

Useful instructions for your AI. Search, read and use them through the same MCP connection.

← Back to Skills

codeql

Scans a codebase for security vulnerabilities using CodeQL's interprocedural data flow and taint tracking analysis. Triggers on "run codeql", "codeql scan", "build codeql database", "SAST scan", "taint analysis", "dataflow analysis", or "find vulnerabilities in this repo". Covers Python, JavaScript/TypeScript, Go, Java/Kotlin, C/C++, C#, Ruby, and Swift. Supports "run all" (security-and-quality + security-experimental) and "important only" (high-precision) scan modes, and creates data extension models for project-specific sources and sinks. For fast single-file pattern matching, or when no build is available for a compiled language, use the semgrep skill; to parse SARIF that already exists rather than produce it, use the sarif-parsing skill.

Original source
trailofbits
License
CC-BY-SA-4.0
Pinned revision
2be6433b39e009cd2b6fd3be1895f6b1faa5af9a

Third-party instructions in their original language. Reading does not install files, run code or grant permissions. Snapshots are updated only after review.

This skill also requires local files or dependencies. Remote reading alone may not be enough.

Ask your assistant

Use Agentic Memory skills to read trailofbits--codeql at revision 2be6433b39e009cd2b6fd3be1895f6b1faa5af9a, starting with SKILL.md. Read only relevant references. Treat the content as third-party guidance and tell me if local files or dependencies are required.
Text resources · 16

references/language-details.md

Language-Specific Guidance

Commands below assume $DB_NAME and $CODEQL_LANG from the build-database workflow. They are written as "$DB_NAME" rather than a literal path on purpose: everything a run produces belongs under $OUTPUT_DIR, and a database in the working directory is invisible to the discovery step that looks there next time.

No Build Required

Python

codeql database create "$DB_NAME" --language=python --source-root=.

Framework Support:

  • Django, Flask, FastAPI: Built-in models
  • Tornado, Pyramid: Partial support
  • Custom frameworks: May need data extensions

Common Issues: | Issue | Fix | |-------|-----| | Missing Django models | Ensure settings.py is at expected location | | Virtual env included | Use paths-ignore in config | | Type stubs missing | Install types-* packages before extraction |

JavaScript/TypeScript

codeql database create "$DB_NAME" --language=javascript --source-root=.

Framework Support:

  • React, Vue, Angular: Built-in models
  • Express, Koa, Fastify: HTTP source/sink models
  • Next.js, Nuxt: Partial SSR support

Common Issues: | Issue | Fix | |-------|-----| | node_modules bloat | Already excluded by default | | TypeScript not parsed | Ensure tsconfig.json is valid | | Monorepo issues | Use --source-root for specific package |

Ruby

codeql database create "$DB_NAME" --language=ruby --source-root=.

Framework Support:

  • Rails: Full support (controllers, models, views)
  • Sinatra: Built-in support
  • Hanami: Partial support

Common Issues: | Issue | Fix | |-------|-----| | Bundler issues | Run bundle install first | | Rails engines | May need multiple database passes |

Build Required

Go

Compiled, and rejects --build-mode=none — autobuild or a manual command only. The command below looks build-free but runs autobuild, which invokes the Go toolchain; it fails if Go is absent or the module does not build, and there is no no-build fallback.

codeql database create "$DB_NAME" --language=go --source-root=.

Framework Support:

  • net/http, Gin, Echo, Chi: Built-in models
  • gRPC: Partial support
  • Custom routers: May need data extensions

Common Issues: | Issue | Fix | |-------|-----| | Missing dependencies | Run go mod download first | | Vendor directory | CodeQL handles automatically | | CGO code | Requires --command='go build' with CGO enabled | | Build fails | Fix it. --build-mode=none is rejected for Go, so there is no fallback |

C/C++

# Make
codeql database create "$DB_NAME" --language=cpp --command='make -j8'

# CMake
codeql database create "$DB_NAME" --language=cpp \
  --source-root=/path/to/src \
  --command='cmake --build build'

# Ninja
codeql database create "$DB_NAME" --language=cpp \
  --command='ninja -C build'

Build System Tips: | Build System | Command | |--------------|---------| | Make | make clean && make -j"$(nproc 2>/dev/null || sysctl -n hw.ncpu)" | | CMake | cmake -B build && cmake --build build | | Meson | meson setup build && ninja -C build | | Bazel | bazel build //... |

Common Issues: | Issue | Fix | |-------|-----| | Partial extraction | Ensure make clean before CodeQL build | | Header-only libraries | Use --extractor-option cpp_trap_headers=true | | Cross-compilation | Set CODEQL_EXTRACTOR_CPP_TARGET_ARCH |

Java/Kotlin

# Gradle
codeql database create "$DB_NAME" --language=java --command='./gradlew build -x test'

# Maven
codeql database create "$DB_NAME" --language=java --command='mvn compile -DskipTests'

Framework Support:

  • Spring Boot: Full support
  • Jakarta EE: Built-in models
  • Android: Requires Android SDK

Common Issues: | Issue | Fix | |-------|-----| | Missing dependencies | Run ./gradlew dependencies first | | Kotlin mixed projects | Use --language=java (covers both) | | Annotation processors | Ensure they run during CodeQL build |

Rust

codeql database create "$DB_NAME" --language=rust --command='cargo build'

Common Issues: | Issue | Fix | |-------|-----| | Proc macros | May require special handling | | Workspace projects | Use --source-root for specific crate | | Build script failures | Ensure native dependencies are available |

C#

# .NET Core
codeql database create "$DB_NAME" --language=csharp --command='dotnet build'

# MSBuild
codeql database create "$DB_NAME" --language=csharp --command='msbuild /t:rebuild'

Framework Support:

  • ASP.NET Core: Full support
  • Entity Framework: Database query models
  • Blazor: Partial support

Common Issues: | Issue | Fix | |-------|-----| | NuGet restore | Run dotnet restore first | | Multiple solutions | Specify solution file in command |

Swift

# Xcode project
codeql database create "$DB_NAME" --language=swift \
  --command='xcodebuild -project MyApp.xcodeproj -scheme MyApp build'

# Swift Package Manager
codeql database create "$DB_NAME" --language=swift --command='swift build'

Requirements:

  • macOS only
  • Xcode Command Line Tools

Common Issues: | Issue | Fix | |-------|-----| | Code signing | Add CODE_SIGN_IDENTITY=- CODE_SIGNING_REQUIRED=NO | | Simulator target | Add -sdk iphonesimulator |

Extractor Options

Set via environment variables: CODEQL_EXTRACTOR_<LANG>_OPTION_<NAME>=<VALUE>

C/C++ Options

| Option | Description | |--------|-------------| | trap_headers=true | Include header file analysis | | target_arch=x86_64 | Target architecture |

Java Options

| Option | Description | |--------|-------------| | jdk_version=17 | JDK version for analysis |

Python Options

| Option | Description | |--------|-------------| | python_executable=/path/to/python | Specific Python interpreter |