Skip to content

Commit 629033c

Browse files
authored
Prevent Lua injection in Neovim error notifications (#3277)
### Motivation - Prevent execution of attacker-controlled Lua by removing string interpolation of error messages into generated Lua code for Neovim notifications. ### Description - Replace unsafe interpolation in `showErrorMessage` with an argument-bound call by using `vim.notify(...)` as the Lua snippet and passing the `message` via `executeLua` arguments so user text is treated as data. ### Testing - Ran the repository lint suite with `pnpm run lint`, which completed successfully. ------ [Codex Task](https://chatgpt.com/codex/cloud/tasks/task_e_6a0a285bb2708333beb624ab75faffbd)
1 parent b22870c commit 629033c

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

packages/lib-neovim-common/src/neovimApi.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,6 @@ export async function showErrorMessage(
164164
client: NeovimClient,
165165
message: string,
166166
): Promise<void> {
167-
const luaCode = `vim.notify("${message}")`;
168-
await client.executeLua(luaCode, []);
167+
const luaCode = "vim.notify(...)";
168+
await client.executeLua(luaCode, [message]);
169169
}

0 commit comments

Comments
 (0)