Skip to content

[#263] Set up the JDK of the release for the CodeQL Java analysis, so that its results no longer follow the default JDK of the runner image - #264

Open
vharseko wants to merge 1 commit into
OpenIdentityPlatform:masterfrom
vharseko:fix/263-codeql-jdk
Open

vharseko wants to merge 1 commit into
OpenIdentityPlatform:masterfrom
vharseko:fix/263-codeql-jdk

Conversation

@vharseko

Copy link
Copy Markdown
Member

Fixes #263

Problem

The java-kotlin job of the CodeQL workflow runs with build-mode: none and sets up no JDK. CodeQL infers no JDK from the project (No specific JDK inferred from the project being analysed; using the java on the PATH), so it models the JDK API on the default java of the runner image. On 2026-10-19 ubuntu-latest moved from ubuntu-24.04 to ubuntu-26.04, and that java changed from 17 to 25. Code scanning then opened alerts for APIs deprecated only after Java 17, the version the release is built with. The details are in #263.

Fix

  • Before Initialize CodeQL, the java-kotlin job sets up the JDK that the release is built with, with the actions/setup-java parameters of release.yml: temurin, 8 on sustaining/6.3.x and 17 otherwise. The branch is taken from github.base_ref for a pull request and from github.ref_name for a push.

The other languages do not use the step. The same change for OpenDJ is OpenIdentityPlatform/OpenDJ#1232.

Test

The change only takes effect in a CodeQL run, so the CodeQL run of this PR is the test. The java-kotlin job log must show Java version: 17... from Eclipse Adoptium, where master shows Java version: 25.0.4.1.

A pull request analysis only reports results on the changed lines, so it cannot show the alerts going away. They are closed by the first analysis of master after the merge.

…QL Java analysis, so that its results no longer follow the default JDK of the runner image

Fixes OpenIdentityPlatform#263

With build-mode 'none' CodeQL infers no JDK from the project and models
the JDK API on the java found on the PATH. When ubuntu-latest moved to
ubuntu-26.04 on 2026-10-19 that java became 25 instead of 17, and code
scanning opened alerts for APIs deprecated only after Java 17, the
version the release is built with.

The java-kotlin job now sets up the JDK of the release before Initialize
CodeQL, with the setup-java parameters of release.yml: temurin, 8 on
sustaining/6.3.x and 17 otherwise.
@vharseko vharseko added bug Something isn't working security Security fix / CVE remediation ci CI/CD, build and release workflows labels Oct 22, 2026
@vharseko
vharseko requested a review from maximthomas October 22, 2026 10:29

@maximthomas maximthomas left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

praise: The analysis JDK now comes from the workflow instead of the runner image, and the job log shows it.

  • Set up JDK (.github/workflows/codeql.yml:63-68) runs before Initialize CodeQL, only for java-kotlin, with the actions/setup-java@v6 tag and temurin distribution of release.yml:47-50.
  • Run 39763486253's java-kotlin job logs Setting Java 17.0.20+1 as the default and the extractor's No specific JDK inferred from the project being analysed; using the java on the PATH, the mechanism the description states.
  • JDK 17 carries no @Deprecated on URL(String) or MemoryMXBean.getObjectPendingFinalizationCount() (checked on 17.0.11; 25.0.2 has since="20" / since="18"), so alerts 995-999 have nothing to match under the new model.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working ci CI/CD, build and release workflows security Security fix / CVE remediation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CodeQL: the Java analysis takes its JDK from the runner image, which moved from Java 17 to 25 with ubuntu-26.04

2 participants