You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit aa4b995
Browse filesBrowse the repository at this point in the historyBrowse files
fix(workflows): add packages: read permission to update-codeql-version.yml (#163)
* fix(workflows): add packages: read permission to update-codeql-version.yml
Fixes a live failure hit during the first real end-to-end test of this
workflow (dispatched with codeql_version: 2.21.4): the 'Upgrade every
pack's dependencies' step failed resolving codeql/namebinding ('not
found in the registry') while running codeql pack upgrade on ruby/src.
The job's default GITHUB_TOKEN lacked packages: read, matching what
ci.yml already grants for the same kind of pack resolution. Tracked in
issue #162.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
* debug: temporary step to inspect codeql resolve qlpacks output
* debug: test gh-codeql bundle install + qlpacks disk layout
* debug: point directly at gh-codeql bundle unpack dir
* debug: search go dir + resolve qlpacks with bundle codeql binary
* debug: try codeql-action codeql-bundle release asset
* debug: list all qlpacks dir entries via tar tzf without extraction
* fix(workflows): pin codeql/* library deps to the CLI-bundle version before upgrade
codeql pack upgrade resolves unconstrained '*' dependencies to the
latest-ever-published registry version, completely independent of the
CLI version pinned in .codeqlversion. This caused e.g. codeql/go-all
to jump to 7.2.0 (registry-latest) instead of 4.2.6 (the version
actually shipped with/tested against CLI 2.21.4), and caused
'codeql/namebinding not found in the registry' fatal errors for other
languages since registry-latest go-all depends on packages not
present at the versions being resolved.
Add .github/scripts/pin-codeql-library-versions.sh, which downloads
the official CodeQL Bundle (github/codeql-action release
codeql-bundle-v<version>) for the target CLI version and rewrites
every codeql/<lang>-all / codeql/<lang>-queries dependency across all
qlpack.yml files from '*' to that exact bundled version, before
codeql pack upgrade runs. Internal githubsecuritylab/* cross-pack
dependencies are left untouched (they intentionally track our own
latest published versions).
* chore: mark pin-codeql-library-versions.sh executable
* fix(workflows): exclude ql/hotspots from the pack-upgrade loop
ql/hotspots is a standalone local dev tool (see ql/hotspots/README.md
and hotspots.yml), not one of the per-language src/lib/ext packs that
ci.yml/publish.yml operate on. Its codeql/ql: '*' dependency isn't a
real resolvable GHCR package, so it always fails codeql pack upgrade
regardless of CLI version - a pre-existing, unrelated latent bug this
workflow's blanket 'find . -name qlpack.yml' loop was hitting for the
first time now that the codeql/*-all resolution bug is fixed and the
loop can actually reach this directory.
* fix(workflows): gitignore the downloaded codeql_home CLI install dir
The install-codeql composite action downloads/extracts the CodeQL CLI
into github.workspace/codeql_home, i.e. inside the repository
checkout, but this directory was never gitignored. update-codeql-version.yml
is the first workflow to both install CodeQL AND commit/push changes
(via peter-evans/create-pull-request), and its push was rejected by
GitHub's 100MB file size limit because codeql_home/codeql-linux64.zip
(~474MB) and several 50+MB extractor binaries got staged as untracked
files alongside the real qlpack.yml/lock-file changes.
* docs(contributing): document exact-pinning of codeql/* dependencies
Explains why codeql/<lang>-all / codeql/<lang>-queries dependencies in
qlpack.yml are now pinned to an exact version (matching the official
CodeQL Bundle for the target CLI release) instead of left as an
unconstrained '*' range: codeql pack upgrade resolves '*' to the
latest-ever-published registry version, independent of .codeqlversion,
which previously let a routine CLI bump silently jump a library several
major versions ahead of anything that CLI actually ships/tests against.
Also documents:
- How the pin values are derived (github/codeql-action bundle release
listing via tar tzf, not gh-codeql or a web scrape) and why those two
alternatives were rejected.
- The new pin-codeql-library-versions.sh step in the
update-codeql-version.yml process (as step 2.1, before codeql pack
upgrade).
- Why ql/hotspots is excluded from the pack-upgrade loop (standalone
dev tool, not a real per-language pack, codeql/ql is not a real
registry/bundle package).
- That this is a go-forward convention: existing qlpack.yml files stay
unpinned until their next CLI-bump run, not retroactively true today.
* fix(workflows): exclude codeql_home from qlpack.yml discovery loops
Copilot review caught this on PR #163: .github/actions/install-codeql
downloads/extracts the CodeQL CLI into ./codeql_home (inside the repo
checkout), and the bare CLI ships its own small vendored qlpack.yml
packs (codeql/<lang>/downgrades, codeql/legacy-upgrades) that have
nothing to do with this repo's packs.
Confirmed via the live test run (29110858206) log: both the pin script
and the upgrade loop's `find . -name qlpack.yml` picked up and ran
`codeql pack upgrade` against 10 of these vendored packs under
./codeql_home/codeql/*/downgrades and ./codeql_home/codeql/legacy-upgrades,
in addition to this repo's real 47 pack directories. It happened to
succeed silently this time and was invisible in the resulting PR diff
only because codeql_home is now gitignored (fixed in ee26fcc) - but it
was still real wasted work, and a future CLI version's vendored pack
could just as easily hit the same "not found in the registry" failure
mode as ql/hotspots did, for the same underlying reason (a `codeql/*: */
dependency that isn't a real resolvable package).
* fix(pin-script): make library-version pinning idempotent across CLI bumps
The pin script previously only matched dependency lines with a literal
'*' value. Once a qlpack.yml dependency got pinned to an exact version
by one run, that regex would never match again on subsequent runs -
meaning every CLI bump after the first would silently fail to re-pin
codeql/* dependencies to the new bundle version, permanently desyncing
.codeqlversion from the actual pins.
Rewrite the match/rewrite logic to match ANY current value for a
recognized codeql/<pkg> dependency (unquoted/quoted '*', or an already-
pinned exact version) and unconditionally overwrite it to the target
bundle version, preserving quote style and trailing comments. Verified
locally against a mock qlpack.yml simulating a post-first-run state: an
existing pinned version and a double-quoted pinned version were both
correctly overwritten to new target versions, while unrelated/unknown
dependencies were left untouched.
Also add the ./codeql/* and */.codeql/* path exclusions to
update-codeql-version.yml's upgrade loop for parity with the pin
script's existing exclusions (defense in depth, per review feedback).
Update CONTRIBUTING.md's two spots describing the pinning step to
reflect this unconditional-overwrite/idempotent behavior instead of
"only rewrites literal *".
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
---------
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
echo"::error::Could not download the CodeQL Bundle for tag '${BUNDLE_TAG}' from github/codeql-action releases.">&2
51
+
echo"Every CLI release published to github/codeql-cli-binaries should have a matching 'codeql-bundle-v<version>' release in github/codeql-action - check that the tag exists.">&2
52
+
exit 1
53
+
fi
54
+
55
+
# List every bundled `codeql/<name>` qlpack and its exact version WITHOUT
56
+
# extracting any file contents - the bundle is large (~500MB) and we only
57
+
# need the directory listing (name + version are encoded in the path).
0 commit comments