From da1dd35774b63d50db3d57a3f39d574767b00ace Mon Sep 17 00:00:00 2001 From: Christoph Kuhnke Date: Tue, 12 Mar 2024 16:24:09 +0100 Subject: [PATCH] Fixed vulnerabilities (#47) * Fixed vulnerabilities Co-authored-by: Christoph Pirkl --- .gitattributes | 9 +- .github/workflows/broken_links_checker.yml | 3 + .github/workflows/ci-build-next-java.yml | 6 + .github/workflows/ci-build.yml | 62 +++++- .github/workflows/dependencies_check.yml | 36 +++- .github/workflows/dependencies_update.yml | 175 ++++++++++++++++ .github/workflows/release.yml | 193 ++++++++++++++++++ ...elease_droid_prepare_original_checksum.yml | 39 ---- .../release_droid_print_quick_checksum.yml | 26 --- ...ase_droid_upload_github_release_assets.yml | 47 ----- dependencies.md | 4 +- doc/changes/changelog.md | 1 + doc/changes/changes_5.0.1.md | 38 ++++ doc/user_guide/mysql_user_guide.md | 2 +- pk_generated_parent.pom | 23 ++- pom.xml | 50 +++-- .../mysql/IntegrationTestConstants.java | 2 +- .../mysql/MySQLScalarFunctionsIT.java | 12 +- .../dialects/mysql/MySQLSqlDialectIT.java | 1 + 19 files changed, 580 insertions(+), 149 deletions(-) create mode 100644 .github/workflows/dependencies_update.yml create mode 100644 .github/workflows/release.yml delete mode 100644 .github/workflows/release_droid_prepare_original_checksum.yml delete mode 100644 .github/workflows/release_droid_print_quick_checksum.yml delete mode 100644 .github/workflows/release_droid_upload_github_release_assets.yml create mode 100644 doc/changes/changes_5.0.1.md diff --git a/.gitattributes b/.gitattributes index c67f857..2353f50 100644 --- a/.gitattributes +++ b/.gitattributes @@ -5,8 +5,7 @@ doc/changes/changelog.md linguist-genera .github/workflows/ci-build.yml linguist-generated=true .github/workflows/ci-build-next-java.yml linguist-generated=true .github/workflows/dependencies_check.yml linguist-generated=true -.github/workflows/release_droid_print_quick_checksum.yml linguist-generated=true -.github/workflows/release_droid_upload_github_release_assets.yml linguist-generated=true -.github/workflows/release_droid_prepare_original_checksum.yml linguist-generated=true -.settings/org.eclipse.jdt.core.prefs linguist-generated=true -.settings/org.eclipse.jdt.ui.prefs linguist-generated=true +.github/workflows/dependencies_update.yml linguist-generated=true +.github/workflows/release.yml linguist-generated=true +.settings/org.eclipse.jdt.core.prefs linguist-generated=true +.settings/org.eclipse.jdt.ui.prefs linguist-generated=true diff --git a/.github/workflows/broken_links_checker.yml b/.github/workflows/broken_links_checker.yml index 0fbcad5..d7a38b4 100644 --- a/.github/workflows/broken_links_checker.yml +++ b/.github/workflows/broken_links_checker.yml @@ -13,6 +13,9 @@ on: jobs: linkChecker: runs-on: ubuntu-latest + defaults: + run: + shell: "bash" concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true diff --git a/.github/workflows/ci-build-next-java.yml b/.github/workflows/ci-build-next-java.yml index e3acdb7..8886e10 100644 --- a/.github/workflows/ci-build-next-java.yml +++ b/.github/workflows/ci-build-next-java.yml @@ -10,6 +10,12 @@ on: jobs: java-17-compatibility: runs-on: ubuntu-latest + defaults: + run: + shell: "bash" + permissions: + contents: read + checks: write # Allow scacap/action-surefire-report concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true diff --git a/.github/workflows/ci-build.yml b/.github/workflows/ci-build.yml index 76adff4..e847dc0 100644 --- a/.github/workflows/ci-build.yml +++ b/.github/workflows/ci-build.yml @@ -3,13 +3,18 @@ name: CI Build on: push: - branches: - - main + branches: ["main"] pull_request: jobs: matrix-build: runs-on: ubuntu-20.04 + defaults: + run: + shell: "bash" + permissions: + contents: read + checks: write # Allow scacap/action-surefire-report concurrency: group: ${{ github.workflow }}-${{ github.ref }}-${{ matrix.exasol_db_version }} cancel-in-progress: true @@ -38,7 +43,7 @@ jobs: 17 cache: "maven" - name: Cache SonarCloud packages - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: ~/.sonar/cache key: ${{ runner.os }}-sonar @@ -46,6 +51,7 @@ jobs: - name: Enable testcontainer reuse run: echo 'testcontainers.reuse.enable=true' > "$HOME/.testcontainers.properties" - name: Run tests and build with Maven + id: pk-verify run: | mvn --batch-mode clean verify \ -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn \ @@ -71,8 +77,58 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + - name: Verify Release Artifacts + run: | + print_message() { + local -r message=$1 + echo "$message" + echo "$message" >> "$GITHUB_STEP_SUMMARY" + } + + print_message "# Release Artifacts" + + IFS=$'\n' artifacts_array=($ARTIFACTS) + missing_files=() + for file in "${artifacts_array[@]}"; + do + echo "Checking if file $file exists..." + if ! [[ -f "$file" ]]; then + print_message "* ⚠️ \`$file\` does not exist ⚠️" + echo "Content of directory $(dirname "$file"):" + ls "$(dirname "$file")" + missing_files+=("$file") + else + print_message "* \`$file\` ✅" + fi + done + print_message "" + number_of_missing_files=${#missing_files[@]} + if [[ $number_of_missing_files -gt 0 ]]; then + print_message "⚠️ $number_of_missing_files release artifact(s) missing ⚠️" + exit 1 + else + print_message "All ${#artifacts_array[@]} artifact(s) present ✅" + fi + env: + ARTIFACTS: ${{ steps.pk-verify.outputs.release-artifacts }} + build: needs: matrix-build runs-on: ubuntu-latest steps: - run: echo "Build successful" + + # [impl->dsn~release-workflow.ci-build-starts-release~1] + start_release: + needs: build + if: ${{ github.ref == 'refs/heads/main' }} + concurrency: + cancel-in-progress: false + group: "release" + secrets: inherit + permissions: + contents: write + actions: read + uses: ./.github/workflows/release.yml + with: + started-from-ci: true diff --git a/.github/workflows/dependencies_check.yml b/.github/workflows/dependencies_check.yml index 87b64ba..bd26ab6 100644 --- a/.github/workflows/dependencies_check.yml +++ b/.github/workflows/dependencies_check.yml @@ -1,6 +1,6 @@ # Generated by Project Keeper # https://github.com/exasol/project-keeper/blob/main/project-keeper/src/main/resources/templates/.github/workflows/dependencies_check.yml -name: Report Security Issues for Repository +name: Report Security Issues on: workflow_dispatch: schedule: @@ -9,11 +9,17 @@ on: jobs: report_security_issues: runs-on: ubuntu-latest + defaults: + run: + shell: "bash" permissions: + contents: read issues: write - + outputs: + created-issues: ${{ steps.security-issues.outputs.created-issues }} steps: - uses: actions/checkout@v4 + - name: Set up JDKs uses: actions/setup-java@v4 with: @@ -25,14 +31,38 @@ jobs: - name: Generate ossindex report run: | - mvn org.sonatype.ossindex.maven:ossindex-maven-plugin:audit \ + mvn --batch-mode org.sonatype.ossindex.maven:ossindex-maven-plugin:audit \ org.sonatype.ossindex.maven:ossindex-maven-plugin:audit-aggregate \ -Dossindex.reportFile=$(pwd)/ossindex-report.json \ -Dossindex.fail=false - name: Report Security Issues + id: security-issues uses: exasol/python-toolbox/.github/actions/security-issues@main with: format: "maven" command: "cat ossindex-report.json" github-token: ${{ secrets.GITHUB_TOKEN }} + + - name: Output security issues (Debugging) + run: | + echo "$CREATED_ISSUES" > test.jsonl + cat test.jsonl + env: + CREATED_ISSUES: ${{ steps.security-issues.outputs.created-issues }} + + start_dependency_udpate: + needs: report_security_issues + # [impl->dsn~trigger-dependency-updates~1] + if: ${{ needs.report_security_issues.outputs.created-issues }} + concurrency: + cancel-in-progress: true + group: "dependencies_update" + # Workflow needs secret INTEGRATION_TEAM_SLACK_NOTIFICATION_WEBHOOK + secrets: inherit + permissions: + contents: write + pull-requests: write + uses: ./.github/workflows/dependencies_update.yml + with: + vulnerability_issues: ${{ needs.report_security_issues.outputs.created-issues }} diff --git a/.github/workflows/dependencies_update.yml b/.github/workflows/dependencies_update.yml new file mode 100644 index 0000000..0f6b816 --- /dev/null +++ b/.github/workflows/dependencies_update.yml @@ -0,0 +1,175 @@ +# Generated by Project Keeper +# https://github.com/exasol/project-keeper/blob/main/project-keeper/src/main/resources/templates/.github/workflows/dependencies_update.yml +name: Update dependencies +on: + workflow_call: + inputs: + # [impl->dsn~dependency-updater.workflow.vulnerability-info~1] + vulnerability_issues: + description: "GitHub issues for vulnerable dependencies as JSONL" + required: true + type: string + workflow_dispatch: + +jobs: + update_dependencies: + runs-on: ubuntu-latest + defaults: + run: + shell: "bash" + permissions: + contents: write + pull-requests: write + + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Set up JDKs + uses: actions/setup-java@v4 + with: + distribution: "temurin" + java-version: | + 11 + 17 + cache: "maven" + + - name: Print issues + run: | + echo "Issues from Action input: $ISSUES" + env: + ISSUES: ${{ inputs.vulnerability_issues }} + + - name: Fail if not running on a branch + if: ${{ !startsWith(github.ref, 'refs/heads/') }} + uses: actions/github-script@v7 + with: + script: | + core.setFailed('Not running on a branch, github.ref is ${{ github.ref }}. Please start this workflow only on main or a branch') + + - name: Update dependencies + # [impl->dsn~dependency-updater.workflow.start-pk-update~1] + run: | + mvn --batch-mode com.exasol:project-keeper-maven-plugin:update-dependencies --projects . \ + -Dproject-keeper:vulnerabilities="$CREATED_ISSUES" + env: + CREATED_ISSUES: ${{ inputs.vulnerability_issues }} + + - name: Project Keeper Fix + run: | + mvn --batch-mode com.exasol:project-keeper-maven-plugin:fix --projects . + + - name: Project Keeper Fix for updated Project Keeper version + # Calling PK fix a second time is necessary because the first invocation potentially updated PK itself. + # So we need to run PK fix again with the latest PK version. + # [impl->dsn~dependency-updater.workflow.start-pk-fix~1] + run: | + mvn --batch-mode com.exasol:project-keeper-maven-plugin:fix --projects . + + - name: Generate Pull Request comment + id: pr-comment + # [impl->dsn~dependency-updater.workflow.create-pull-request~1] + # [impl->dsn~dependency-updater.workflow.pull-request-trigger-ci-build~1] + run: | + echo 'comment<> "$GITHUB_OUTPUT" + echo 'This Pull Request was created by [`dependencies_update.yml`](https://github.com/exasol/project-keeper/blob/main/project-keeper/src/main/resources/templates/.github/workflows/dependencies_update.yml) workflow.' >> "$GITHUB_OUTPUT" + if [ -n "$CREATED_ISSUES" ]; then + echo 'It updates dependencies to fix the following vulnerabilities:' >> "$GITHUB_OUTPUT" + echo $CREATED_ISSUES | jq --raw-output '. | "* Closes " + .issue_url + " (" + .cve + ")"' >> "$GITHUB_OUTPUT" + else + echo 'It updates dependencies.' >> "$GITHUB_OUTPUT" + fi + echo >> "$GITHUB_OUTPUT" + echo '# ⚠️ This PR does not trigger CI workflows by default ⚠️' >> "$GITHUB_OUTPUT" + echo 'Please click the **Close pull request** button and then **Reopen pull request** to trigger running checks.' >> "$GITHUB_OUTPUT" + echo 'See https://github.com/exasol/project-keeper/issues/534 for details.' >> "$GITHUB_OUTPUT" + echo 'EOF' >> "$GITHUB_OUTPUT" + + cat "$GITHUB_OUTPUT" + env: + CREATED_ISSUES: ${{ inputs.vulnerability_issues }} + + - name: Generate Pull Request Title + id: pr-title + run: | + if [ -n "$CREATED_ISSUES" ]; then + echo "Security issues are available" + echo "title=🔐 Update dependencies to fix vulnerabilities" >> "$GITHUB_OUTPUT" + else + echo "Security issues are not available" + echo "title=Update dependencies" >> "$GITHUB_OUTPUT" + fi + + cat "$GITHUB_OUTPUT" + env: + CREATED_ISSUES: ${{ inputs.vulnerability_issues }} + + - name: Configure git + run: | + git config --global user.email "opensource@exasol.com" + git config --global user.name "Automatic Dependency Updater" + + - name: Create branch + if: ${{ github.ref == 'refs/heads/main' }} + run: | + branch_name="dependency-update/$(date "+%Y%m%d%H%M%S")" + echo "Creating branch $branch_name" + git checkout -b "$branch_name" + + - name: Commit changes & push + if: ${{ startsWith(github.ref, 'refs/heads/' ) }} + run: | + branch_name=$(git rev-parse --abbrev-ref HEAD) + echo "Current branch: $branch_name" + echo "git diff --stat" + git diff --stat + echo "git diff --numstat" + git diff --numstat + echo "git diff --name-status" + git diff --name-status + echo "Adding untracked files:" + git add . --verbose --all + echo "Committing changes..." + git commit --message "$TITLE" + echo "Pushing branch $branch_name..." + git push --set-upstream origin "$branch_name" + echo "Done." + env: + TITLE: ${{ steps.pr-title.outputs.title }} + + - name: Create pull request + id: create-pr + if: ${{ github.ref == 'refs/heads/main' }} + run: | + pr_url=$(gh pr create --base main --title "$TITLE" --body "$COMMENT") + echo "Created Pull Request: $pr_url" + echo "pr_url=$pr_url" >> "$GITHUB_OUTPUT" + env: + COMMENT: ${{ steps.pr-comment.outputs.comment }} + TITLE: ${{ steps.pr-title.outputs.title }} + GH_TOKEN: ${{ github.token }} + + - name: Report failure Status to Slack channel + # Also run this step in case of failures + if: ${{ always() }} + uses: ravsamhq/notify-slack-action@v2 + with: + status: ${{ job.status }} + token: ${{ secrets.GITHUB_TOKEN }} + notification_title: "Dependency check in {repo} has {status_message}" + message_format: "{emoji} *{workflow}* {status_message} in <{repo_url}|{repo}>" + notify_when: "failure,cancelled,warnings" + env: + SLACK_WEBHOOK_URL: ${{ secrets.INTEGRATION_TEAM_SLACK_NOTIFICATION_WEBHOOK }} + + - name: Report new Pull Request to Slack channel + if: ${{ steps.create-pr.outputs.pr_url }} + uses: ravsamhq/notify-slack-action@v2 + with: + status: ${{ job.status }} + token: ${{ secrets.GITHUB_TOKEN }} + notification_title: "Dependency update for {repo} created a Pull Request" + message_format: "{workflow} created Pull Request ${{ steps.create-pr.outputs.pr_url }}" + env: + SLACK_WEBHOOK_URL: ${{ secrets.INTEGRATION_TEAM_SLACK_NOTIFICATION_WEBHOOK }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..7a2dc9c --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,193 @@ +# Generated by Project Keeper +# https://github.com/exasol/project-keeper/blob/main/project-keeper/src/main/resources/templates/.github/workflows/release.yml +name: Release +on: + # [impl->dsn~release-workflow.triggers~1] + workflow_call: + inputs: + started-from-ci: + description: "Marks this release as started from CI, skipping precondition check" + type: boolean + required: true + default: false + workflow_dispatch: + inputs: + skip-maven-central: + description: "Skip deployment to Maven Central" + required: true + type: boolean + default: false + skip-github-release: + description: "Skip creating the GitHub release" + required: true + type: boolean + default: false + +jobs: + release: + runs-on: ubuntu-latest + defaults: + run: + shell: "bash" + concurrency: + group: ${{ github.workflow }} + cancel-in-progress: false + permissions: + contents: write + actions: read + steps: + - name: Checkout the repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Set up Maven Central Repository + if: ${{ false }} + uses: actions/setup-java@v4 + with: + distribution: "temurin" + java-version: | + 11 + 17 + cache: "maven" + server-id: ossrh + server-username: MAVEN_USERNAME + server-password: MAVEN_PASSWORD + gpg-private-key: ${{ secrets.OSSRH_GPG_SECRET_KEY }} + gpg-passphrase: MAVEN_GPG_PASSPHRASE + - name: Set up JDKs + if: ${{ ! false }} + uses: actions/setup-java@v4 + with: + distribution: "temurin" + java-version: | + 11 + 17 + cache: "maven" + + # Check preconditions + + - name: Fail if not running on main branch + if: ${{ github.ref != 'refs/heads/main' }} + uses: actions/github-script@v7 + with: + script: | + core.setFailed('Not running on main branch, github.ref is ${{ github.ref }}. Please start this workflow only on main') + + # [impl->dsn~release-workflow.verify-ci-build-success~1] + - name: Check CI build of this commit succeeded + # We skip this check if this was started from ci-build.yml, because the build status would be "in progress". + if: ${{ ! inputs.started-from-ci }} + run: | + echo "Commit SHA: $COMMIT_SHA" + gh run list --workflow ci-build.yml --branch main --event push --commit $COMMIT_SHA + ci_build_status=$(gh run list --workflow ci-build.yml --branch main --event push --commit $COMMIT_SHA --json conclusion --template '{{range .}}{{.conclusion}}{{"\n"}}{{end}}') + echo "CI build status at commit $COMMIT_SHA was '$ci_build_status'" + if [[ "$ci_build_status" != "success" ]]; then + gh run list --workflow ci-build.yml --commit $COMMIT_SHA >> $GITHUB_STEP_SUMMARY + echo "Status of CI build for commit $COMMIT_SHA was '$ci_build_status', expected 'success'" >> $GITHUB_STEP_SUMMARY + cat $GITHUB_STEP_SUMMARY + exit 1 + fi + env: + COMMIT_SHA: ${{ github.sha }} + GH_TOKEN: ${{ github.token }} + # [impl->dsn~release-workflow.run-verify-release~1] + - name: Verify release preconditions + id: verify-release + run: | + mvn --batch-mode com.exasol:project-keeper-maven-plugin:verify-release --projects . + echo "$GITHUB_OUTPUT" + env: + GITHUB_TOKEN: ${{ github.token }} + # [impl->dsn~release-workflow.verify-skip-tests~1] + - name: Build project + run: mvn --batch-mode -DskipTests clean verify + + # Maven Central Deployment + - name: List secret GPG keys + if: ${{ false && (! inputs.skip-maven-central) }} + run: gpg --list-secret-keys + # [impl->dsn~release-workflow.deploy-maven-central~1] + - name: Publish to Central Repository + if: ${{ false && (! inputs.skip-maven-central) }} + run: | + mvn --batch-mode -Dgpg.skip=false -DskipTests deploy + echo "Published to Maven Central" >> "$GITHUB_STEP_SUMMARY" + env: + MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }} + MAVEN_PASSWORD: ${{ secrets.OSSRH_PASSWORD }} + MAVEN_GPG_PASSPHRASE: ${{ secrets.OSSRH_GPG_SECRET_KEY_PASSWORD }} + + # Create GitHub releasse + + - name: Calculate Artifact Checksums + id: artifact-checksum + if: ${{ ! inputs.skip-github-release }} + run: | + ls target/ + echo "Calculating sha256 checksum for artifact files" + echo "artifacts<> "$GITHUB_OUTPUT" + IFS=$'\n' artifacts_array=($ARTIFACTS) + for file in "${artifacts_array[@]}"; + do + full_path=$(realpath "$file") + echo "Calculate sha256sum for file '$full_path'" + file_dir="$(dirname "$full_path")" + file_name=$(basename "$full_path") + pushd "$file_dir" + checksum_file_name="${file_name}.sha256" + sha256sum "$file_name" > "$checksum_file_name" + echo "$full_path" >> "$GITHUB_OUTPUT" + echo "${file_dir}/$checksum_file_name" >> "$GITHUB_OUTPUT" + popd + done + echo "EOF" >> "$GITHUB_OUTPUT" + echo "Full artifact file list" + cat "$GITHUB_OUTPUT" + env: + ARTIFACTS: ${{ steps.verify-release.outputs.release-artifacts }} + + # [impl->dsn~release-workflow.create-github-release~1] + - name: Create GitHub Release + id: create-github-release + if: ${{ ! inputs.skip-github-release }} + run: | + IFS=$'\n' artifacts_array=($ARTIFACTS) + for file in "${artifacts_array[@]}"; + do + echo "Attaching file '$file'" + done + release_url=$(gh release create --draft --latest --title "$TITLE" --notes "$NOTES" --target main $TAG "${artifacts_array[@]}") + echo "Created release $TAG with title '$TITLE' at $release_url" >> "$GITHUB_STEP_SUMMARY" + echo "release-url=$release_url" >> "$GITHUB_OUTPUT" + git fetch --tags origin + env: + GH_TOKEN: ${{ github.token }} + TAG: ${{ steps.verify-release.outputs.version }} + NOTES: ${{ steps.verify-release.outputs.release-notes }} + TITLE: ${{ steps.verify-release.outputs.release-title }} + ARTIFACTS: ${{ steps.artifact-checksum.outputs.artifacts }} + + - name: Report failure Status to Slack channel + # Also run this step in case of failures + if: ${{ always() }} + uses: ravsamhq/notify-slack-action@v2 + with: + status: ${{ job.status }} + token: ${{ github.token }} + notification_title: "Release build in {repo} has {status_message}" + message_format: "{emoji} *{workflow}* {status_message} in <{repo_url}|{repo}>" + notify_when: "failure,cancelled,warnings,skipped" + env: + SLACK_WEBHOOK_URL: ${{ secrets.INTEGRATION_TEAM_SLACK_NOTIFICATION_WEBHOOK }} + + - name: Report new release to Slack channel + if: ${{ steps.create-github-release.outputs.release-url }} + uses: ravsamhq/notify-slack-action@v2 + with: + status: ${{ job.status }} + token: ${{ github.token }} + notification_title: "Release build for {repo} created a new release" + message_format: "{workflow} created release ${{ steps.create-github-release.outputs.release-url }}" + env: + SLACK_WEBHOOK_URL: ${{ secrets.INTEGRATION_TEAM_SLACK_NOTIFICATION_WEBHOOK }} diff --git a/.github/workflows/release_droid_prepare_original_checksum.yml b/.github/workflows/release_droid_prepare_original_checksum.yml deleted file mode 100644 index 413274b..0000000 --- a/.github/workflows/release_droid_prepare_original_checksum.yml +++ /dev/null @@ -1,39 +0,0 @@ -# Generated by Project Keeper -# https://github.com/exasol/project-keeper/blob/main/project-keeper/src/main/resources/templates/.github/workflows/release_droid_prepare_original_checksum.yml -name: Release Droid - Prepare Original Checksum -on: - workflow_dispatch: - -jobs: - build: - runs-on: ubuntu-20.04 - steps: - - name: Free Disk Space - if: ${{ false }} - run: | - sudo rm -rf /usr/local/lib/android - sudo rm -rf /usr/share/dotnet - - name: Checkout the repository - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - name: Set up JDKs - uses: actions/setup-java@v4 - with: - distribution: "temurin" - java-version: | - 11 - 17 - cache: "maven" - - name: Enable testcontainer reuse - run: echo 'testcontainers.reuse.enable=true' > "$HOME/.testcontainers.properties" - - name: Run tests and build with Maven - run: mvn --batch-mode clean verify --file pom.xml - - name: Prepare checksum - run: find target -maxdepth 1 -name *.jar -exec sha256sum "{}" + > original_checksum - - name: Upload checksum to the artifactory - uses: actions/upload-artifact@v3 - with: - name: original_checksum - retention-days: 5 - path: original_checksum diff --git a/.github/workflows/release_droid_print_quick_checksum.yml b/.github/workflows/release_droid_print_quick_checksum.yml deleted file mode 100644 index 86979cd..0000000 --- a/.github/workflows/release_droid_print_quick_checksum.yml +++ /dev/null @@ -1,26 +0,0 @@ -# Generated by Project Keeper -# https://github.com/exasol/project-keeper/blob/main/project-keeper/src/main/resources/templates/.github/workflows/release_droid_print_quick_checksum.yml -name: Release Droid - Print Quick Checksum -on: - workflow_dispatch: - -jobs: - build: - runs-on: ubuntu-latest - steps: - - name: Checkout the repository - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - name: Set up JDKs - uses: actions/setup-java@v4 - with: - distribution: "temurin" - java-version: | - 11 - 17 - cache: "maven" - - name: Build with Maven skipping tests - run: mvn --batch-mode clean verify -DskipTests - - name: Print checksum - run: echo 'checksum_start==';find target -maxdepth 1 -name *.jar -exec sha256sum "{}" + | xargs;echo '==checksum_end' diff --git a/.github/workflows/release_droid_upload_github_release_assets.yml b/.github/workflows/release_droid_upload_github_release_assets.yml deleted file mode 100644 index b19f7cf..0000000 --- a/.github/workflows/release_droid_upload_github_release_assets.yml +++ /dev/null @@ -1,47 +0,0 @@ -# Generated by Project Keeper -# https://github.com/exasol/project-keeper/blob/main/project-keeper/src/main/resources/templates/.github/workflows/release_droid_upload_github_release_assets.yml -name: Release Droid - Upload GitHub Release Assets -on: - workflow_dispatch: - inputs: - upload_url: - description: "Assets upload URL" - required: true - -jobs: - build: - runs-on: ubuntu-latest - steps: - - name: Checkout the repository - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - name: Set up JDKs - uses: actions/setup-java@v4 - with: - distribution: "temurin" - java-version: | - 11 - 17 - cache: "maven" - - name: Build with Maven skipping tests - run: mvn --batch-mode clean verify -DskipTests - - name: Generate sha256sum files - run: | - cd target - find . -maxdepth 1 -name \*.jar -exec bash -c 'sha256sum {} > {}.sha256' \; - - name: Upload assets to the GitHub release draft - uses: shogo82148/actions-upload-release-asset@v1 - with: - upload_url: ${{ github.event.inputs.upload_url }} - asset_path: target/*.jar - - name: Upload sha256sum files - uses: shogo82148/actions-upload-release-asset@v1 - with: - upload_url: ${{ github.event.inputs.upload_url }} - asset_path: target/*.sha256 - - name: Upload error-code-report - uses: shogo82148/actions-upload-release-asset@v1 - with: - upload_url: ${{ github.event.inputs.upload_url }} - asset_path: target/error_code_report.json diff --git a/dependencies.md b/dependencies.md index fdca9b0..8380b6d 100644 --- a/dependencies.md +++ b/dependencies.md @@ -14,7 +14,7 @@ | [Virtual Schema Common JDBC][0] | [MIT License][1] | | [Hamcrest][2] | [BSD License 3][3] | | [JUnit Jupiter (Aggregator)][4] | [Eclipse Public License v2.0][5] | -| [mockito-junit-jupiter][6] | [The MIT License][7] | +| [mockito-junit-jupiter][6] | [MIT][7] | | [Test containers for Exasol on Docker][8] | [MIT License][9] | | [Testcontainers :: JUnit Jupiter Extension][10] | [MIT][11] | | [Testcontainers :: JDBC :: MySQL][10] | [MIT][11] | @@ -57,7 +57,7 @@ [4]: https://junit.org/junit5/ [5]: https://www.eclipse.org/legal/epl-v20.html [6]: https://github.com/mockito/mockito -[7]: https://github.com/mockito/mockito/blob/main/LICENSE +[7]: https://opensource.org/licenses/MIT [8]: https://github.com/exasol/exasol-testcontainers/ [9]: https://github.com/exasol/exasol-testcontainers/blob/main/LICENSE [10]: https://java.testcontainers.org diff --git a/doc/changes/changelog.md b/doc/changes/changelog.md index d5038e4..fd10a7a 100644 --- a/doc/changes/changelog.md +++ b/doc/changes/changelog.md @@ -1,5 +1,6 @@ # Changes +* [5.0.1](changes_5.0.1.md) * [5.0.0](changes_5.0.0.md) * [4.1.3](changes_4.1.3.md) * [4.1.2](changes_4.1.2.md) diff --git a/doc/changes/changes_5.0.1.md b/doc/changes/changes_5.0.1.md new file mode 100644 index 0000000..0c8ba38 --- /dev/null +++ b/doc/changes/changes_5.0.1.md @@ -0,0 +1,38 @@ +# Virtual Schema for MySQL 5.0.1, released 2024-03-12 + +Code name: Fixed vulnerabilities CVE-2024-25710 and CVE-2024-26308 in test dependencies + +## Summary + +This is a security release in which we updated test dependency `com.exasol:exasol-test-setup-abstraction-java` to fix vulnerabilities CVE-2024-25710 and CVE-2024-26308 in its transitive dependencies. + +## Security + +* #45: Fixed vulnerability CVE-2024-25710 +* #46: Fixed vulnerability CVE-2024-26308 + +## Dependency Updates + +### Test Dependency Updates + +* Updated `com.exasol:exasol-testcontainers:6.6.2` to `7.0.1` +* Updated `com.exasol:hamcrest-resultset-matcher:1.6.1` to `1.6.5` +* Updated `com.exasol:test-db-builder-java:3.5.1` to `3.5.2` +* Updated `com.exasol:udf-debugging-java:0.6.11` to `0.6.12` +* Updated `com.exasol:virtual-schema-shared-integration-tests:2.2.5` to `3.0.0` +* Updated `com.google.protobuf:protobuf-java:3.24.3` to `3.25.3` +* Updated `com.mysql:mysql-connector-j:8.2.0` to `8.3.0` +* Updated `org.junit.jupiter:junit-jupiter:5.10.0` to `5.10.2` +* Updated `org.mockito:mockito-junit-jupiter:5.5.0` to `5.11.0` +* Updated `org.slf4j:slf4j-jdk14:2.0.9` to `2.0.12` +* Updated `org.testcontainers:junit-jupiter:1.19.0` to `1.19.7` +* Updated `org.testcontainers:mysql:1.19.0` to `1.19.7` + +### Plugin Dependency Updates + +* Updated `com.exasol:error-code-crawler-maven-plugin:1.3.1` to `2.0.1` +* Updated `com.exasol:project-keeper-maven-plugin:3.0.0` to `4.2.0` +* Updated `org.apache.maven.plugins:maven-compiler-plugin:3.11.0` to `3.12.1` +* Updated `org.apache.maven.plugins:maven-failsafe-plugin:3.2.3` to `3.2.5` +* Updated `org.apache.maven.plugins:maven-surefire-plugin:3.2.3` to `3.2.5` +* Updated `org.codehaus.mojo:flatten-maven-plugin:1.5.0` to `1.6.0` diff --git a/doc/user_guide/mysql_user_guide.md b/doc/user_guide/mysql_user_guide.md index d5db1fe..c83d0da 100644 --- a/doc/user_guide/mysql_user_guide.md +++ b/doc/user_guide/mysql_user_guide.md @@ -43,7 +43,7 @@ The SQL statement below creates the adapter script, defines the Java class that --/ CREATE OR REPLACE JAVA ADAPTER SCRIPT SCHEMA_FOR_VS_SCRIPT.ADAPTER_SCRIPT_MYSQL AS %scriptclass com.exasol.adapter.RequestDispatcher; - %jar /buckets/bfsdefault/default/virtual-schema-dist-12.0.0-mysql-5.0.0.jar; + %jar /buckets/bfsdefault/default/virtual-schema-dist-12.0.0-mysql-5.0.1.jar; %jar /buckets/bfsdefault/default/mysql-connector-java-.jar; / ; diff --git a/pk_generated_parent.pom b/pk_generated_parent.pom index 0f85b08..1012356 100644 --- a/pk_generated_parent.pom +++ b/pk_generated_parent.pom @@ -3,7 +3,7 @@ 4.0.0 com.exasol mysql-virtual-schema-generated-parent - 5.0.0 + 5.0.1 pom UTF-8 @@ -71,7 +71,7 @@ org.apache.maven.plugins maven-compiler-plugin - 3.11.0 + 3.12.1 ${java.version} ${java.version} @@ -109,7 +109,7 @@ org.codehaus.mojo flatten-maven-plugin - 1.5.0 + 1.6.0 true oss @@ -148,7 +148,7 @@ org.apache.maven.plugins maven-surefire-plugin - 3.2.3 + 3.2.5 @@ -172,6 +172,17 @@ file:///${project.basedir}/versionsMavenPluginRules.xml + false + true + true + true + false + true + true + true + false + true + true @@ -272,7 +283,7 @@ org.apache.maven.plugins maven-failsafe-plugin - 3.2.3 + 3.2.5 -Djava.util.logging.config.file=src/test/resources/logging.properties ${argLine} @@ -341,7 +352,7 @@ com.exasol error-code-crawler-maven-plugin - 1.3.1 + 2.0.1 verify diff --git a/pom.xml b/pom.xml index cd89e8f..fa00dde 100644 --- a/pom.xml +++ b/pom.xml @@ -2,19 +2,20 @@ 4.0.0 mysql-virtual-schema - 5.0.0 + 5.0.1 Virtual Schema for MySQL Virtual Schema for MySQL https://github.com/exasol/mysql-virtual-schema/ 12.0.0 - 1.19.0 + 1.19.7 com.exasol virtual-schema-common-jdbc ${vscjdbc.version} + jar @@ -33,20 +34,20 @@ org.junit.jupiter junit-jupiter - 5.10.0 + 5.10.2 test org.mockito mockito-junit-jupiter - 5.5.0 + 5.11.0 test com.exasol exasol-testcontainers - 6.6.2 + 7.0.1 test @@ -64,44 +65,44 @@ com.mysql mysql-connector-j - 8.2.0 + 8.3.0 test com.google.protobuf protobuf-java - 3.24.3 + 3.25.3 test com.exasol test-db-builder-java - 3.5.1 + 3.5.2 test com.exasol hamcrest-resultset-matcher - 1.6.1 + 1.6.5 test com.exasol virtual-schema-shared-integration-tests - 2.2.5 + 3.0.0 test com.exasol udf-debugging-java - 0.6.11 + 0.6.12 test org.slf4j slf4j-jdk14 - 2.0.9 + 2.0.12 test @@ -126,6 +127,16 @@ + + org.apache.maven.plugins + maven-compiler-plugin + + + -Xlint:all + -Werror + + + org.apache.maven.plugins maven-assembly-plugin @@ -136,7 +147,7 @@ com.exasol project-keeper-maven-plugin - 3.0.0 + 4.2.0 @@ -152,12 +163,23 @@ false + + org.codehaus.mojo + versions-maven-plugin + + + + com.exasol:test-db-builder-java:jar:*:* + + + mysql-virtual-schema-generated-parent com.exasol - 5.0.0 + 5.0.1 pk_generated_parent.pom diff --git a/src/test/java/com/exasol/adapter/dialects/mysql/IntegrationTestConstants.java b/src/test/java/com/exasol/adapter/dialects/mysql/IntegrationTestConstants.java index bdf5ce1..de8e74a 100644 --- a/src/test/java/com/exasol/adapter/dialects/mysql/IntegrationTestConstants.java +++ b/src/test/java/com/exasol/adapter/dialects/mysql/IntegrationTestConstants.java @@ -3,7 +3,7 @@ import java.nio.file.Path; public final class IntegrationTestConstants { - public static final String VIRTUAL_SCHEMAS_JAR_NAME_AND_VERSION = "virtual-schema-dist-12.0.0-mysql-5.0.0.jar"; + public static final String VIRTUAL_SCHEMAS_JAR_NAME_AND_VERSION = "virtual-schema-dist-12.0.0-mysql-5.0.1.jar"; public static final String MYSQL_DOCKER_IMAGE_REFERENCE = "mysql:8.2.0"; public static final Path PATH_TO_VIRTUAL_SCHEMAS_JAR = Path.of("target", VIRTUAL_SCHEMAS_JAR_NAME_AND_VERSION); public static final String SCHEMA_EXASOL = "SCHEMA_EXASOL"; diff --git a/src/test/java/com/exasol/adapter/dialects/mysql/MySQLScalarFunctionsIT.java b/src/test/java/com/exasol/adapter/dialects/mysql/MySQLScalarFunctionsIT.java index d160d6f..d6faece 100644 --- a/src/test/java/com/exasol/adapter/dialects/mysql/MySQLScalarFunctionsIT.java +++ b/src/test/java/com/exasol/adapter/dialects/mysql/MySQLScalarFunctionsIT.java @@ -23,6 +23,14 @@ public class MySQLScalarFunctionsIT extends ScalarFunctionsTestBase { private static final MySQLVirtualSchemaIntegrationTestSetup SETUP = new MySQLVirtualSchemaIntegrationTestSetup(); + @Override + protected void beforeAllSetup() throws SQLException { + } + + @Override + protected void afterAllTeardown() throws SQLException { + } + @BeforeAll static void beforeAll() { TimeZone.setDefault(TimeZone.getTimeZone("UTC")); @@ -63,13 +71,13 @@ private static class MySqlTestSetup implements TestSetup { private final MySqlObjectFactory mySqlFactory; public MySqlTestSetup() { - mySqlFactory = SETUP.getMySqlObjectFactory(); + this.mySqlFactory = SETUP.getMySqlObjectFactory(); } @Override public VirtualSchemaTestSetupProvider getVirtualSchemaTestSetupProvider() { return (final CreateVirtualSchemaTestSetupRequest request) -> { - final Schema mySqlSchema = mySqlFactory.createSchema(getUniqueIdentifier()); + final Schema mySqlSchema = this.mySqlFactory.createSchema(getUniqueIdentifier()); for (final TableRequest tableRequest : request.getTableRequests()) { final Table.Builder tableBuilder = mySqlSchema.createTableBuilder(tableRequest.getName()); for (final Column column : tableRequest.getColumns()) { diff --git a/src/test/java/com/exasol/adapter/dialects/mysql/MySQLSqlDialectIT.java b/src/test/java/com/exasol/adapter/dialects/mysql/MySQLSqlDialectIT.java index 59cd90c..15d76e4 100644 --- a/src/test/java/com/exasol/adapter/dialects/mysql/MySQLSqlDialectIT.java +++ b/src/test/java/com/exasol/adapter/dialects/mysql/MySQLSqlDialectIT.java @@ -220,6 +220,7 @@ private void createMySqlTableContainingCharAndEnumWithCharacterSet(final String } private static MySqlSchema getSchemaWithCharacterSet(final String schemaName, final String characterSet) { + // See https://github.com/exasol/test-db-builder-java/issues/134 return new MySqlSchema(SETUP.getTableWriterWithCharacterSet(characterSet), MySQLIdentifier.of(schemaName)); }