GitHub Copilot Security Review vs CodeQL: What Can Block a Merge?

Use Copilot /security-review for local triage and CodeQL rulesets for merge enforcement. Compare coverage, cost, evidence, and rollout controls.

Saturday, July 18, 2026Omid Saffari
GitHub Copilot Security Review vs CodeQL: What Can Block a Merge?

GitHub Copilot's /security-review should never be your required merge gate. Use it as fast local triage for active changes, then let CodeQL code scanning and a ruleset enforce the repository policy.

The production verdict

Copilot security review and CodeQL belong at different points in the same delivery path. The Copilot command gives a developer fast, contextual feedback before code leaves the workstream. CodeQL produces repository-level code scanning alerts that a GitHub ruleset can turn into an enforceable merge condition.

That distinction matters more than whether both tools can find an injection flaw. A production gate needs a known trigger, durable evidence, a failure state, and an owner for bypasses. /security-review gives you a useful opinion. CodeQL plus a ruleset gives the repository a policy.

GitHub's new app command is still valuable. It analyzes in-flight changes, returns high-confidence findings scored by severity and confidence, and proposes changes that the developer can apply and reverify. GitHub explicitly describes it as a lightweight, on-demand check that complements code scanning, Dependabot, and secret scanning. It is not the replacement for any of them. GitHub's Copilot app announcement is clear about that boundary.

GitHub Copilot app security review announcement and product screenshot
Copilot security review is an on-demand review of in-flight changes.

CodeQL owns the other side of the boundary. It builds a representation of supported source code, runs maintained queries, and publishes findings as GitHub code scanning alerts. Default setup can choose the languages, query suite, and scan events for the repository; advanced setup and external CI are available when the defaults are not enough. GitHub's CodeQL documentation documents all three setup paths.

GitHub documentation for CodeQL code scanning
CodeQL findings become repository code scanning alerts.

The one axis that separates them: enforceable evidence

CodeQL wins the merge-gate decision because its result can participate in repository policy. The Copilot command wins the feedback-speed decision because it runs while the developer still owns the change.

DecisionCopilot /security-reviewCodeQL code scanningEnforcementEvidenceProduction use
ScopeActive local or in-flight changesSupported code analyzed for the repository and pull requestCopilot is advisory; CodeQL can be requiredCopilot findings in the workstream; CodeQL alerts in GitHubUse both on the same change
TriggerDeveloper runs the commandConfigured repository events or external CICodeQL has a policy-controlled triggerScan status is tied to the pull requestDo not rely on developer memory for the gate
AnalysisAI-driven, contextual reviewMaintained CodeQL queries over a code databaseQuery results map to a rulesetCodeQL findings use SARIF, a standard static-analysis result formatKeep query pack and scan status with release evidence
CoverageHigh-impact classes across 11 categoriesPublished support for C/C++, C#, Go, Java/Kotlin, JavaScript/TypeScript, Python, Ruby, Rust, Swift, and GitHub Actions workflowsNeither covers every security failureRecord the tool and language coverageAdd another required scanner for unsupported languages
Failure behaviorFinding requires developer judgmentAlert severity can fail repository policyRuleset can block the mergeCodeQL alert and scan status live with the repositoryMake bypasses explicit and reviewable
AvailabilityCopilot Free, Pro, Business, and Enterprise during public previewFree for public repositories; private organization repositories need GitHub Code SecurityPlan and repository type decide availabilityBilling and enablement are organization controlsBudget before broad private-repository rollout

The ruleset is the decisive piece. GitHub can prevent a pull request from merging when a required code-scanning tool finds an alert at the configured severity, when its analysis is still running, or when the required tool is not configured. Those are fail-closed states. A clean chat response has no equivalent repository policy. GitHub's ruleset reference defines the blocking conditions.

Decision flow showing local Copilot triage feeding a CodeQL ruleset and human merge approval
Fast local signal first, enforceable repository evidence second.

The practical consequence is simple: a developer can skip an advisory command, close its window, or run it before the final diff. A required code-scanning rule follows the pull request state. If analysis is missing, unfinished, or above the severity threshold, the merge stays closed.

Where Copilot security review earns its place

Use /security-review before the pull request, when the cheapest fix is still a local edit. That is where contextual AI review creates value without pretending to be a control plane.

Consider an engineer changing an authorization handler and its data-access layer. The useful local loop is:

  • Finish a coherent slice of the change, including tests.
  • Run /security-review against the active workstream.
  • Inspect the reported data flow, severity, confidence, and proposed remediation.
  • Apply a suggestion only after checking the intended authorization behavior.
  • Rerun the review on the resulting diff, then open or update the pull request.
  • Record every accepted, rejected, and deferred finding in the pull request when it changes the security decision.

The command is tuned for injection, cross-site scripting, insecure data handling, path traversal, and weak cryptography in the app. The CLI announcement describes broader coverage across 11 categories, including broken access control, SSRF, insecure deserialization, hardcoded credentials, supply-chain risks, and cross-prompt injection against LLM-integrated code. Those are useful review prompts for agent-authored changes. They are not a recall guarantee.

GitHub's own command reference sets the correct expectation: /security-review is a focused review of active local changes, not a full repository security audit. The Copilot CLI reference should be the sentence your rollout policy copies.

Treat this evidence as a handoff, not ceremony. If the developer changes the diff after the local review, the old result is stale. The pull request should say so, and the developer should rerun the command before asking for approval.

GitHub Copilot app documentation
The app keeps the advisory review inside the developer workstream.

Where CodeQL must remain the gate

Use CodeQL where repeatability and repository enforcement matter. Its strongest production property is not that it catches every vulnerability. It is that the same policy can run on every relevant pull request and produce an alert the repository understands.

Start with the default query suite as the required signal. GitHub describes it as high precision with few false-positive code scanning results. Evaluate security-extended separately before making it blocking: it includes the default suite plus lower-precision and lower-severity queries, and GitHub warns that it may return more false positives. The CodeQL query-suite reference gives you the tradeoff without marketing fog.

For a production team, the rollout rule is:

  • Require the default suite on protected release branches.
  • Run security-extended in an observed, non-blocking lane until security owners understand its alert volume and failure modes.
  • Promote only the severities and query classes the team can triage within its release process.
  • Keep a named owner and reason for every ruleset bypass.
  • Export the alert state with the release evidence when compliance or incident response needs a durable trail.

Language coverage is the first place this breaks. CodeQL supports its published language set, but GitHub explicitly says PHP and Scala are not supported. Attempting to scan an unsupported language can produce no alerts and incomplete analysis. A green workflow in that situation is not a clean security result.

The fix is to require a compatible third-party code-scanning tool for the unsupported part of the stack. GitHub rulesets can require code-scanning results from a named tool, so the policy remains fail-closed. Keep /security-review as supplemental coverage, especially for business logic and cross-file context, but never let it mask a missing SAST lane.

The cost boundary also differs. Copilot app /security-review is available to Free, Pro, Business, and Enterprise users during public preview. Code scanning is free for public repositories. Private repositories need GitHub Code Security, where usage is measured by unique active committers and activity looks back 90 days. Budget against the people touching enabled repositories, not the repository count. GitHub's current Advanced Security billing documentation is the source of truth.

GitHub Advanced Security license billing documentation
Private-repository Code Security cost follows unique active committers.

Ship the layered merge gate

The reliable design is a sequence of bounded checks with different owners. No single scanner gets promoted into a universal security oracle.

  1. Put Copilot in the developer loop

    Run /security-review after a coherent change and its tests are ready. Require a disposition for findings that affect security behavior. Rerun after any material edit so the reviewed diff is the diff that reaches the pull request.

  2. Run CodeQL on the pull request

    Enable default setup when its automatic language and event choices fit. Use advanced setup or external CI when the build, query packs, or runner boundary needs explicit control. The result must publish as code scanning alerts against the pull request.

  3. Make code scanning fail closed

    Add the code-scanning rule to the protected-branch ruleset. Select the required tool and severity threshold. Keep merge blocked when the tool reports a qualifying alert, remains in progress, or is missing.

  4. Route high-risk paths to humans

    Require accountable review for authentication, authorization, tenant boundaries, payment flows, cryptography, deployment permissions, and security-control changes. AI findings inform that reviewer; they do not approve their own remediation.

  5. Log the exception path

    Capture the repository, pull request, commit SHA, scanner, query suite, alert disposition, bypass actor, bypass reason, and follow-up owner. Alert when bypass volume rises or required analyses disappear from protected branches.

Layered merge-gate evidence stack from local review through human approval
Each layer produces a signal, an owner, and a failure state.

GitHub's responsible-use guidance for AI-generated security fixes matches this design: review the suggestion, verify CI passes, and confirm the alert is resolved before merging. The model can propose the patch. Tests, code scanning, and an accountable reviewer prove whether it belongs.

The minimum useful release record should answer these questions without reopening a chat transcript:

  • Which commit did the developer review locally?
  • Which code-scanning tool and query suite ran on the final pull request?
  • Which alerts were introduced, fixed, dismissed, or accepted?
  • Did a ruleset block or allow the merge?
  • Who bypassed a control, why, and who owns the follow-up?

That record is what incident response needs when a vulnerability appears later. "Copilot looked at it" is not evidence. A commit-scoped scan result, alert disposition, merge policy outcome, and named approver are.

What breaks first in production

The first production failure is usually stale evidence, not scanner quality. The developer runs /security-review, edits the implementation, and assumes the earlier result still applies. Bind the local review to a commit SHA and rerun after material changes.

The next failure is a green blind spot. CodeQL can only analyze its supported languages and modeled frameworks. Inventory repository languages before rollout, map each one to a required scanner, and fail enablement when any production language has no owner or coverage path.

Alert fatigue follows when a team makes every possible query blocking on day one. Start the required gate with CodeQL's higher-precision default suite. Observe lower-precision signals before promotion, and measure dismissed findings by query and reason. A noisy rule that developers routinely bypass is weaker than a smaller gate they trust.

Preview drift is another operational risk. /security-review and code scanning's AI detections are in public preview. Keep their use behind a documented rollout policy, recheck availability and billing before expanding, and never base a compliance promise on a preview-only behavior.

Finally, bypasses become invisible. The repository may be technically protected while administrators or approved actors routinely step around the rule. Log bypass actor, reason, affected commit, and follow-up owner. Review that stream with the same seriousness as failed scans.

For a broader rollout policy, the same principle applies to other AI review surfaces: treat AI security review as early signal, not approval. Pair the control data with repository-level Copilot rollout telemetry so adoption never outruns review capacity.

The decision rule

Use Copilot /security-review when the developer can still change direction cheaply. Use CodeQL and a ruleset when the repository must prove that a required scan ran and passed policy. Add a compatible required scanner where CodeQL has no language coverage, and keep humans accountable for business-logic security.

The choice flips only when the requirement flips:

  • Need fast feedback on an active diff? Run /security-review.
  • Need an auditable alert tied to the pull request? Run CodeQL code scanning.
  • Need to prevent a merge? Require code-scanning results in a ruleset.
  • Need assurance for authorization or tenant boundaries? Require a qualified human reviewer and tests that exercise the security invariant.

That is the production stack: advisory AI close to the author, repeatable static analysis in CI, policy at the repository boundary, and accountable approval where the cost of a miss is highest.

Is GitHub Copilot security review free?

During public preview, /security-review in the GitHub Copilot app is available to Copilot Free, Pro, Business, and Enterprise users. Treat that as preview availability, not a permanent pricing commitment.

Does Copilot /security-review run CodeQL?

No. GitHub says the Copilot-driven scan does not rely on GitHub code scanning, Dependabot, or secret scanning. It is a separate, lightweight review that complements those systems.

Can CodeQL block a pull request merge?

Yes, through a GitHub ruleset that requires code-scanning results. The rule can block when the required tool finds an alert at the configured severity, is still running, or is not configured.

What should a team use for PHP or Scala?

CodeQL does not support PHP or Scala. Require a compatible third-party code-scanning tool for those languages, keep its result inside the same ruleset, and use Copilot security review only as supplemental signal.

Last Updated

Jul 18, 2026

CategoryCoding

More from Coding

View all Coding articles
Newsletter

One letter, every week. Working systems — not hot takes.

Build logs, agentic engineering decisions, agent failures, evals, and what survives real users. Sent weekly, never more.

Weekly. No spam. Unsubscribe anytime.