---
title: "How GitHub uses CodeQL to secure GitHub"
description: "GitHub's Product Security Engineering team runs CodeQL across more than 10,000 repositories, mostly with default setup and the security-extended suites."
url: "https://swe.quest/articles/how-github-uses-codeql-to-secure-github-3ead357c38ddce28"
canonical: "https://github.blog/engineering/how-github-uses-codeql-to-secure-github/"
source: "GitHub Engineering"
published: "2025-02-12"
difficulty: "medium"
kind: "Case study"
reading_minutes: 14
tags: ["static-analysis","appsec","ruby","ci-cd"]
---

# How GitHub uses CodeQL to secure GitHub

A post on [GitHub Engineering](https://swe.quest/sources/github.md), published 2025-02-12, 14 min read, Case study. Original: [https://github.blog/engineering/how-github-uses-codeql-to-secure-github/](https://github.blog/engineering/how-github-uses-codeql-to-secure-github/)

## Summary

GitHub's Product Security Engineering team runs CodeQL across more than 10,000 repositories, mostly with default setup and the security-extended suites. Its Ruby monolith gets advanced setup with a custom query pack published to GitHub Container Registry. Publishing the pack separately avoided production deploys for every query change, gave precompiled queries, and kept CodeQL CLI upgrades from breaking monolith CI. A bad query could be rolled back by republishing the pack in under 15 minutes. The post shows how they pin the ruby-all dependency via codeql-pack.lock.yml, unit-test queries, share the pack through a linked repository, and use recommendation-severity custom queries (e.g. missing control\_access on REST endpoints, ActiveRecord decrypt) alongside multi-repository variant analysis for bug bounty follow-up.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [Static analysis](https://swe.quest/tags/static-analysis.md) (Engineering practices)
- [Application security](https://swe.quest/tags/appsec.md) (Security)
- [Ruby](https://swe.quest/tags/ruby.md) (Languages)
- [CI/CD](https://swe.quest/tags/ci-cd.md) (Reliability & operations)

## Prerequisites

- static analysis basics ([easy posts on Static analysis](https://swe.quest/tags/static-analysis.md?difficulty=easy))
- GitHub Actions ([easy posts on CI/CD](https://swe.quest/tags/ci-cd.md?difficulty=easy))
- Ruby on Rails ([easy posts on Ruby](https://swe.quest/tags/ruby.md?difficulty=easy))

## Keywords

CodeQL, GitHub Advanced Security, GitHub Container Registry, multi-repository variant analysis, ActiveRecord, GitHub Actions

## Related posts

- [How we use Dependabot to secure GitHub](https://swe.quest/articles/how-we-use-dependabot-to-secure-github-a37d347bd1917fad.md): GitHub Engineering · 2022-05-25 · Medium · 7 min read · Supply chain security, Engineering management
  GitHub's Product Security Engineering team rolled Dependabot out across several thousand internal repositories in three stages: measuring alerts org-wide through the GraphQL API, a staged enablement (200 repos, then 1,000 at 30 days, then the whole org at 45 days), and remediation.
- [How we ship code faster and safer with feature flags](https://swe.quest/articles/how-we-ship-code-faster-and-safer-with-feature-flags-49a97b8efaf60044.md): GitHub Engineering · 2021-04-27 · Medium · 9 min read · Deployment, CI/CD, Testing, Refactoring & migrations, Ruby
  GitHub puts risky changes and in-progress features behind feature flags so it can deploy continuously and disable problems in seconds instead of rolling back a deployment over several minutes.
- [From single pull requests to full software packages: Detecting malicious code at scale](https://swe.quest/articles/from-single-pull-requests-to-full-software-packages-detecting-malicious-code-at-717a58a001a046a1.md): Datadog Engineering · 2026-06-02 · Medium · 12 min read · Supply chain security, Threat detection, AI agents, LLMs, Cost optimization
  Datadog extended BewAIre, its LLM-based malicious code detector, from pull requests to full dependency packages by stacking a cheap filter model in front of an agentic investigation model.
- [Fixing security vulnerabilities with AI](https://swe.quest/articles/fixing-security-vulnerabilities-with-ai-6cf393c64f079c26.md): GitHub Engineering · 2024-02-14 · Medium · 10 min read · AI for coding, Static analysis, Application security, LLMs, Evaluation
  Copilot Autofix turns CodeQL security alerts into LLM-suggested fixes by building a prompt from the query help, the alert message, and code snippets along the data-flow path.
- [When an AI agent came knocking: Catching malicious contributions in Datadog’s open source repos](https://swe.quest/articles/when-an-ai-agent-came-knocking-catching-malicious-contributions-in-datadog-s-efd5d1e84be0c443.md): Datadog Engineering · 2026-03-09 · Medium · 16 min read · Supply chain security, CI/CD, Threat detection, AI agents, Open source
  An AI agent called hackerbot-claw targeted Datadog's public repositories in late February 2026.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
