GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Merge branch 'release/1.10.1' · cryptomator/integrations-api@314e8cc

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • .github/workflows
    • build.yml
    • codeql-analysis.yml
  • .mvn/wrapper
    • maven-wrapper.properties
  • CHANGELOG.md
  • pom.xml
  • src
    • main/java/org/cryptomator/integrations/update
      • DownloadUpdateMechanism.java
    • test/java/org/cryptomator/integrations/update
      • DownloadUpdateMechanismTest.java
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎.github/workflows/build.yml‎

Copy file name to clipboardExpand all lines: .github/workflows/build.yml
+13-6Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@ jobs:
1717
artifact-metadata: write # Required for the attestations step
1818
steps:
1919
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
20-
- uses: actions/setup-java@de7274f081f381c8f8158605e0321c36c376e2e6 # v6.0.1
20+
with:
21+
persist-credentials: false
22+
- uses: actions/setup-java@b843ebf9b913146b38da2eaa7aeddf76074ae1ad # v6.1.0
2123
with:
2224
distribution: 'temurin'
2325
java-version: ${{ env.JAVA_VERSION }}
@@ -34,7 +36,7 @@ jobs:
3436
subject-path: |
3537
target/*.jar
3638
target/*.pom
37-
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
39+
- uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
3840
with:
3941
name: artifacts
4042
path: target/*.jar
@@ -48,14 +50,17 @@ jobs:
4850
if: github.repository_owner == 'cryptomator' && (startsWith(github.ref, 'refs/tags/') || contains(github.event.head_commit.message, '[deploy]'))
4951
steps:
5052
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
51-
- uses: actions/setup-java@de7274f081f381c8f8158605e0321c36c376e2e6 # v6.0.1
53+
with:
54+
persist-credentials: false
55+
- uses: actions/setup-java@b843ebf9b913146b38da2eaa7aeddf76074ae1ad # v6.1.0
5256
with:
5357
distribution: 'temurin'
5458
java-version: ${{ env.JAVA_VERSION }}
5559
cache: 'maven'
5660
server-id: central
57-
server-username: MAVEN_CENTRAL_USERNAME
58-
server-password: MAVEN_CENTRAL_PASSWORD
61+
server-username-env-var: MAVEN_CENTRAL_USERNAME
62+
server-password-env-var: MAVEN_CENTRAL_PASSWORD
63+
mvn-server-repository-origins: central:https://central.sonatype.com
5964
- name: Ensure to use tagged version
6065
if: startsWith(github.ref, 'refs/tags/')
6166
run: ./mvnw versions:set --file ./pom.xml -DnewVersion=${GITHUB_REF##*/}
@@ -83,7 +88,9 @@ jobs:
8388
if: github.repository_owner == 'cryptomator' && (startsWith(github.ref, 'refs/tags/') || contains(github.event.head_commit.message, '[deploy]'))
8489
steps:
8590
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
86-
- uses: actions/setup-java@de7274f081f381c8f8158605e0321c36c376e2e6 # v6.0.1
91+
with:
92+
persist-credentials: false
93+
- uses: actions/setup-java@b843ebf9b913146b38da2eaa7aeddf76074ae1ad # v6.1.0
8794
with:
8895
java-version: ${{ env.JAVA_VERSION }}
8996
distribution: 'temurin'
Collapse file

‎.github/workflows/codeql-analysis.yml‎

Copy file name to clipboardExpand all lines: .github/workflows/codeql-analysis.yml
+4-3Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,17 @@ jobs:
2323
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
2424
with:
2525
fetch-depth: 2
26-
- uses: actions/setup-java@de7274f081f381c8f8158605e0321c36c376e2e6 # v6.0.1
26+
persist-credentials: false
27+
- uses: actions/setup-java@b843ebf9b913146b38da2eaa7aeddf76074ae1ad # v6.1.0
2728
with:
2829
distribution: 'temurin'
2930
java-version: 25
3031
cache: 'maven'
3132
- name: Initialize CodeQL
32-
uses: github/codeql-action/init@1c5b675653bb5c22dbe9b12b556ec555138e09fd # v4.38.1
33+
uses: github/codeql-action/init@9b3254085494b55a0f7c4c2b3d2d52cc712ce370 # v4.39.1
3334
with:
3435
languages: java
3536
- name: Build
3637
run: ./mvnw -B compile
3738
- name: Perform CodeQL Analysis
38-
uses: github/codeql-action/analyze@1c5b675653bb5c22dbe9b12b556ec555138e09fd # v4.38.1
39+
uses: github/codeql-action/analyze@9b3254085494b55a0f7c4c2b3d2d52cc712ce370 # v4.39.1
Collapse file

‎.mvn/wrapper/maven-wrapper.properties‎

Copy file name to clipboard
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
wrapperVersion=3.3.4
22
distributionType=only-script
3-
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.16/apache-maven-3.9.16-bin.zip
4-
distributionSha256Sum=5af3b743dd8b876b5c45da33b676251e5f1687712644abb4ee519ca56e1d89ce
3+
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.10.0/apache-maven-3.10.0-bin.zip
4+
distributionSha256Sum=1f6d9909266510f039f59aa0e13dcd2c66da85f043e56276e41f2918f8bddaff
Collapse file

‎CHANGELOG.md‎

Copy file name to clipboardExpand all lines: CHANGELOG.md
+13Lines changed: 13 additions & 0 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,19 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
77
The changelog starts with version 1.7.0.
88
Changes to prior versions can be found on the [Github release page](https://github.com/cryptomator/integrations-api/releases).
99

10+
## [1.10.1](https://github.com/cryptomator/integrations-api/releases/tag/1.10.1) - 2026-11-06
11+
12+
### Changed
13+
* Updated dependencies:
14+
- `com.fasterxml.jackson.core:jackson-databind` from `2.21.7` to `2.21.8`
15+
16+
### Fixed
17+
* `DownloadUpdateMechanism` reports a malformed asset digest as `UpdateFailedException` instead of `IllegalArgumentException`
18+
19+
### Security
20+
* `DownloadUpdateMechanism` rejects assets whose name is not a plain file name, preventing the download from being written outside of its temporary working directory
21+
22+
1023
## [1.10.0](https://github.com/cryptomator/integrations-api/releases/tag/1.10.0) - 2026-10-13
1124

1225
### Added
Collapse file

‎pom.xml‎

Copy file name to clipboardExpand all lines: pom.xml
+6-6Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<modelVersion>4.0.0</modelVersion>
66
<groupId>org.cryptomator</groupId>
77
<artifactId>integrations-api</artifactId>
8-
<version>1.10.0</version>
8+
<version>1.10.1</version>
99

1010
<name>Cryptomator Integrations API</name>
1111
<description>Defines optional service interfaces that may be used by Cryptomator</description>
@@ -30,20 +30,20 @@
3030
<jdk.version>25</jdk.version>
3131

3232
<slf4j.version>2.0.20</slf4j.version>
33-
<jackson.version>2.21.7</jackson.version>
33+
<jackson.version>2.21.8</jackson.version>
3434
<jetbrains-annotation.version>26.1.0</jetbrains-annotation.version>
3535

3636
<!-- Test dependencies -->
3737
<junit.version>6.1.3</junit.version>
38-
<mockito.version>5.23.0</mockito.version>
38+
<mockito.version>5.24.0</mockito.version>
3939

4040
<!-- Build dependencies -->
41-
<mvn-compiler.version>3.15.0</mvn-compiler.version>
41+
<mvn-compiler.version>3.16.0</mvn-compiler.version>
4242
<mvn-source.version>3.4.0</mvn-source.version>
43-
<mvn-surefire.version>3.5.6</mvn-surefire.version>
43+
<mvn-surefire.version>3.6.1</mvn-surefire.version>
4444
<mvn-javadoc.version>3.12.0</mvn-javadoc.version>
4545
<mvn-gpg.version>3.2.8</mvn-gpg.version>
46-
<central-publishing.version>0.11.0</central-publishing.version>
46+
<central-publishing.version>0.12.0</central-publishing.version>
4747
</properties>
4848

4949
<licenses>
Collapse file

‎src/main/java/org/cryptomator/integrations/update/DownloadUpdateMechanism.java‎

Copy file name to clipboardExpand all lines: src/main/java/org/cryptomator/integrations/update/DownloadUpdateMechanism.java
+31-6Lines changed: 31 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,14 @@
1919
import java.nio.file.Path;
2020
import java.util.HexFormat;
2121
import java.util.List;
22+
import java.util.regex.Pattern;
2223

2324
public abstract class DownloadUpdateMechanism implements UpdateMechanism<DownloadUpdateInfo> {
2425

2526
private static final Logger LOG = LoggerFactory.getLogger(DownloadUpdateMechanism.class);
2627
private static final String LATEST_VERSION_API_URL = "https://api.cryptomator.org/connect/apps/desktop/latest-version?format=1";
2728
private static final ObjectMapper MAPPER = new ObjectMapper();
29+
private static final Pattern SAFE_ASSET_NAME = Pattern.compile("[A-Za-z0-9][A-Za-z0-9._+-]*");
2830

2931
@Override
3032
public DownloadUpdateInfo checkForUpdate(String currentVersion, HttpClient httpClient) {
@@ -51,18 +53,44 @@ public DownloadUpdateInfo checkForUpdate(String currentVersion, HttpClient httpC
5153
* Returns the first step to prepare the update. This downloads the {@link DownloadUpdateInfo#asset() asset} to a temporary location and verifies its checksum.
5254
* @param updateInfo The {@link DownloadUpdateInfo} retrieved from {@link #checkForUpdate(String, HttpClient)}.
5355
* @return a new {@link UpdateStep} that can be used to monitor the download progress.
54-
* @throws UpdateFailedException When failing to prepare a temporary download location.
56+
* @throws UpdateFailedException When the asset's name is not a plain file name, its digest is malformed, or when failing to prepare a temporary download location.
5557
*/
5658
@Override
5759
public UpdateStep firstStep(DownloadUpdateInfo updateInfo) throws UpdateFailedException {
60+
var asset = updateInfo.asset();
61+
// the name is used as file name in the work dir, so it must not be able to point anywhere else
62+
if (!isSafeAssetName(asset.name())) {
63+
LOG.debug("Rejected unsafe asset name: \"{}\"", asset.name());
64+
throw new UpdateFailedException("Asset name is not a safe file name.");
65+
}
66+
var digest = parseSha256Digest(asset.digest());
5867
try {
5968
Path workDir = Files.createTempDirectory("cryptomator-update");
60-
return new FirstStep(workDir, updateInfo);
69+
return new FirstStep(workDir, updateInfo, digest);
6170
} catch (IOException e) {
6271
throw new UpdateFailedException("Failed to create temporary directory for update", e);
6372
}
6473
}
6574

75+
// allowlist of plain file names: no path separators, no drive letters, no leading dot, no shell metacharacters
76+
static boolean isSafeAssetName(@Nullable String name) {
77+
return name != null && SAFE_ASSET_NAME.matcher(name).matches();
78+
}
79+
80+
// returns the expected SHA-256 checksum or null, if the digest is not prefixed with "sha256:"; throws if the hex part is not exactly 64 hex chars
81+
static byte @Nullable [] parseSha256Digest(String digest) throws UpdateFailedException {
82+
if (!digest.startsWith("sha256:")) {
83+
return null;
84+
} else if (digest.length() != 71) {
85+
throw new UpdateFailedException("Malformed asset digest: expected 64 hexadecimal characters for SHA-256.");
86+
}
87+
try {
88+
return HexFormat.of().withLowerCase().parseHex(digest.substring(7)); // remove "sha256:" prefix
89+
} catch (IllegalArgumentException e) {
90+
throw new UpdateFailedException("Malformed asset digest.", e);
91+
}
92+
}
93+
6694
/**
6795
* Second step that is executed after the download has completed in the {@link #firstStep(DownloadUpdateInfo) first step}.
6896
* @param workDir A temporary working directory to which the asset has been downloaded.
@@ -104,12 +132,9 @@ private class FirstStep extends DownloadUpdateStep {
104132
private final Path workDir;
105133
private final DownloadUpdateInfo updateInfo;
106134

107-
public FirstStep(Path workDir, DownloadUpdateInfo updateInfo) {
135+
public FirstStep(Path workDir, DownloadUpdateInfo updateInfo, byte @Nullable [] digest) {
108136
var uri = URI.create(updateInfo.asset().downloadUrl);
109137
var destination = workDir.resolve(updateInfo.asset().name);
110-
var digest = updateInfo.asset().digest().startsWith("sha256:")
111-
? HexFormat.of().withLowerCase().parseHex(updateInfo.asset().digest.substring(7)) // remove "sha256:" prefix
112-
: null;
113138
var size = updateInfo.asset().size;
114139
super(uri, destination, digest, size);
115140
this.workDir = workDir;
Collapse file

‎src/test/java/org/cryptomator/integrations/update/DownloadUpdateMechanismTest.java‎

Copy file name to clipboard
+129Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
package org.cryptomator.integrations.update;
2+
3+
import org.junit.jupiter.api.Assertions;
4+
import org.junit.jupiter.api.Test;
5+
import org.junit.jupiter.params.ParameterizedTest;
6+
import org.junit.jupiter.params.provider.NullAndEmptySource;
7+
import org.junit.jupiter.params.provider.ValueSource;
8+
9+
import java.io.IOException;
10+
import java.nio.file.Files;
11+
import java.nio.file.Path;
12+
import java.util.HexFormat;
13+
14+
public class DownloadUpdateMechanismTest {
15+
16+
private final DownloadUpdateMechanism mechanism = new DownloadUpdateMechanism() {
17+
@Override
18+
public UpdateStep secondStep(Path workDir, Path assetPath, DownloadUpdateInfo updateInfo) {
19+
throw new UnsupportedOperationException();
20+
}
21+
22+
@Override
23+
protected DownloadUpdateInfo checkForUpdate(String currentVersion, LatestVersionResponse response) {
24+
throw new UnsupportedOperationException();
25+
}
26+
};
27+
28+
@ParameterizedTest
29+
@ValueSource(strings = {
30+
"Cryptomator-1.18.0-x64.msi",
31+
"cryptomator-1.18.0-x86_64.AppImage",
32+
"Cryptomator-1.18.0-beta1+build.42.dmg",
33+
"a"
34+
})
35+
public void testSafeAssetNames(String name) {
36+
Assertions.assertTrue(DownloadUpdateMechanism.isSafeAssetName(name));
37+
}
38+
39+
@ParameterizedTest
40+
@NullAndEmptySource
41+
@ValueSource(strings = {
42+
"..",
43+
"-rf.exe",
44+
"../Cryptomator-x64.exe",
45+
"..\\..\\Roaming\\Microsoft\\Windows\\Start Menu\\Programs\\Startup\\Cryptomator-x64.exe",
46+
"C:Cryptomator-x64.exe",
47+
"Cryptomator x64.exe",
48+
"Cryptomator\u0000.exe",
49+
"Cryptomator&calc.exe",
50+
"Cryptomätor.exe"
51+
})
52+
public void testUnsafeAssetNames(String name) {
53+
Assertions.assertFalse(DownloadUpdateMechanism.isSafeAssetName(name));
54+
}
55+
56+
@Test
57+
public void testFirstStepRejectsUnsafeAssetName() {
58+
var updateInfo = updateInfo("..\\..\\Roaming\\Microsoft\\Windows\\Start Menu\\Programs\\Startup\\Cryptomator-x64.exe", "sha256:" + "00".repeat(32));
59+
60+
Assertions.assertThrows(UpdateFailedException.class, () -> mechanism.firstStep(updateInfo));
61+
}
62+
63+
@ParameterizedTest
64+
@ValueSource(strings = {"0123456789abcdef", "0123456789ABCDEF"})
65+
public void testParseSha256Digest(String hexBlock) throws UpdateFailedException {
66+
var digest = DownloadUpdateMechanism.parseSha256Digest("sha256:" + hexBlock.repeat(4));
67+
68+
Assertions.assertArrayEquals(HexFormat.of().parseHex("0123456789abcdef".repeat(4)), digest);
69+
}
70+
71+
@ParameterizedTest
72+
@ValueSource(strings = {
73+
"",
74+
"md5:0123456789abcdef0123456789abcdef",
75+
"sha512:0123456789abcdef"
76+
})
77+
public void testParseSha256DigestIgnoresOtherAlgorithms(String digest) throws UpdateFailedException {
78+
Assertions.assertNull(DownloadUpdateMechanism.parseSha256Digest(digest));
79+
}
80+
81+
@ParameterizedTest
82+
@ValueSource(strings = {
83+
"sha256:000000000000000000000000000000000000000000000000000000000000000", // 63 chars
84+
"sha256:00000000000000000000000000000000000000000000000000000000000000000" // 65 chars
85+
})
86+
public void testParseSha256DigestRejectsWrongLength(String digest) {
87+
var e = Assertions.assertThrows(UpdateFailedException.class, () -> DownloadUpdateMechanism.parseSha256Digest(digest));
88+
89+
Assertions.assertNull(e.getCause()); // rejected by the length check, not by the hex parser
90+
}
91+
92+
@ParameterizedTest
93+
@ValueSource(strings = {
94+
"sha256:000000000000000000000000000000000000000000000000000000000000000g",
95+
"sha256:0000000000000000000000000000000000000000000000000000000000000000" // fullwidth digit zero, accepted by Character.digit()
96+
})
97+
public void testParseSha256DigestRejectsNonHex(String digest) {
98+
var e = Assertions.assertThrows(UpdateFailedException.class, () -> DownloadUpdateMechanism.parseSha256Digest(digest));
99+
100+
Assertions.assertInstanceOf(IllegalArgumentException.class, e.getCause()); // passed the length check, rejected by the hex parser
101+
}
102+
103+
@Test
104+
public void testFirstStepRejectsMalformedDigest() {
105+
var updateInfo = updateInfo("Cryptomator-1.18.0-x64.msi", "sha256:0");
106+
107+
Assertions.assertThrows(UpdateFailedException.class, () -> mechanism.firstStep(updateInfo));
108+
}
109+
110+
@Test
111+
public void testFirstStepAcceptsSafeAssetName() throws IOException {
112+
var updateInfo = updateInfo("Cryptomator-1.18.0-x64.msi", "sha256:" + "00".repeat(32));
113+
114+
var step = Assertions.assertInstanceOf(DownloadUpdateStep.class, mechanism.firstStep(updateInfo));
115+
var workDir = step.destination.getParent();
116+
try {
117+
Assertions.assertEquals("Cryptomator-1.18.0-x64.msi", step.destination.getFileName().toString());
118+
Assertions.assertTrue(Files.isDirectory(workDir));
119+
} finally {
120+
Files.deleteIfExists(workDir);
121+
}
122+
}
123+
124+
private DownloadUpdateInfo updateInfo(String assetName, String digest) {
125+
var asset = new DownloadUpdateMechanism.Asset(assetName, digest, 42L, "https://example.com/" + assetName);
126+
return new DownloadUpdateInfo(mechanism, "1.18.0", asset);
127+
}
128+
129+
}

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.