We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent db2a48b commit c76b46fCopy full SHA for c76b46f
lua/null-ls/builtins/formatting/nix_flake_fmt.lua
@@ -259,6 +259,15 @@ end
259
local find_nix_fmt = function(opts, done)
260
done = vim.schedule_wrap(done)
261
262
+ -- A malicious project could make `nix fmt` do anything to your computer,
263
+ -- so we ask the user if the project is trusted before we do that.
264
+ local is_project_trusted = vim.secure.read(opts.root)
265
+ if not is_project_trusted then
266
+ log:warn(string.format("nix_flake_fmt disabled because project is not trusted: %s", opts.root))
267
+ done(nil)
268
+ return
269
+ end
270
+
271
local async = require("plenary.async")
272
273
local notification_title = "discovering `nix fmt` entrypoint"
0 commit comments