Skip to content

Lockdown plugin stability#8

Draft
Rynaro wants to merge 1 commit into
mainfrom
cursor/lockdown-plugin-stability-f332
Draft

Lockdown plugin stability#8
Rynaro wants to merge 1 commit into
mainfrom
cursor/lockdown-plugin-stability-f332

Conversation

@Rynaro
Copy link
Copy Markdown
Owner

@Rynaro Rynaro commented Feb 1, 2026

Pull Request

📝 Description

This PR addresses a critical bug where moving or renaming a locked file or folder would cause the lock state to break, making encrypted content visible and editable, and potentially leading to data loss.

The solution involves:

  • Implementing event handlers for Obsidian's rename and delete events.
  • When a file or folder is moved/renamed, the plugin now correctly updates all associated lock data (locked files/folders sets, password hashes, cached passwords, and the LockRegistry) and refreshes the UI.
  • Deletion events trigger cleanup of corresponding lock entries to prevent stale data.
  • The LockRegistry has been extended with methods (updateFilePath, updateFolderPath, updateChildFilePaths, updateChildFolderPaths) to handle path updates for individual files/folders and their children.

Fixes #7

🎯 Type of Change

  • 🐛 Bug fix (non-breaking change which fixes an issue)
  • ✨ New feature (non-breaking change which adds functionality)
  • 💥 Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • 📝 Documentation update
  • 🎨 UI/UX improvement
  • ♻️ Code refactoring
  • ⚡ Performance improvement
  • 🧪 Test addition or update

🧪 How Has This Been Tested?

Describe the tests you ran to verify your changes:

  • Manual testing: Verified that locked files and folders retain their lock status and UI indicators after being moved or renamed. Confirmed that deleting locked items correctly removes their lock state.
  • Build verification: npm run build
  • Linting: npm run lint

Test Configuration:

  • Obsidian version: (Assumed latest compatible)
  • Operating system: (Assumed standard OS)

📸 Screenshots (if applicable)

N/A

✅ Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings or errors
  • I have tested this in both light and dark themes
  • I have tested this with encryption enabled and disabled
  • Any dependent changes have been merged and published

📋 Additional Notes

No dedicated test framework is currently set up, so testing was primarily manual and through build/lint checks.

🔗 Related Issues


Open in Cursor Open in Web

This fix addresses issue #7 where locking a note and moving it in the
folder structure would cause the lock marker to be dismissed, leaving
the encrypted content visible without unlock options.

Changes:
- Added rename event handler in main.ts to update lock registry when
  files/folders are moved or renamed
- Added delete event handler to clean up stale lock entries
- Extended LockRegistry with methods to update file/folder paths:
  - updateFilePath(): Updates a single locked file path
  - updateFolderPath(): Updates a single locked folder path
  - updateChildFilePaths(): Updates all locked files within a folder
  - updateChildFolderPaths(): Updates all locked subfolders within a folder
- Properly handles password hashes and cached passwords during path updates
- Updates UI (overlays and file explorer indicators) after path changes

This prevents users from seeing encrypted content without unlock options
and protects against accidental crypto corruption from editing encrypted
content directly.

Fixes #7

Co-authored-by: hlavezzo <hlavezzo@hey.com>
@cursor
Copy link
Copy Markdown

cursor Bot commented Feb 1, 2026

Cursor Agent can help with this pull request. Just @cursor in comments and I'll start working on changes in this branch.
Learn more about Cursor Agents

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Feb 1, 2026

🔍 Code Quality Report

Check Status
TypeScript ✅ Passed
ESLint ✅ Passed
Architecture ✅ Passed

✅ All checks passed!

Code quality meets all standards. Ready to merge! 🚀

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.

[BUG] Locking a note and moving in the structure hierarchy dismiss the lock marker

2 participants