Перейти к содержанию
Skillpedia
Тестирование40k · #7112

codeql

Что он делает

Этот инструмент поможет настроить и использовать CodeQL для анализа вашего кода на предмет проблем безопасности. Его можно использовать вместе с GitHub Actions или напрямую на своем компьютере.

Когда использовать

  • ✓Когда вы хотите настроить анализ безопасности кода на GitHub.
  • ✓Когда нужно создать или изменить файл конфигурации CodeQL.
  • ✓Когда вы хотите запустить CodeQL на своем компьютере для проверки кода.

Ссылка на скилл

https://github.com/github/awesome-copilot/blob/main/skills/codeql/SKILL.md

Скопируйте и вставьте её в ваш ИИ (Claude, ChatGPT или Cursor) с просьбой следовать инструкциям.

Как использовать

Самый простой способ: скопируйте сообщение и вставьте его в свой ИИ. Он прочитает скилл и выполнит инструкции.

Готовое сообщение для вставки

Используй этот скилл, чтобы помочь мне: https://github.com/github/awesome-copilot/blob/main/skills/codeql/SKILL.md Прочитай файл SKILL.md по этой ссылке и следуй его инструкциям в моей задаче.
Хотите, чтобы ваш ИИ сам находил такие скиллы?Установите бесплатный MCP Skillpedia: одна строка, и перед каждой задачей он ищет среди 15 000+ скиллов.Установить за 1 минуту →

Пример запроса к вашему ИИ

“Как настроить CodeQL для анализа моего Python-проекта в GitHub Actions?”

5 новых скиллов в неделю. 1 минута чтения.

Как это работает

CodeQL создает «базу данных» вашего кода, а затем анализирует ее с помощью набора правил безопасности. Это можно делать автоматически через GitHub Actions или вручную из командной строки.

Технический текст (оригинальный SKILL.md)

Оригинальный текст автора на английском, прямо с GitHub.

CodeQL Code Scanning

This skill provides procedural guidance for configuring and running CodeQL code scanning — both through GitHub Actions workflows and the standalone CodeQL CLI.

When to Use This Skill

Use this skill when the request involves:

  • Creating or customizing a codeql.yml GitHub Actions workflow
  • Choosing between default setup and advanced setup for code scanning
  • Configuring CodeQL language matrix, build modes, or query suites
  • Running CodeQL CLI locally (codeql database create, database analyze, github upload-results)
  • Understanding or interpreting SARIF output from CodeQL
  • Troubleshooting CodeQL analysis failures (build modes, compiled languages, runner requirements)
  • Setting up CodeQL for monorepos with per-component scanning
  • Configuring dependency caching, custom query packs, or model packs

Supported Languages

CodeQL supports the following language identifiers:

Language Identifier Alternatives
C/C++ c-cpp c, cpp
C# csharp —
Go go —
Java/Kotlin java-kotlin java, kotlin
JavaScript/TypeScript javascript-typescript javascript, typescript
Python python —
Ruby ruby —
Rust rust —
Swift swift —
GitHub Actions actions —

Alternative identifiers are equivalent to the standard identifier (e.g., javascript does not exclude TypeScript analysis).

Core Workflow — GitHub Actions

Step 1: Choose Setup Type

  • Default setup — Enable from repository Settings → Advanced Security → CodeQL analysis. Best for getting started quickly. Uses none build mode for most languages.
  • Advanced setup — Create a .github/workflows/codeql.yml file for full control over triggers, build modes, query suites, and matrix strategies.

To switch from default to advanced: disable default setup first, then commit the workflow file.

Step 2: Configure Workflow Triggers

Define when scanning runs:

on:
  push:
    branches: [main, protected]
  pull_request:
    branches: [main]
  schedule:
    - cron: '30 6 * * 1'  # Weekly Monday 6:30 UTC
  • push — scans on every push to specified branches; results appear in Security tab
  • pull_request — scans PR merge commits; results appear as PR check annotations
  • schedule — periodic scans of the default branch (cron must exist on default branch)
  • merge_group — add if repository uses merge queues

To skip scans for documentation-only PRs:

on:
  pull_request:
    paths-ignore:
      - '**/*.md'
      - '**/*.txt'

paths-ignore controls whether the workflow runs, not which files are analyzed.

Step 3: Configure Permissions

Set least-privilege permissions:

permissions:
  security-events: write   # Required to upload SARIF results
  contents: read            # Required to checkout code
  actions: read             # Required for private repos using codeql-action

Step 4: Configure Language Matrix

Use a matrix strategy to analyze each language in parallel:

jobs:
  analyze:
    name: Analyze (${{ matrix.language }})
    runs-on: ubuntu-latest
    strategy:
      fail-fast: false
      matrix:
        include:
          - language: javascript-typescript
            build-mode: none
          - language: python
            build-mode: none

For compiled languages, set the appropriate build-mode:

  • none — no build required (supported for C/C++, C#, Java, Rust)
  • autobuild — automatic build detection
  • manual — custom build commands (advanced setup only)

For detailed per-language autobuild behavior and runner requirements, search references/compiled-languages.md.

Step 5: Configure CodeQL Init and Analysis

steps:
  - name: Checkout repository
    uses: actions/checkout@v4

  - name: Initialize CodeQL
    uses: github/codeql-action/init@v4
    with:
      languages: ${{ matrix.language }}
      build-mode: ${{ matrix.build-mode }}
      queries: security-extended
      dependency-caching: true

  - name: Perform CodeQL Analysis
    uses: github/codeql-action/analyze@v4
    with:
      category: "/language:${{ matrix.language }}"

Query suite options:

  • security-extended — default security queries plus additional coverage
  • security-and-quality — security plus code quality queries
  • Custom query packs via packs: input (e.g., codeql/javascript-queries:AlertSuppression.ql)

…

Частые вопросы

Что такое CodeQL?

CodeQL это инструмент, который превращает ваш код в данные, чтобы их можно было анализировать на предмет уязвимостей безопасности и ошибок.

Что такое GitHub Actions?

GitHub Actions это сервис, который позволяет автоматизировать задачи внутри GitHub, например запуск тестов или анализ кода, прямо из вашего репозитория.

Что такое SARIF?

SARIF это стандартный формат для отчетов о результатах анализа безопасности, который CodeQL использует, чтобы показать найденные проблемы.

Подробности

Оригинальное описание автора

Comprehensive guide for setting up and configuring CodeQL code scanning via GitHub Actions workflows and the CodeQL CLI. This skill should be used when users need help with code scanning configuration, CodeQL workflow files, CodeQL CLI commands, SARIF output, security analysis setup, or troubleshooting CodeQL analysis.

repo: github/awesome-copilot

Популярность

Звёзды на GitHub
40k
Место в рейтинге
#7112
Лицензия
MIT
Обновлён
15.10.2026

Полезен ли этот скилл?

0

Войдите , чтобы голосовать.

Комментарии

  • …

Другие скиллы из этого репозитория

Похожие скиллы