From 4334ee71ed862b197b93cba747546316214b12c4 Mon Sep 17 00:00:00 2001 From: Megh Parikh Date: Mon, 28 Jul 2025 15:18:54 -0400 Subject: [PATCH] Use null character ending with env Line splitting was less safe as some scripts inject `BASH_FUNC_...` env variables which have newlines in them --- cookbook/foreign_shell_scripts.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cookbook/foreign_shell_scripts.md b/cookbook/foreign_shell_scripts.md index 63d09cfc84b..aa9b8c9c919 100644 --- a/cookbook/foreign_shell_scripts.md +++ b/cookbook/foreign_shell_scripts.md @@ -101,12 +101,12 @@ def capture-foreign-env [ echo '' eval "$SCRIPT_TO_SOURCE" echo '' - env -u _ -u _AST_FEATURES -u SHLVL` # Filter out known changing variables + env -0 -u _ -u _AST_FEATURES -u SHLVL` # Filter out known changing variables } | split row '' | { before: ($in | first | str trim | lines) - after: ($in | last | str trim | lines) + after: ($in | last | str trim | split row (char --integer 0)) } # Unfortunate Assumption: