Opening a file directly from the command line and pasting in insert mode briefly flash the non-cloaked values
Hi, I have noticed a few bugs when using cloak.nvim which lead to leaking sensitive values, this is critical since a lot of online content can be played back in time.
Opening files directly
When opening a file directly using neovim filename there is a brief flash of unmasked values
https://github.com/user-attachments/assets/6bed7bba-8218-4a7c-a33f-717e993b68d1
Pasting content inside insert mode
When trying to copy-paste content in insert mode as for example using cmd+v, there is brief flash of unmasked value
https://github.com/user-attachments/assets/1a787d4d-c912-4fdd-b1cb-c8cc3c5d5db6
You can take a look at the implementation from my plugin - ecolog.nvim, It can be used as a nearly drop-in replacement for cloak.nvim for masking sensitive data, it provides all-in-one toolkit to work with environment variables and .env files. You can take a look at the comparisons table
There are some parts of code which can be useful for fixing them both:
This provides more aggressive approach for handling buffer read event fixes issue number 1
That overrides paste command and fixes issue 2
This should definitely be fixed, patches are welcome.
Ok, I may even contribute via pr to fixing it