opensearch-project / sql-jdbc

This is the driver for JDBC connectivity to a cluster running with OpenSearch SQL support.
Apache License 2.0
14 stars 25 forks source link

Fix CVEs #96

Closed GumpacG closed 1 year ago

GumpacG commented 1 year ago

Description

Issues Resolved

https://github.com/opensearch-project/sql-jdbc/issues/5

Check List

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license. For more information on following Developer Certificate of Origin and signing off your commits, please check here.

Yury-Fridlyand commented 1 year ago

Can you update release notes?

mbg commented 1 year ago

Hi @GumpacG 👋🏻

I work on CodeQL and noticed that you referenced an issue over on the codeql repo, but that isn't quite the same issue you are encountering here. I see that you have a test dependency on org.eclipse.jetty:jetty-server:11.0.14 which is only compatible with Java 11+. Indeed, your Java build CI only builds with Java 11 and 17, but your Gradle build script suggests that Java 8 should be used. (I assume that while your tests require Java 11+, the library part of this project is still happy with Java 8+?)

Rather than pinning the older version of CodeQL and missing out on new features and improvements, I would suggest that you build with Java 11 or 17 in the CodeQL workflow as well. The easiest way to accomplish this would be with a manual build by replacing

    - name: Autobuild
      uses: github/codeql-action/autobuild@v2

with

    - name: Build
      run: |
        ./gradlew --no-daemon -S -Dorg.gradle.dependency.verification=off clean
        ./gradlew --no-daemon -S -Dorg.gradle.dependency.verification=off testClasses

This should give you the same results as with the automatic build, except that the default Java version on the system is used instead of the one that CodeQL infers based on your project configuration. In the case of the GHA runners, the default is currently Java 11.

To further improve the workflow's reliability, I would also recommend adding a setup-java step to explicitly install and make Java 11 the default (or whichever version of Java you would like to use for the CodeQL workflow).

GumpacG commented 1 year ago

I tested and the suggested solution worked. I'll update. Thanks @mbg.