Skip to content

ci: scope CodeQL to first-party code - #413

Open
xanimo wants to merge 1 commit into
dogecoinfoundation:0.1.5-devfrom
xanimo:0.1.5-dev-codeql-scope
Open

ci: scope CodeQL to first-party code#413
xanimo wants to merge 1 commit into
dogecoinfoundation:0.1.5-devfrom
xanimo:0.1.5-dev-codeql-scope

Conversation

@xanimo

@xanimo xanimo commented Aug 6, 2026

Copy link
Copy Markdown
Member

15 of the 48 open CodeQL alerts are in vendored code — 7 in secp256k1, 8 in lodepng.

Nobody is going to act on the secp256k1 ones. A finding there is fixed by taking a newer upstream, not by editing our copy. They dilute the list that does need attention, which is how a security tab stops getting read.

Why this needs a config file

ql.yml already has a paths-ignore — but it's under on:, where it decides which file changes trigger a run. Restricting what CodeQL analyses is a different setting entirely, and lives in a config file passed to github/codeql-action/init. Easy to conflate; they're unrelated.

Why these paths

The exclusions mirror the -i list in cppcheck.yml deliberately, not coincidentally. Someone already reasoned about which vendored code in this tree is ours to maintain. Agreeing with that decision keeps both analysers describing the same codebase — so a finding either matters in both or neither.

What is deliberately not excluded

src/png.c (lodepng) and src/qr.c (qrcodegen) are single-file libraries vendored into the tree and, in practice, maintained here. qr.c has already needed a local fix — table indexing guarded only by an assert, which compiles out under NDEBUG (#401).

Excluding those would have hidden a real bug. They stay in scope, matching cppcheck, which excludes neither.

Expected effect

48 alerts → 41, all in code this project can actually change.

The 8 lodepng alerts remain and have been triaged: the invalid-pointer-deref at png.c:908 is an OOM path present verbatim in current upstream lodepng (20260119), on an encoder we drive with our own data — and libdogecoin never calls the PNG decoder at all, only lodepng_encode24 / lodepng_save_file / lodepng_error_text.

One caveat for review

paths-ignore is supported for compiled languages but doesn't behave identically to interpreted ones, since CodeQL sees what the build compiles. If secp256k1 alerts survive the next run, the exclusion needs to happen at build time instead. Worth watching on the first analysis after merge rather than assuming it worked.

Fifteen of the forty-eight open CodeQL alerts are in vendored code -- 7
in secp256k1 and 8 in lodepng. Nobody is going to act on the secp256k1
ones: a finding there is fixed by taking a newer upstream, not by editing
our copy. They dilute the list that does need attention, which is how a
security tab stops getting read.

Worth being precise about why this needs a config file at all. ql.yml
already has a paths-ignore, but that is under `on:` -- it decides which
file changes trigger a run. Restricting what CodeQL analyses is a
different setting and lives in a config file passed to
github/codeql-action/init.

The exclusions mirror the -i list in cppcheck.yml deliberately rather
than by coincidence. Someone already reasoned about which of this tree's
vendored code is ours to maintain; agreeing with that decision keeps the
two analysers describing the same codebase, and means a finding either
matters in both or neither.

Note what is not excluded. src/png.c (lodepng) and src/qr.c (qrcodegen)
are single-file libraries vendored into the tree and, in practice,
maintained here: qr.c has already needed a local fix for table indexing
guarded only by an assert, which compiles out under NDEBUG. Excluding
those would have hidden a real bug, so they stay in scope. cppcheck
excludes neither, and this matches.

Expected effect: 48 alerts to 41, all of them in code this project can
actually change. The 8 lodepng alerts remain, and have been triaged --
the invalid-pointer-deref at png.c:908 is an OOM path present verbatim in
current upstream lodepng, on an encoder we drive with our own data, and
libdogecoin never calls the PNG decoder at all.

One caveat for review: paths-ignore is supported for compiled languages
but does not behave identically to interpreted ones, since CodeQL sees
what the build compiles. If secp256k1 alerts survive the next run, the
exclusion needs to happen at build time instead, and that is worth
watching on the first analysis after merge rather than assuming.
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.

1 participant