mirror of
https://github.com/OpenRouterTeam/spawn.git
synced 2026-05-22 03:14:57 +00:00
fix(security): use grep -F for literal string matching in PATH checks (#3021)
Fixes #3019 Replace `grep -qx` with `grep -qxF` in the `ensure_in_path` function to prevent regex pattern injection. Without -F, attacker-controlled SPAWN_INSTALL_DIR or BUN_INSTALL env vars containing regex metacharacters (e.g. `/.*`) could cause false positive/negative PATH matches, potentially bypassing the symlink creation logic. Agent: issue-fixer Co-authored-by: B <6723574+louisgv@users.noreply.github.com> Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
f2044f8d62
commit
255ffbf8b7
1 changed files with 2 additions and 2 deletions
|
|
@ -169,10 +169,10 @@ ensure_in_path() {
|
|||
# 1. Check if install_dir and bun are already in the user's real PATH
|
||||
local spawn_in_path=false
|
||||
local bun_in_path=false
|
||||
if echo "${_SPAWN_ORIG_PATH}" | tr ':' '\n' | grep -qx "${install_dir}"; then
|
||||
if echo "${_SPAWN_ORIG_PATH}" | tr ':' '\n' | grep -qxF "${install_dir}"; then
|
||||
spawn_in_path=true
|
||||
fi
|
||||
if echo "${_SPAWN_ORIG_PATH}" | tr ':' '\n' | grep -qx "${bun_bin_dir}"; then
|
||||
if echo "${_SPAWN_ORIG_PATH}" | tr ':' '\n' | grep -qxF "${bun_bin_dir}"; then
|
||||
bun_in_path=true
|
||||
fi
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue