Skip to content

Commit

Permalink
Merge branch 'release/1.1.1' into main
Browse files Browse the repository at this point in the history
# Conflicts:
#	pom.xml
  • Loading branch information
overheadhunter committed Apr 20, 2021
2 parents bdf48cc + cbed012 commit df5790f
Show file tree
Hide file tree
Showing 7 changed files with 261 additions and 50 deletions.
41 changes: 15 additions & 26 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,49 +1,38 @@
name: Build

on:
[push]

jobs:
build:
name: Build and Test
runs-on: ubuntu-latest
outputs:
artifact-version: ${{ steps.setversion.outputs.version }}
env:
BUILD_VERSION: SNAPSHOT
if: "!contains(github.event.head_commit.message, '[ci skip]') && !contains(github.event.head_commit.message, '[skip ci]')"
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v1
with:
java-version: 11
server-id: bintray-jcenter
server-username: BINTRAY_USERNAME
server-password: BINTRAY_API_KEY
- uses: actions/cache@v1
- uses: actions/cache@v2
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Ensure to use tagged version
run: mvn versions:set --file ./pom.xml -DnewVersion=${GITHUB_REF##*/}
if: startsWith(github.ref, 'refs/tags/')
- name: Export the project version to the job environment and fix it as an ouput of this job
id: setversion
run: |
v=$(mvn help:evaluate "-Dexpression=project.version" -q -DforceStdout)
echo "::set-env name=BUILD_VERSION::${v}"
echo "::set-output name=version::${v}"
run: mvn versions:set --file ./pom.xml -DnewVersion=${GITHUB_REF##*/}
- name: Build and Test
run: mvn -B install
- name: Upload snapshot artifact fuse-cloud-access-adapter-${{ env.BUILD_VERSION }}.jar
uses: actions/upload-artifact@v2
id: buildAndTest
run: mvn -B clean install -Pcoverage,dependency-check
- uses: actions/upload-artifact@v2
with:
name: fuse-cloud-access-adapter-${{ env.BUILD_VERSION }}.jar
path: target/fuse-cloud-access-adapter-*.jar
- name: Deploy to jcenter
run: mvn -B deploy
name: artifacts
path: target/*.jar
- name: Create Release
uses: actions/create-release@v1
if: startsWith(github.ref, 'refs/tags/')
env:
BINTRAY_USERNAME: cryptobot
BINTRAY_API_KEY: ${{ secrets.BINTRAY_API_KEY }}
GITHUB_TOKEN: ${{ secrets.CRYPTOBOT_RELEASE_TOKEN }} # release as "cryptobot"
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
prerelease: true
37 changes: 37 additions & 0 deletions .github/workflows/publish-central.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Publish to Maven Central
on:
workflow_dispatch:
inputs:
tag:
description: 'Tag'
required: true
default: '0.0.0'
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
ref: "refs/tags/${{ github.event.inputs.tag }}"
- uses: actions/setup-java@v1
with:
java-version: 11
server-id: ossrh # Value of the distributionManagement/repository/id field of the pom.xml
server-username: MAVEN_USERNAME # env variable for username in deploy
server-password: MAVEN_PASSWORD # env variable for token in deploy
gpg-private-key: ${{ secrets.RELEASES_GPG_PRIVATE_KEY }} # Value of the GPG private key to import
gpg-passphrase: MAVEN_GPG_PASSPHRASE # env variable for GPG private key passphrase
- uses: actions/cache@v2
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Enforce project version ${{ github.event.inputs.tag }}
run: mvn versions:set -B -DnewVersion=${{ github.event.inputs.tag }}
- name: Deploy
run: mvn deploy -B -DskipTests -Psign,deploy-central --no-transfer-progress
env:
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.RELEASES_GPG_PASSPHRASE }}
40 changes: 40 additions & 0 deletions .github/workflows/publish-github.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Publish to GitHub Packages
on:
release:
types: [published]
jobs:
publish:
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/') # only allow publishing tagged versions
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v1
with:
java-version: 11
gpg-private-key: ${{ secrets.RELEASES_GPG_PRIVATE_KEY }} # Value of the GPG private key to import
gpg-passphrase: MAVEN_GPG_PASSPHRASE # env variable for GPG private key passphrase
- uses: actions/cache@v2
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Enforce project version ${{ github.event.release.tag_name }}
run: mvn versions:set -B -DnewVersion=${{ github.event.release.tag_name }}
- name: Deploy
run: mvn deploy -B -DskipTests -Psign,deploy-github --no-transfer-progress
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.RELEASES_GPG_PASSPHRASE }}
- name: Slack Notification
uses: rtCamp/action-slack-notify@v2
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
SLACK_USERNAME: 'Cryptobot'
SLACK_ICON:
SLACK_ICON_EMOJI: ':bot:'
SLACK_CHANNEL: 'proj-clap'
SLACK_TITLE: "Published ${{ github.event.repository.name }} ${{ github.event.release.tag_name }}"
SLACK_MESSAGE: "Ready to <https://github.com/${{ github.repository }}/actions/workflows/publish-central.yml|deploy to Maven Central>."
SLACK_FOOTER:
MSG_MINIMAL: true
147 changes: 126 additions & 21 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.cryptomator</groupId>
<artifactId>fuse-cloud-access-adapter</artifactId>
<version>1.1.0</version>
<version>1.1.1</version>

<name>FUSE to CloudAccess Adapter</name>
<description>Adapter between a FUSE frontend and a CloudAccess backend.</description>
Expand Down Expand Up @@ -40,32 +40,18 @@
</license>
</licenses>

<repositories>
<repository>
<id>jcenter</id>
<url>https://jcenter.bintray.com</url>
</repository>
</repositories>

<distributionManagement>
<repository>
<id>bintray-jcenter</id>
<url>https://api.bintray.com/maven/cryptomator/maven/fuse-cloud-access-adapter/;publish=1</url>
</repository>
</distributionManagement>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

<!-- compile time dependencies -->
<jnrfuse.version>0.5.4</jnrfuse.version>
<cloudaccess.version>1.1.0</cloudaccess.version>
<slf4j.version>1.7.28</slf4j.version>
<dagger.version>2.29</dagger.version>
<jnrfuse.version>0.5.5</jnrfuse.version>
<cloudaccess.version>1.1.3</cloudaccess.version>
<slf4j.version>1.7.30</slf4j.version>
<dagger.version>2.34.1</dagger.version>

<!-- test dependencies -->
<junit.jupiter.version>5.6.2</junit.jupiter.version>
<mockito.version>3.3.3</mockito.version>
<junit.jupiter.version>5.7.1</junit.jupiter.version>
<mockito.version>3.7.7</mockito.version>
<hamcrest.version>2.2</hamcrest.version>
</properties>

Expand Down Expand Up @@ -188,4 +174,123 @@
</plugins>
</build>

<profiles>
<profile>
<id>dependency-check</id>
<build>
<plugins>
<plugin>
<groupId>org.owasp</groupId>
<artifactId>dependency-check-maven</artifactId>
<version>6.1.5</version>
<configuration>
<cveValidForHours>24</cveValidForHours>
<failBuildOnCVSS>0</failBuildOnCVSS>
<skipTestScope>true</skipTestScope>
<detail>true</detail>
<suppressionFile>suppression.xml</suppressionFile>
</configuration>
<executions>
<execution>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>

<profile>
<id>coverage</id>
<build>
<plugins>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.6</version>
<executions>
<execution>
<id>prepare-agent</id>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>report</id>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>

<profile>
<id>sign</id>
<build>
<plugins>
<plugin>
<artifactId>maven-gpg-plugin</artifactId>
<version>1.6</version>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
<configuration>
<gpgArguments>
<arg>--pinentry-mode</arg>
<arg>loopback</arg>
</gpgArguments>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>

<profile>
<id>deploy-central</id>
<distributionManagement>
<repository>
<id>ossrh</id>
<name>Maven Central</name>
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
</repository>
</distributionManagement>
<build>
<plugins>
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>1.6.8</version>
<extensions>true</extensions>
<configuration>
<serverId>ossrh</serverId>
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
<autoReleaseAfterClose>true</autoReleaseAfterClose>
</configuration>
</plugin>
</plugins>
</build>
</profile>

<profile>
<id>deploy-github</id>
<distributionManagement>
<repository>
<id>github</id>
<name>GitHub Packages</name>
<url>https://maven.pkg.github.com/cryptomator/fuse-cloud-access-adapter</url>
</repository>
</distributionManagement>
</profile>
</profiles>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@ private CompletableFuture<Integer> readToPointer(Pointer ptr, long position, lon
return CompletableFuture.completedFuture(totalRead);
}
buffer.flip();
ptr.put(totalRead, buffer.array(), buffer.position(), buffer.limit());
assert buffer.position() == 0;
assert buffer.remaining() == read;
ptr.put(totalRead, buffer.array(), buffer.position(), buffer.remaining());
if (read == remaining // DONE, read requested number of bytes
|| read < n) { // EOF
return CompletableFuture.completedFuture(totalRead + read);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ public void testSuccessfulUploadWithMove() throws IOException, BrokenBarrierExce
return CompletableFuture.completedFuture(null);
});
Mockito.when(provider.move(Mockito.any(), Mockito.eq(cloudPath2), Mockito.eq(true))).thenReturn(CompletableFuture.completedFuture(cloudPath2));
Mockito.when(openFile.getPath()).thenReturn(cloudPath1); // initial target path
Mockito.doReturn(cloudPath1).when(openFile).getPath(); // initial target path
Assumptions.assumeFalse(cloudPath1.equals(cloudPath2));

Future<Void> pendingUpload = CompletableFuture.runAsync(() -> {
Expand All @@ -304,7 +304,7 @@ public void testSuccessfulUploadWithMove() throws IOException, BrokenBarrierExce
}
});
persistedBarrier.await();
Mockito.when(openFile.getPath()).thenReturn(cloudPath2); // set a new target path
Mockito.doReturn(cloudPath2).when(openFile).getPath(); // set a new target path
uploadedBarrier.await();
Assertions.assertTimeoutPreemptively(Duration.ofMillis(100), () -> pendingUpload.get());

Expand Down
38 changes: 38 additions & 0 deletions suppression.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- This file lists false positives found by org.owasp:dependency-check-maven build plugin -->
<suppressions xmlns="https://jeremylong.github.io/DependencyCheck/dependency-suppression.1.3.xsd">
<suppress>
<notes><![CDATA[Suppress known vulnerabilities in FUSE libraries for jnr-fuse.]]></notes>
<gav regex="true">^com\.github\.serceman:jnr-fuse:.*$</gav>

<!-- See: https://nvd.nist.gov/vuln/detail/CVE-2011-0541 -->
<!-- Last Modified: 02/11/2014 - Awaiting reanalysis -->
<!-- Possible Symlink attack that allows unpermitted unmounts by denying updates to /etc/mtab on Fuse <= 2.8.5 -->
<!-- Can't fix: Error in FUSE -->
<cve>CVE-2011-0541</cve>

<!-- See: https://nvd.nist.gov/vuln/detail/CVE-2011-0542 -->
<!-- Last Modified: 09/05/2011 -->
<!-- Possible attack that allows unpermitted unmounts on Fuse <= 2.8.5 cause of missing check -->
<!-- Can't fix: Error in FUSE -->
<cve>CVE-2011-0542</cve>

<!-- See: https://nvd.nist.gov/vuln/detail/CVE-2011-0543 -->
<!-- Last Modified: 02/11/2014 - Awaiting reanalysis -->
<!-- Possible Symlink attack that allows unpermitted unmounts caused by bypassable access restrictions on certain util-linux version on Fuse <= 2.8.5 -->
<!-- Can't fix: Error in FUSE -->
<cve>CVE-2011-0543</cve>

<!-- See: https://nvd.nist.gov/vuln/detail/CVE-2015-3202 -->
<!-- Last Modified: 06/30/2017 -->
<!-- Possible arbitrary file write using mount's debugging feature because of uncleared environment vars on Fuse < 2.9.3-15 -->
<!-- Can't fix: Error in FUSE -->
<cve>CVE-2015-3202</cve>

<!-- See: https://nvd.nist.gov/vuln/detail/CVE-2018-10906 -->
<!-- Last Modified: 10/02/2019 -->
<!-- Possible restriction bypass leading to unpermitted mounting of filesystems by non-root users on Fuse < 2.9.8 and < 3.2.5 when using SELinux -->
<!-- Can't fix: Error in FUSE/Not of technical concern for this library -->
<cve>CVE-2018-10906</cve>
</suppress>
</suppressions>

0 comments on commit df5790f

Please sign in to comment.