Skip to content

Fix: Do not write sensitive data into log - #4373

Merged
infeo merged 3 commits into
developfrom
fix/log-sensitive-data
Nov 2, 2026
Merged

infeo merged 3 commits into
developfrom
fix/log-sensitive-data

Conversation

@infeo

@infeo infeo commented Nov 2, 2026

Copy link
Copy Markdown
Member

This PR fixes bugs regarding leakage of key material into log files/user dialogs

@infeo infeo added this to the 1.20.0 milestone Nov 2, 2026
@infeo infeo self-assigned this Nov 2, 2026
Copilot AI balanced review requested due to automatic review settings November 2, 2026 11:43

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Malformed payloads can still expose decrypted key material through logged property names, and the tests lack log-capture assertions to detect such leaks.

2 open issues
What changed in this PR

This PR reduces exposure of key material in Cryptomator’s logs and error dialogs by changing recovery-key validation messages and Hub key-loading diagnostics.

Changes:

  • Replace recovery words in exception messages with word counts or positions.
  • Replace full decrypted JWE payload logging with header and field-name diagnostics.
  • Add regression tests for recovery-word disclosure in exceptions.
File Description
src/​test/​java/​org/​cryptomator/​ui/​recoverykey/​WordEncoderTest.java Tests that invalid-input exceptions do not expose recovery words.
src/​main/​java/​org/​cryptomator/​ui/​recoverykey/​WordEncoder.java Removes recovery words from validation errors.
src/​main/​java/​org/​cryptomator/​ui/​keyloading/​hub/​JWEHelper.java Changes diagnostics to avoid logging full decrypted payloads.

Review effort: Balanced

@coderabbitai

coderabbitai Bot commented Nov 2, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 570c910c-c9c2-434d-b535-5ba609530386
Commits

Reviewing files that changed from the base of the PR and between 16cf3bb and 16ceadf.

Files selected for processing: 1
  • src/main/java/org/cryptomator/ui/keyloading/hub/JWEHelper.java
Files skipped from review as they are similar to previous changes: 1
  • src/main/java/org/cryptomator/ui/keyloading/hub/JWEHelper.java

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.

Walkthrough

JWE error logs now report the JWE header or payload field count instead of the decrypted payload. Recovery-key decoding errors report the word count or index instead of encoded or unknown words. Tests check that these error messages omit the offending words.

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

Change: Bug fix

Suggested reviewers: overheadhunter

Merge Risk: Minimal · up to 16cea

The described error messages no longer include the sensitive values they previously exposed. No actionable merge-blocking risk is established.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documenta… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title clearly identifies the main change: preventing sensitive data from being written to logs.
Description check Passed The description directly relates to the changes by describing fixes for key-material leakage in log files and user dialogs.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 2 functions across 3 files.

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

Finishing Touches
Generate docstrings
  • Commit to this branch
  • Create a new PR
Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

only field count

Co-authored-by: Copilot Autofix powered by AI <[email protected]>
@infeo
infeo merged commit 488f5f0 into develop Nov 2, 2026
9 checks passed
@infeo
infeo deleted the fix/log-sensitive-data branch November 2, 2026 12:38
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.

2 participants