Skip to content

Commit 5e08ae7

Browse files
Merge branch 'release/1.1.2'
2 parents 0c2cd4d + 9121abc commit 5e08ae7

File tree

3 files changed

+52
-8
lines changed

3 files changed

+52
-8
lines changed

.github/workflows/publish-github.yml

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,20 @@ jobs:
2121
run: mvn deploy -B -DskipTests -Psign,deploy-github --no-transfer-progress
2222
env:
2323
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
24-
MAVEN_GPG_PASSPHRASE: ${{ secrets.RELEASES_GPG_PASSPHRASE }}
24+
MAVEN_GPG_PASSPHRASE: ${{ secrets.RELEASES_GPG_PASSPHRASE }}
25+
notify:
26+
runs-on: ubuntu-latest
27+
needs: [publish]
28+
steps:
29+
- name: Slack Notification
30+
uses: rtCamp/action-slack-notify@v2
31+
env:
32+
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
33+
SLACK_USERNAME: 'Cryptobot'
34+
SLACK_ICON:
35+
SLACK_ICON_EMOJI: ':bot:'
36+
SLACK_CHANNEL: 'cryptomator-desktop'
37+
SLACK_TITLE: "Published ${{ github.event.repository.name }} ${{ github.event.release.tag_name }}"
38+
SLACK_MESSAGE: "Ready to <https://github.com/${{ github.repository }}/actions/workflows/publish-central.yml|deploy to Maven Central>."
39+
SLACK_FOOTER:
40+
MSG_MINIMAL: true

pom.xml

Lines changed: 3 additions & 2 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-mac</artifactId>
8-
<version>1.1.1</version>
8+
<version>1.1.2</version>
99

1010
<name>Cryptomator Integrations for macOS</name>
1111
<description>Provides optional macOS services used by Cryptomator</description>
@@ -38,7 +38,7 @@
3838
<mockito.version>4.4.0</mockito.version>
3939

4040
<!-- build plugin dependencies -->
41-
<dependency-check.version>7.0.0</dependency-check.version>
41+
<dependency-check.version>7.1.1</dependency-check.version>
4242
<nexus-staging.version>1.6.8</nexus-staging.version>
4343
</properties>
4444

@@ -284,6 +284,7 @@
284284
<cveValidForHours>24</cveValidForHours>
285285
<failBuildOnCVSS>0</failBuildOnCVSS>
286286
<skipTestScope>true</skipTestScope>
287+
<cveStartYear>2019</cveStartYear>
287288
<detail>true</detail>
288289
<suppressionFile>suppression.xml</suppressionFile>
289290
</configuration>

src/main/java/org/cryptomator/macos/keychain/MacKeychain.java

Lines changed: 32 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ class MacKeychain {
1818
* Associates the specified password with the specified key in the system keychain.
1919
*
2020
* @param serviceName Service name
21-
* @param account Unique account identifier
22-
* @param password Passphrase to store
21+
* @param account Unique account identifier
22+
* @param password Passphrase to store
2323
* @see <a href="https://developer.apple.com/documentation/security/1398366-seckeychainaddgenericpassword">SecKeychainAddGenericPassword</a>
2424
*/
2525
public void storePassword(String serviceName, String account, CharSequence password) throws KeychainAccessException {
@@ -38,13 +38,18 @@ public void storePassword(String serviceName, String account, CharSequence passw
3838
* Loads the password associated with the specified key from the system keychain.
3939
*
4040
* @param serviceName Service name
41-
* @param account Unique account identifier
41+
* @param account Unique account identifier
4242
* @return password or <code>null</code> if no such keychain entry could be loaded from the keychain.
4343
* @see <a href="https://developer.apple.com/documentation/security/1397301-seckeychainfindgenericpassword">SecKeychainFindGenericPassword</a>
4444
*/
4545
public char[] loadPassword(String serviceName, String account) {
4646
byte[] pwBytes = Native.INSTANCE.loadPassword(serviceName.getBytes(UTF_8), account.getBytes(UTF_8));
4747
if (pwBytes == null) {
48+
// this if-statement is a workaround for https://github.com/cryptomator/integrations-mac/issues/13:
49+
if ("Cryptomator".equals(serviceName) && tryMigratePassword(account)) {
50+
// on success: retry
51+
return loadPassword(serviceName, account);
52+
}
4853
return null;
4954
} else {
5055
CharBuffer pwBuf = UTF_8.decode(ByteBuffer.wrap(pwBytes));
@@ -56,14 +61,36 @@ public char[] loadPassword(String serviceName, String account) {
5661
}
5762
}
5863

64+
/**
65+
* Fix for <a href="https://github.com/cryptomator/integrations-mac/issues/13">Issue 13</a>.
66+
* Attempts to find the account with the old hard-coded service name 'Cryptomator\0'
67+
*
68+
* @param account Unique account identifier
69+
* @return <code>true</code> on success
70+
*/
71+
private boolean tryMigratePassword(String account) {
72+
byte[] oldServiceName = {'C', 'r', 'y', 'p', 't', 'o', 'm', 'a', 't', 'o', 'r', '\0'};
73+
byte[] newServiceName = {'C', 'r', 'y', 'p', 't', 'o', 'm', 'a', 't', 'o', 'r'};
74+
byte[] pwBytes = Native.INSTANCE.loadPassword(oldServiceName, account.getBytes(UTF_8));
75+
if (pwBytes == null) {
76+
return false;
77+
}
78+
int errorCode = Native.INSTANCE.storePassword(newServiceName, account.getBytes(UTF_8), pwBytes);
79+
Arrays.fill(pwBytes, (byte) 0x00);
80+
if (errorCode != OSSTATUS_SUCCESS) {
81+
return false;
82+
}
83+
Native.INSTANCE.deletePassword(oldServiceName, account.getBytes(UTF_8));
84+
return true;
85+
}
86+
5987
/**
6088
* Deletes the password associated with the specified key from the system keychain.
6189
*
6290
* @param serviceName Service name
63-
* @param account Unique account identifier
91+
* @param account Unique account identifier
6492
* @return <code>true</code> if the passwords has been deleted, <code>false</code> if no entry for the given key exists.
6593
* @see <a href="https://developer.apple.com/documentation/security/1395547-secitemdelete">SecKeychainItemDelete</a>
66-
6794
*/
6895
public boolean deletePassword(String serviceName, String account) throws KeychainAccessException {
6996
int errorCode = Native.INSTANCE.deletePassword(serviceName.getBytes(UTF_8), account.getBytes(UTF_8));

0 commit comments

Comments
 (0)