diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 00000000..e3824ae7 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,26 @@ +# The contents of this file are subject to the terms of the Common Development and +# Distribution License (the License). You may not use this file except in compliance with the +# License. +# +# You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the +# specific language governing permission and limitations under the License. +# +# When distributing Covered Software, include this CDDL Header Notice in each file and include +# the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL +# Header, with the fields enclosed by brackets [] replaced by your own identifying +# information: "Portions copyright [year] [name of copyright owner]". +# +# Copyright 2026 3A Systems, LLC. + +# Keeps the commit-pinned third-party actions in .github/workflows current; +# without this the pins would silently fall behind. +version: 2 +updates: + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "weekly" + groups: + github-actions: + patterns: + - "*" diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 510c5188..551e7b4d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -20,6 +20,12 @@ on: concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true + +# Nothing here writes to the repository: the Docker jobs push to a local +# registry only. +permissions: + contents: read + jobs: build-maven: runs-on: ${{ matrix.os }} @@ -41,17 +47,17 @@ jobs: java: '26' fail-fast: false steps: - - uses: actions/checkout@v6 + - uses: actions/checkout@v7 with: fetch-depth: 0 submodules: recursive - name: Java ${{ matrix.Java }} (${{ matrix.os }}) - uses: actions/setup-java@v5 + uses: actions/setup-java@v6 with: java-version: ${{ matrix.java }} distribution: 'zulu' - name: Cache Maven packages - uses: actions/cache@v5 + uses: actions/cache@v6 with: path: ~/.m2/repository key: ${{ runner.os }}-m2-repository-${{ hashFiles('**/pom.xml') }} @@ -94,7 +100,7 @@ jobs: findstr "ConnectorServer listening on" openicf\logs\ConnectorServer.log findstr " ERROR " openicf\logs\ConnectorServer.log | find /c '"ERROR"' | findstr "0" - name: Upload failure artifacts - uses: actions/upload-artifact@v6 + uses: actions/upload-artifact@v7 if: ${{ failure() }} with: name: failure-${{ matrix.os }}-${{ matrix.java }} @@ -102,7 +108,7 @@ jobs: path: | ** - name: Upload artifacts - uses: actions/upload-artifact@v6 + uses: actions/upload-artifact@v7 with: name: ${{ matrix.os }}-${{ matrix.java }} retention-days: 5 @@ -124,30 +130,37 @@ jobs: ports: - 5000:5000 steps: - - uses: actions/checkout@v6 + - uses: actions/checkout@v7 with: fetch-depth: 0 + # Authenticated: the anonymous api.github.com limit is per runner IP + # and, once hit, the empty answer left the metadata step with no tag. + # The tag is what the Dockerfile's releases/download URL needs. - name: Get latest release version shell: bash - run: | - export git_version_last="$(curl -i -o - --silent https://api.github.com/repos/OpenIdentityPlatform/OpenICF/releases/latest | grep -m1 "\"name\"" | cut -d\" -f4)" ; echo "last release: $git_version_last" - echo "release_version=$git_version_last" >> $GITHUB_ENV + env: + GH_TOKEN: ${{ github.token }} + run: | + release_version="$(gh release view --repo "$GITHUB_REPOSITORY" --json tagName --jq .tagName)" + echo "last release: $release_version" + test -n "$release_version" + echo "release_version=$release_version" >> "$GITHUB_ENV" - name: Docker meta id: meta - uses: docker/metadata-action@v6 + uses: docker/metadata-action@dc802804100637a589fabce1cb79ff13a1411302 # v6.2.0 with: images: | localhost:5000/${{ github.repository }} tags: | type=raw,value=${{ env.release_version }} - name: Set up QEMU - uses: docker/setup-qemu-action@v4 + uses: docker/setup-qemu-action@99012661954931238ded8c8b007157a8430204e1 # v4.4.0 - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v4 + uses: docker/setup-buildx-action@f87e5991a6d7451dcb8d9637bfbc97413f497069 # v4.4.1 with: driver-opts: network=host - name: Build image (default) - uses: docker/build-push-action@v7 + uses: docker/build-push-action@c3c9e263c25d99ce0380d002d59b67737d91b0dc # v7.4.0 continue-on-error: true with: context: . @@ -172,17 +185,24 @@ jobs: ports: - 5000:5000 steps: - - uses: actions/checkout@v6 + - uses: actions/checkout@v7 with: fetch-depth: 0 + # Authenticated: the anonymous api.github.com limit is per runner IP + # and, once hit, the empty answer left the metadata step with no tag. + # The tag is what the Dockerfile's releases/download URL needs. - name: Get latest release version shell: bash - run: | - export git_version_last="$(curl -i -o - --silent https://api.github.com/repos/OpenIdentityPlatform/OpenICF/releases/latest | grep -m1 "\"name\"" | cut -d\" -f4)" ; echo "last release: $git_version_last" - echo "release_version=$git_version_last" >> $GITHUB_ENV + env: + GH_TOKEN: ${{ github.token }} + run: | + release_version="$(gh release view --repo "$GITHUB_REPOSITORY" --json tagName --jq .tagName)" + echo "last release: $release_version" + test -n "$release_version" + echo "release_version=$release_version" >> "$GITHUB_ENV" - name: Docker meta id: meta - uses: docker/metadata-action@v6 + uses: docker/metadata-action@dc802804100637a589fabce1cb79ff13a1411302 # v6.2.0 with: images: | localhost:5000/${{ github.repository }} @@ -190,14 +210,14 @@ jobs: type=raw,value=alpine type=raw,value=${{ env.release_version }}-alpine - name: Set up QEMU - uses: docker/setup-qemu-action@v4 + uses: docker/setup-qemu-action@99012661954931238ded8c8b007157a8430204e1 # v4.4.0 - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v4 + uses: docker/setup-buildx-action@f87e5991a6d7451dcb8d9637bfbc97413f497069 # v4.4.1 with: driver-opts: network=host - name: Build image continue-on-error: true - uses: docker/build-push-action@v7 + uses: docker/build-push-action@c3c9e263c25d99ce0380d002d59b67737d91b0dc # v7.4.0 with: context: . file: ./Dockerfile-alpine diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 277704f4..61057f22 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -85,12 +85,12 @@ jobs: # --- Manual build (only used when build-mode is 'manual') ------------- # - name: Set up JDK 11 - # uses: actions/setup-java@v5 + # uses: actions/setup-java@v6 # with: # java-version: '11' # distribution: 'zulu' # - name: Cache Maven packages - # uses: actions/cache@v5 + # uses: actions/cache@v6 # with: # path: ~/.m2/repository # key: ${{ runner.os }}-m2-repository-${{ hashFiles('**/pom.xml') }} diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 161c29c6..e9811998 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -1,3 +1,16 @@ +# The contents of this file are subject to the terms of the Common Development and +# Distribution License (the License). You may not use this file except in compliance with the +# License. +# +# You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the +# specific language governing permission and limitations under the License. +# +# When distributing Covered Software, include this CDDL Header Notice in each file and include +# the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL +# Header, with the fields enclosed by brackets [] replaced by your own identifying +# information: "Portions copyright [year] [name of copyright owner]". +# +# Portions Copyright 2026 3A Systems, LLC. name: Package/Deploy on: @@ -10,6 +23,11 @@ concurrency: group: ${{ github.workflow }}-${{ github.event.workflow_run.head_branch }} cancel-in-progress: false +# Publishing goes to Maven Central with the OSSRH secrets; the GitHub token +# is only used to read the repository. +permissions: + contents: read + jobs: deploy-maven: if: ${{ github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.event=='push' }} @@ -19,13 +37,13 @@ jobs: env: GITHUB_CONTEXT: ${{ toJSON(github) }} run: echo "$GITHUB_CONTEXT" - - uses: actions/checkout@v6 + - uses: actions/checkout@v7 with: fetch-depth: 0 submodules: recursive ref: ${{ github.event.workflow_run.head_branch }} - name: Set up Java for publishing to Maven Central Repository OSS - uses: actions/setup-java@v5 + uses: actions/setup-java@v6 with: java-version: ${{ github.event.workflow_run.head_branch == 'sustaining/1.8.x' && '8' || '11'}} distribution: 'temurin' @@ -33,7 +51,7 @@ jobs: server-username: MAVEN_USERNAME server-password: MAVEN_PASSWORD - name: Cache Maven packages - uses: actions/cache@v5 + uses: actions/cache@v6 with: path: ~/.m2/repository key: ${{ runner.os }}-m2-repository-${{ hashFiles('**/pom.xml') }} @@ -60,42 +78,42 @@ jobs: if: ${{ github.event.workflow_run.event=='push' && env.MAVEN_USERNAME!='' && env.MAVEN_PASSWORD!=''}} run: mvn --batch-mode --errors --update-snapshots -Dgpg.passphrase=${{ secrets.GPG_PASSPHRASE }} deploy --file pom.xml - name: Upload artifacts - uses: actions/upload-artifact@v6 + uses: actions/upload-artifact@v7 with: name: OpenICF Framework path: OpenICF-java-framework/openicf-zip/target/*.zip - name: Upload artifacts - uses: actions/upload-artifact@v6 + uses: actions/upload-artifact@v7 with: name: OpenICF CSV File Connector path: OpenICF-csvfile-connector/target/*.jar - name: Upload artifacts - uses: actions/upload-artifact@v6 + uses: actions/upload-artifact@v7 with: name: OpenICF Database Connector path: OpenICF-databasetable-connector/target/*.jar - name: Upload artifacts - uses: actions/upload-artifact@v6 + uses: actions/upload-artifact@v7 with: name: OpenICF Groovy Connector path: OpenICF-groovy-connector/target/*.jar - name: Upload artifacts - uses: actions/upload-artifact@v6 + uses: actions/upload-artifact@v7 with: name: OpenICF Kerberos connector path: OpenICF-kerberos-connector/target/*.jar - name: Upload artifacts - uses: actions/upload-artifact@v6 + uses: actions/upload-artifact@v7 with: name: OpenICF LDAP Connector path: OpenICF-ldap-connector/target/*.jar - name: Upload artifacts - uses: actions/upload-artifact@v6 + uses: actions/upload-artifact@v7 with: name: OpenICF SSH Connector path: OpenICF-ssh-connector/target/*.jar - name: Upload artifacts - uses: actions/upload-artifact@v6 + uses: actions/upload-artifact@v7 with: name: OpenICF XML Connector path: OpenICF-xml-connector/target/*.jar diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 28f7caa8..2c5d1723 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -27,20 +27,29 @@ on: concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: false + +# Read-only token by default; each job below lists what it has to write. +permissions: + contents: read + jobs: release-maven: runs-on: 'ubuntu-latest' + permissions: + # release:prepare pushes the release commits and the tag, and + # action-gh-release creates the GitHub release. + contents: write steps: - name: Print github context env: GITHUB_CONTEXT: ${{ toJSON(github) }} run: echo "$GITHUB_CONTEXT" - - uses: actions/checkout@v6 + - uses: actions/checkout@v7 with: fetch-depth: 0 submodules: recursive - name: Set up Java for publishing to Maven Central Repository OSS - uses: actions/setup-java@v5 + uses: actions/setup-java@v6 with: java-version: ${{ github.event.workflow_run.head_branch == 'sustaining/1.8.x' && '8' || '11'}} distribution: 'temurin' @@ -48,7 +57,7 @@ jobs: server-username: MAVEN_USERNAME server-password: MAVEN_PASSWORD - name: Cache Maven packages - uses: actions/cache@v5 + uses: actions/cache@v6 with: path: ~/.m2/repository key: ${{ runner.os }}-m2-repository-${{ hashFiles('**/pom.xml') }} @@ -75,7 +84,7 @@ jobs: if: ${{ env.MAVEN_USERNAME!='' && env.MAVEN_PASSWORD!='' }} run: mvn --batch-mode -Darguments="-Dgpg.passphrase=${{ secrets.GPG_PASSPHRASE }}" -DsignTag=true -DtagNameFormat="${{ github.event.inputs.releaseVersion }}" -DreleaseVersion=${{ github.event.inputs.releaseVersion }} -DdevelopmentVersion=${{ github.event.inputs.developmentVersion }} release:prepare release:perform --file pom.xml - name: Release on GitHub - uses: softprops/action-gh-release@v2 + uses: softprops/action-gh-release@efb35369e0ad2afab669f228072c1b0d510eae64 # v3.0.3 with: name: ${{ github.event.inputs.releaseVersion }} tag_name: ${{ github.event.inputs.releaseVersion }} @@ -97,15 +106,19 @@ jobs: runs-on: 'ubuntu-latest' needs: - release-maven + permissions: + contents: read + # login-action authenticates to GHCR with the GitHub token to push the image. + packages: write steps: - - uses: actions/checkout@v6 + - uses: actions/checkout@v7 with: ref: ${{ github.event.inputs.releaseVersion }} fetch-depth: 1 submodules: recursive - name: Docker meta id: meta - uses: docker/metadata-action@v6 + uses: docker/metadata-action@dc802804100637a589fabce1cb79ff13a1411302 # v6.2.0 with: images: | ${{ github.repository }} @@ -114,22 +127,22 @@ jobs: type=raw,value=latest type=raw,value=${{ github.event.inputs.releaseVersion }} - name: Set up QEMU - uses: docker/setup-qemu-action@v4 + uses: docker/setup-qemu-action@99012661954931238ded8c8b007157a8430204e1 # v4.4.0 - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v4 + uses: docker/setup-buildx-action@f87e5991a6d7451dcb8d9637bfbc97413f497069 # v4.4.1 - name: Login to DockerHub - uses: docker/login-action@v4 + uses: docker/login-action@dbcb813823bdd20940b903addbd779551569679f # v4.6.0 with: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} - name: Login to GHCR - uses: docker/login-action@v4 + uses: docker/login-action@dbcb813823bdd20940b903addbd779551569679f # v4.6.0 with: registry: ghcr.io username: ${{ github.repository_owner }} password: ${{ secrets.GITHUB_TOKEN }} - name: Build and push image - uses: docker/build-push-action@v7 + uses: docker/build-push-action@c3c9e263c25d99ce0380d002d59b67737d91b0dc # v7.4.0 continue-on-error: true with: context: . @@ -145,15 +158,19 @@ jobs: runs-on: 'ubuntu-latest' needs: - release-maven + permissions: + contents: read + # login-action authenticates to GHCR with the GitHub token to push the image. + packages: write steps: - - uses: actions/checkout@v6 + - uses: actions/checkout@v7 with: ref: ${{ github.event.inputs.releaseVersion }} fetch-depth: 1 submodules: recursive - name: Docker meta id: meta - uses: docker/metadata-action@v6 + uses: docker/metadata-action@dc802804100637a589fabce1cb79ff13a1411302 # v6.2.0 with: images: | ${{ github.repository }} @@ -162,23 +179,23 @@ jobs: type=raw,value=alpine type=raw,value=${{ github.event.inputs.releaseVersion }}-alpine - name: Set up QEMU - uses: docker/setup-qemu-action@v4 + uses: docker/setup-qemu-action@99012661954931238ded8c8b007157a8430204e1 # v4.4.0 - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v4 + uses: docker/setup-buildx-action@f87e5991a6d7451dcb8d9637bfbc97413f497069 # v4.4.1 - name: Login to DockerHub - uses: docker/login-action@v4 + uses: docker/login-action@dbcb813823bdd20940b903addbd779551569679f # v4.6.0 with: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} - name: Login to GHCR - uses: docker/login-action@v4 + uses: docker/login-action@dbcb813823bdd20940b903addbd779551569679f # v4.6.0 with: registry: ghcr.io username: ${{ github.repository_owner }} password: ${{ secrets.GITHUB_TOKEN }} - name: Build and push image continue-on-error: true - uses: docker/build-push-action@v7 + uses: docker/build-push-action@c3c9e263c25d99ce0380d002d59b67737d91b0dc # v7.4.0 with: context: . file: ./Dockerfile-alpine