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/build-fixes.md

Build Fixes

Fixes to apply when a CodeQL database build method fails. Try these in order, then retry the current build method. Log each fix attempt.

Every block sources build_log.sh for itself. A helper defined in an earlier Bash call is gone by the next one, and log_step then exits 127, which the ladder reads as a failed method.

1. Clean existing state

. "{baseDir}/scripts/build_log.sh" || exit 1

log_step "Applying fix: clean existing state"
rm -rf "$DB_NAME"
log_result "Removed $DB_NAME"

2. Clean build cache

. "{baseDir}/scripts/build_log.sh" || exit 1

log_step "Applying fix: clean build cache"
CLEANED=""
make clean 2>/dev/null && CLEANED="$CLEANED make"
rm -rf build CMakeCache.txt CMakeFiles 2>/dev/null && CLEANED="$CLEANED cmake-artifacts"
./gradlew clean 2>/dev/null && CLEANED="$CLEANED gradle"
mvn clean 2>/dev/null && CLEANED="$CLEANED maven"
cargo clean 2>/dev/null && CLEANED="$CLEANED cargo"
log_result "Cleaned: $CLEANED"

3. Install missing dependencies

Note: The commands below install the target project's dependencies so CodeQL can trace the build. Use whatever package manager the target project expects (pip, npm, go mod, etc.) — these are not the skill's own tooling preferences.

. "{baseDir}/scripts/build_log.sh" || exit 1

log_step "Applying fix: install dependencies"
FAILED_INSTALLS=()

# Python — use target project's package manager (pip/uv/poetry)
# allow-legacy-python: installs the analysed project's own deps; forcing uv could change its build.
if [ -f requirements.txt ]; then
  run_logged pip install -r requirements.txt || FAILED_INSTALLS+=("pip install -r requirements.txt")
fi
if [ -f setup.py ] || [ -f pyproject.toml ]; then
  run_logged pip install -e . || FAILED_INSTALLS+=("pip install -e .")
fi

# Node
if [ -f package.json ]; then
  run_logged npm install || FAILED_INSTALLS+=("npm install")
fi

# Go
if [ -f go.mod ]; then
  run_logged go mod download || FAILED_INSTALLS+=("go mod download")
fi

# Java
if [ -f build.gradle ] || [ -f build.gradle.kts ]; then
  run_logged ./gradlew dependencies --refresh-dependencies || FAILED_INSTALLS+=("gradlew dependencies")
fi
if [ -f pom.xml ]; then
  run_logged mvn dependency:resolve || FAILED_INSTALLS+=("mvn dependency:resolve")
fi

# Rust
if [ -f Cargo.toml ]; then
  run_logged cargo fetch || FAILED_INSTALLS+=("cargo fetch")
fi

if [ ${#FAILED_INSTALLS[@]} -gt 0 ]; then
  log_result "Dependency installation FAILED: ${FAILED_INSTALLS[*]}"
  echo "WARNING: ${#FAILED_INSTALLS[@]} dependency step(s) failed — a retry will likely" \
       "fail the same way. Report which, rather than retrying blind." >&2
else
  log_result "Dependencies installed"
fi

4. Handle private registries

If dependencies require authentication, ask user:

AskUserQuestion: "Build requires private registry access. Options:"
  1. "I'll configure auth and retry"
  2. "Skip these dependencies"
  3. "Show me what's needed"
. "{baseDir}/scripts/build_log.sh" || exit 1

# Log authentication setup if performed
log_step "Private registry authentication configured"
log_result "Registry: <REGISTRY_URL>, Method: <AUTH_METHOD>"

After fixes: Retry current build method. If still fails, move to next method.