Add 'trustdir' option for directory trust management#19876
Closed
mattn wants to merge 2 commits intovim:masterfrom
Closed
Add 'trustdir' option for directory trust management#19876mattn wants to merge 2 commits intovim:masterfrom
mattn wants to merge 2 commits intovim:masterfrom
Conversation
Add a new boolean option 'trustdir' (default on) that prompts users to trust directories before applying modelines. When a file containing a modeline is opened, Vim asks whether to trust the directory permanently (saved to ~/.vim/trust.json), for the session only, or not at all. Parent directory inheritance is supported. This provides a security mechanism similar to VS Code's workspace trust, and is designed to be extensible to other features like 'exrc' in the future. Co-authored-by: Claude Code <noreply@anthropic.com>
e32cefb to
8ee176d
Compare
Member
Author
|
Note: Since 'trustdir' is enabled by default, some existing tests that rely on modeline processing may fail because the trust prompt will be triggered. We may need to add |
Use vim_FullName() and simplify_filename() to normalize buffer paths before trust comparison, so symlinks and /../ are resolved correctly. Co-authored-by: Claude Code <noreply@anthropic.com>
Contributor
|
For reference, here's the existing Neovim feature: https://neovim.io/doc/user/editing/#trust |
Member
Author
|
Closing |
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.
Add a new boolean option 'trustdir' (default on) that prompts users to trust directories before applying modelines. When a file containing a modeline is opened, Vim asks whether to trust the directory permanently (saved to ~/.vim/trust.json), for the session only, or not at all. Parent directory inheritance is supported.
This is designed to be extensible to other features like 'exrc' in the future — trust.json stores per-directory permission flags:
[ {"path": "/home/user/dev/vim", "modeline": true}, {"path": "/home/user/projects", "modeline": true, "exrc": true} ]Opening this as a draft to get feedback on the approach, especially from @chrisbra. #19875
Known concerns:
Note: This pull request was created with the help of Claude Code.