Skip to content

Commit fdcf808

Browse files
staticoclaude
andcommitted
Disable modelineexpr and exrc in vim/nvim
Defensive hardening against modeline-style RCEs and auto-sourced local config files from untrusted project directories. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
1 parent b497e06 commit fdcf808

2 files changed

Lines changed: 4 additions & 0 deletions

File tree

.config/nvim/init.lua

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,8 @@ opt.clipboard = 'unnamedplus'
204204

205205
-- Security
206206
opt.modeline = false
207+
opt.modelineexpr = false
208+
opt.exrc = false
207209

208210
-- Visual/audio
209211
opt.visualbell = true

.vim/vimrc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,8 @@ set list " Show whitespace as special chars - see listchars
215215
set listchars=tab\ ,extends:›,precedes:‹,nbsp:·,trail:· " Unicode characters for various things
216216
set matchtime=2 " Tenths of second to hilight matching paren
217217
set nomodeline " teh hackerz!!!1
218+
set nomodelineexpr " No expression eval in modelines
219+
set noexrc " No auto-sourcing of ./.vimrc from cwd
218220
silent! set mouse=nvc " Use the mouse, but not in insert mode
219221
set nobackup " No backups left after done editing
220222
set nonumber " No line numbers to start

0 commit comments

Comments
 (0)