Skip to content

Make CodeQL opt-in per job instead of auto-injected everywhere - #141

Merged
Ewerton Scaboro da Silva (ewertons) merged 1 commit into
masterfrom
ewertons/codeql-opt-in-per-job
Aug 11, 2026
Merged

Make CodeQL opt-in per job instead of auto-injected everywhere#141
Ewerton Scaboro da Silva (ewertons) merged 1 commit into
masterfrom
ewertons/codeql-opt-in-per-job

Conversation

@ewertons

Copy link
Copy Markdown
Contributor

Problem

The 1ES policy decorator injects CodeQL into every job of build/.vsts-ci.yml. S360 records arg_max(SnapshotDate) per (repo, language), so a database produced incidentally by a job that does not build the product silently replaces the one from the job that does.

This repo is a direct victim. Its "Database failed to finalize or no source code was built!" entry in the Microsoft.Security.CodeQL.10000 report comes from the auto-injected CodeQL in the Linux Ubuntu 24.04 job of the integrate-into-repo-uhttp pipeline (def 114, build 161370) — a job that produces no CodeQL-traceable build.

Change

Turn CodeQL off at pipeline level and opt back in on the one job that deliberately builds for it:

Job Codeql.Language
windowsx64 cpp — the only language this repo is graded on

That job already runs CodeQL3000Init/CodeQL3000Finalize around a real x64 build, so this only removes the competing and failing uploads. The job-level variable overrides the pipeline-level default and stays gated on refs/heads/master, so PR builds are unaffected.

The now-redundant per-job CodeQL.Enabled: false entries on checksubmodule, OSX and xcodenative were removed — the pipeline-level default covers them.

Verification

  • YAML parses.
  • With Enabled = false the injected task still appears in the timeline but no-ops in ~20 s (measured on the sibling C SDK, which already used this opt-out on its macOS jobs).
  • Default Cadence = 72 hours, comfortably inside the 30-day recurrent SLA.

Same change as Azure/azure-iot-sdk-c#2743.

The 1ES policy decorator injects CodeQL into every job of this pipeline. S360
records arg_max(SnapshotDate) per (repo, language), so a database produced
incidentally by a job that does not build the product silently replaces the one
from the job that does.

That is exactly what this repo hit: the "Database failed to finalize or no
source code was built!" entry in the Microsoft.Security.CodeQL.10000 report
comes from the auto-injected CodeQL in the 'Linux Ubuntu 24.04' job of the
integrate-into-repo-uhttp pipeline (def 114, build 161370) -- a job that does
not produce a CodeQL-traceable build.

Turn CodeQL off at pipeline level and opt back in on the 'windowsx64' job, which
already runs CodeQL3000Init/Finalize around a real x64 build and is the intended
owner of this repo's cpp snapshot -- the only language this repo is graded on.
The job-level variable overrides the pipeline-level default and stays gated on
refs/heads/master, so PR builds are unaffected.

The now-redundant per-job CodeQL.Enabled: false entries on checksubmodule, OSX
and xcodenative were removed; the pipeline-level default covers them.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the Azure DevOps pipeline configuration to prevent 1ES policy auto-injection of CodeQL from running (and uploading snapshots) on every job, and instead enables CodeQL only for the single job intended to produce the authoritative C++ database for S360.

Changes:

  • Adds a pipeline-level Codeql.Enabled: false to globally disable injected CodeQL behavior.
  • Opts the windowsx64 job back into CodeQL on refs/heads/master and sets Codeql.Language: cpp.
  • Removes now-redundant per-job CodeQL.Enabled: false overrides from jobs that don’t own the CodeQL snapshot.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@ewertons
Ewerton Scaboro da Silva (ewertons) merged commit 7bc0c1c into master Aug 11, 2026
15 checks passed
@ewertons
Ewerton Scaboro da Silva (ewertons) deleted the ewertons/codeql-opt-in-per-job branch August 11, 2026 20:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants