Skip to content

Handle prompt on unlocking the keyring#157

Merged
infeo merged 2 commits into
cryptomator:developfrom
purejava:fix-#56
Jul 20, 2026
Merged

Handle prompt on unlocking the keyring#157
infeo merged 2 commits into
cryptomator:developfrom
purejava:fix-#56

Conversation

@purejava

Copy link
Copy Markdown
Contributor

Fixes #156

@coderabbitai

coderabbitai Bot commented Jul 18, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: edb9c531-95ef-4d08-b5a3-207a513a3380

📥 Commits

Reviewing files that changed from the base of the PR and between 596127d and 76a0222.

📒 Files selected for processing (1)
  • src/main/java/org/cryptomator/linux/keychain/SecretServiceKeychainAccess.java
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/main/java/org/cryptomator/linux/keychain/SecretServiceKeychainAccess.java

Walkthrough

storePassphrase now reads the result of the Secret Service unlock operation. When the returned DBus path is not /, it invokes Util.promptAndGetResultAsArrayList(needLock) before continuing with secret encryption and item creation or update.

Estimated code review effort: 2 (Simple) | ~8 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: handling the unlock prompt for the keyring.
Description check ✅ Passed The description references the linked issue and is clearly related to the keyring unlock fix.
Linked Issues check ✅ Passed The change handles the gnome-keyring unlock prompt in storePassphrase(), matching issue #156.
Out of Scope Changes check ✅ Passed The PR only touches the keychain unlock flow in the targeted class, with no obvious unrelated changes.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
src/main/java/org/cryptomator/linux/keychain/SecretServiceKeychainAccess.java (1)

57-60: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add coverage for the locked-keyring prompt path.

The existing functional tests are guarded by !service.isLocked(), so they never exercise the new needLock.getPath() != "/" branch. Add a test that verifies the prompt is handled before item creation.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@src/main/java/org/cryptomator/linux/keychain/SecretServiceKeychainAccess.java`
around lines 57 - 60, Add functional-test coverage for the branch in the session
unlock flow that calls Util.promptAndGetResultAsArrayList when
needLock.getPath() is not "/". Configure the test service/keyring as locked,
verify the prompt is handled, and assert this occurs before the item is created,
while preserving existing tests for unlocked services.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@src/main/java/org/cryptomator/linux/keychain/SecretServiceKeychainAccess.java`:
- Around line 57-60: Update the unlock handling in SecretServiceKeychainAccess
so the result of session.getService().unlock(lockable) is checked with
isSuccess() before accessing value().b; when unsuccessful, surface the
underlying unlock.error() and avoid passing an invalid value to
Util.promptAndGetResultAsArrayList.

---

Nitpick comments:
In
`@src/main/java/org/cryptomator/linux/keychain/SecretServiceKeychainAccess.java`:
- Around line 57-60: Add functional-test coverage for the branch in the session
unlock flow that calls Util.promptAndGetResultAsArrayList when
needLock.getPath() is not "/". Configure the test service/keyring as locked,
verify the prompt is handled, and assert this occurs before the item is created,
while preserving existing tests for unlocked services.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: ce13a441-bfe6-4c3d-9e12-f8fa91562226

📥 Commits

Reviewing files that changed from the base of the PR and between 060eba7 and 596127d.

📒 Files selected for processing (1)
  • src/main/java/org/cryptomator/linux/keychain/SecretServiceKeychainAccess.java

Comment thread src/main/java/org/cryptomator/linux/keychain/SecretServiceKeychainAccess.java Outdated
Co-authored-by: coderabbitai
@infeo
infeo merged commit 9d3f49d into cryptomator:develop Jul 20, 2026
5 checks passed
@infeo

infeo commented Jul 20, 2026

Copy link
Copy Markdown
Member

Thank you, @purejava for the detailed analysis and quick fix!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SecretServiceKeychainAccess fails to unlock a keyring provided by gnome-keyring

2 participants