Unify file name encryption#128
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR aims to unify filename encryption/decryption logic across the abstract and native filesystem layers by centralizing name crypto + directory-id handling into AbstractPathHelpers helpers, and then migrating call sites (Recycle Bin + Health repair) to use those helpers.
Changes:
- Refactored ciphertext name resolution to use
AbstractPathHelpers.EncryptNameAsync(...)/DecryptNameAsync(...)(and related new helper overloads). - Added an overload of
GetDirectoryIdAsync(...)that works with an explicitcontentFolderparameter for non-FileSystemSpecificscall sites. - Updated Recycle Bin and Health repair helpers to rely on the unified name encryption helpers.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/Core/SecureFolderFS.Core.FileSystem/Helpers/RecycleBin/Native/NativeRecycleBinHelpers.Operational.cs | Uses unified name decryption earlier and attempts to unify Directory ID usage when writing recycle-bin metadata. |
| src/Core/SecureFolderFS.Core.FileSystem/Helpers/RecycleBin/Abstract/AbstractRecycleBinHelpers.Operational.cs | Switches delete path to a single “delete immediately” helper and adopts unified decrypt/encrypt helpers for recycle-bin metadata. |
| src/Core/SecureFolderFS.Core.FileSystem/Helpers/Paths/Abstract/AbstractPathHelpers.Paths.cs | Replaces manual name crypto + extension concatenation with EncryptNameAsync / DecryptNameAsync. |
| src/Core/SecureFolderFS.Core.FileSystem/Helpers/Paths/Abstract/AbstractPathHelpers.Names.cs | Introduces/extends centralized helpers for name encrypt/decrypt, including overloads for explicit Security + contentFolder. |
| src/Core/SecureFolderFS.Core.FileSystem/Helpers/Paths/Abstract/AbstractPathHelpers.Directory.cs | Adds a GetDirectoryIdAsync overload that takes contentFolder explicitly. |
| src/Core/SecureFolderFS.Core.FileSystem/Helpers/Health/HealthHelpers.Name.cs | Removes duplicated Directory ID read/encrypt logic and uses AbstractPathHelpers.EncryptNameAsync(...). |
| src/Core/SecureFolderFS.Core.FileSystem/Helpers/Health/HealthHelpers.Directory.cs | Uses unified “encrypt new name” helper when renaming children after regenerating Directory ID. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.