Skip to content

fix(storage): enforce restrictive file permissions on clipboard history (fixes #47) - #67

Open
riddhima25bet10005-a11y wants to merge 1 commit into
shaaravraghu:mainfrom
riddhima25bet10005-a11y:fix-issue-47
Open

fix(storage): enforce restrictive file permissions on clipboard history (fixes #47)#67
riddhima25bet10005-a11y wants to merge 1 commit into
shaaravraghu:mainfrom
riddhima25bet10005-a11y:fix-issue-47

Conversation

@riddhima25bet10005-a11y

Copy link
Copy Markdown
Contributor

Summary

This PR addresses the critical issue of plaintext clipboard history being stored with world-readable permissions by explicitly setting restrictive Unix file permissions.

Type of Change

  • 🐛 Bug fix (non-breaking change that fixes an issue)
  • ✨ New feature (non-breaking change that adds functionality)
  • 💥 Breaking change (fix or feature that changes existing behaviour)
  • 📚 Documentation update
  • 🧪 Tests (adding or improving test coverage)
  • ♻️ Refactor (no functional changes)
  • 🔧 Chore (dependency update, build tooling, CI)

Related Issue

Closes #47

Changes Made

  • Updated atomic_write in src/storage/disk.rs to set the file permission mode to 0600 (user read/write only) on newly created files using std::os::unix::fs::OpenOptionsExt.
  • Updated flush_force in src/storage/disk.rs to set the directory permission mode to 0700 (user read/write/execute only) on the ~/.clipwallet/store directory using std::os::unix::fs::PermissionsExt.

Testing Done

  • cargo fmt — code is formatted
  • cargo clippy -- -D warnings — no Clippy warnings (Skipped: macOS-only project compiling on Windows)
  • cargo test — all tests pass (Skipped: macOS-only project compiling on Windows)
  • Manually tested on macOS (version: _________)
  • Tested the daemon lifecycle (clipwallet run → hotkeys → clipwallet stop)
  • Tested relevant hotkey chords end-to-end

Checklist

  • My branch is up to date with main (git fetch upstream && git rebase upstream/main)
  • My commits follow the Conventional Commits format
  • I have updated relevant documentation (README, inline docs, CHANGELOG) if needed
  • I have not logged clipboard contents anywhere, even at debug level
  • This PR is focused — it addresses one issue or feature

@riddhima25bet10005-a11y

Copy link
Copy Markdown
Contributor Author

Hi @shaaravraghu
Kindly review and approve.

@riddhima25bet10005-a11y

Copy link
Copy Markdown
Contributor Author

Hi @shaaravraghu
Kindly review.

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.

[CRITICAL] Plaintext Storage of Clipboard History with World-Readable Permissions

1 participant