diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 115aa2e..2612eef 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -17,11 +17,11 @@ jobs: if: startsWith(github.ref, 'refs/tags/') shell: bash run: | - mvn versions:set --file ./pom.xml -DnewVersion=${GITHUB_REF##*/} + mvn -B versions:set --file ./pom.xml -DnewVersion=${GITHUB_REF##*/} - name: Build and Test id: buildAndTest - run: mvn -B clean install -Pdependency-check - - uses: actions/upload-artifact@v3 + run: mvn -B clean install + - uses: actions/upload-artifact@v4 with: name: artifacts path: target/*.jar diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index d587876..e979d17 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -25,10 +25,10 @@ jobs: java-version: 21 cache: 'maven' - name: Initialize CodeQL - uses: github/codeql-action/init@v2 + uses: github/codeql-action/init@v3 with: languages: java - name: Build run: mvn -B compile - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v2 \ No newline at end of file + uses: github/codeql-action/analyze@v3 \ No newline at end of file diff --git a/.github/workflows/dependency-check.yml b/.github/workflows/dependency-check.yml new file mode 100644 index 0000000..04a9e0a --- /dev/null +++ b/.github/workflows/dependency-check.yml @@ -0,0 +1,63 @@ +name: OWASP Maven Dependency Check +on: + schedule: + - cron: '0 11 * * 0' + push: + branches: + - 'release/**' + workflow_dispatch: + + +jobs: + check-dependencies: + name: Check dependencies + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + show-progress: false + - name: Setup Java + uses: actions/setup-java@v4 + with: + distribution: 'temurin' + java-version: 21 + cache: 'maven' + - name: Cache NVD DB + uses: actions/cache@v3 + with: + path: ~/.m2/repository/org/owasp/dependency-check-data/ + key: dependency-check-${{ github.run_id }} + restore-keys: | + dependency-check + env: + SEGMENT_DOWNLOAD_TIMEOUT_MINS: 5 + - name: Run org.owasp:dependency-check plugin + id: dependency-check + continue-on-error: true + run: mvn -B validate -Pdependency-check + env: + NVD_API_KEY: ${{ secrets.NVD_API_KEY }} + - name: Upload report on failure + if: steps.dependency-check.outcome == 'failure' + uses: actions/upload-artifact@v4 + with: + name: dependency-check-report + path: target/dependency-check-report.html + if-no-files-found: error + - name: Slack Notification on regular check + if: github.event_name == 'schedule' && steps.dependency-check.outcome == 'failure' + uses: rtCamp/action-slack-notify@v2 + env: + SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }} + SLACK_USERNAME: 'Cryptobot' + SLACK_ICON: false + SLACK_ICON_EMOJI: ':bot:' + SLACK_CHANNEL: 'cryptomator-desktop' + SLACK_TITLE: "Vulnerabilities in ${{ github.event.repository.name }} detected." + SLACK_MESSAGE: "Download the for more details." + SLACK_FOOTER: false + MSG_MINIMAL: true + - name: Failing workflow on release branch + if: github.event_name == 'push' && steps.dependency-check.outcome == 'failure' + shell: bash + run: exit 1 diff --git a/pom.xml b/pom.xml index 25f9040..daa77bf 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ 4.0.0 org.cryptomator integrations-linux - 1.4.0 + 1.4.1 integrations-linux Provides optional Linux services used by Cryptomator @@ -44,13 +44,13 @@ 2.0.0-alpha 1.3.3 1.3.6 - 2.0.9 + 2.0.11 5.10.1 - 8.4.2 + 9.0.7 1.6.8 @@ -94,7 +94,7 @@ org.apache.maven.plugins maven-compiler-plugin - 3.11.0 + 3.12.1 ${project.jdk.version} @@ -105,7 +105,7 @@ org.apache.maven.plugins maven-surefire-plugin - 3.2.1 + 3.2.3 org.apache.maven.plugins @@ -143,7 +143,7 @@ maven-javadoc-plugin - 3.6.0 + 3.6.3 attach-javadocs @@ -211,17 +211,19 @@ dependency-check-maven ${dependency-check.version} - 24 + 24 0 true true suppression.xml + ${env.NVD_API_KEY} check + validate diff --git a/src/main/java/org/cryptomator/linux/keychain/SecretServiceKeychainAccess.java b/src/main/java/org/cryptomator/linux/keychain/SecretServiceKeychainAccess.java index d52df08..500c212 100644 --- a/src/main/java/org/cryptomator/linux/keychain/SecretServiceKeychainAccess.java +++ b/src/main/java/org/cryptomator/linux/keychain/SecretServiceKeychainAccess.java @@ -5,7 +5,8 @@ import org.cryptomator.integrations.common.Priority; import org.cryptomator.integrations.keychain.KeychainAccessException; import org.cryptomator.integrations.keychain.KeychainAccessProvider; -import org.freedesktop.dbus.exceptions.DBusExecutionException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.io.IOException; import java.util.List; @@ -15,6 +16,8 @@ @OperatingSystem(OperatingSystem.Value.LINUX) public class SecretServiceKeychainAccess implements KeychainAccessProvider { + private static Logger LOG = LoggerFactory.getLogger(SecretServiceKeychainAccess.class); + private final String LABEL_FOR_SECRET_IN_KEYRING = "Cryptomator"; @Override @@ -27,12 +30,8 @@ public boolean isSupported() { try { return SimpleCollection.isAvailable(); } catch (ExceptionInInitializerError e) { - //TODO: remove try-catch once secret-service lib is fixed - if(e.getException() instanceof DBusExecutionException) { - return false; - } else { - throw e; - } + LOG.warn("Initializing secret service keychain access failed", e.getException()); + return false; } } diff --git a/src/test/java/org/cryptomator/linux/keychain/KDEWalletKeychainAccessTest.java b/src/test/java/org/cryptomator/linux/keychain/KDEWalletKeychainAccessTest.java index f5539a0..e300c74 100644 --- a/src/test/java/org/cryptomator/linux/keychain/KDEWalletKeychainAccessTest.java +++ b/src/test/java/org/cryptomator/linux/keychain/KDEWalletKeychainAccessTest.java @@ -3,6 +3,7 @@ import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.condition.EnabledIf; import org.junit.jupiter.api.condition.EnabledOnOs; import org.junit.jupiter.api.condition.OS; @@ -14,6 +15,7 @@ * Unit tests for KWallet access via DBUS. */ @EnabledOnOs(OS.LINUX) +@EnabledIf("osEnvironmentSuitable") public class KDEWalletKeychainAccessTest { private static boolean isInstalled; @@ -40,4 +42,9 @@ public void testIsSupported() { KDEWalletKeychainAccess keychainAccess = new KDEWalletKeychainAccess(); Assertions.assertEquals(isInstalled, keychainAccess.isSupported()); } + + + private static boolean osEnvironmentSuitable() { + return System.getenv().containsKey("DISPLAY"); + } }