diff --git a/CHANGELOG.md b/CHANGELOG.md index 011496b..7cb32b2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,6 +25,12 @@ and versions are tracked in the repo-root `VERSION` file. timestamps and an explicit `UTC` marker when `LOG_UTC=1`, keeping Bash log formatting aligned with Base's Python CLI logs. +### Security + +- Stopped emitting the caller's unredacted argument vector when wrapper + diagnostics are enabled, preventing sensitive option and positional values + from entering terminal or persistent logs. + ### Deprecated - Deprecated the Bash-only `VERBOSE` level, `log_verbose*` helpers, and diff --git a/lib/bash/std/README.md b/lib/bash/std/README.md index fb1c6b7..9500ffb 100644 --- a/lib/bash/std/README.md +++ b/lib/bash/std/README.md @@ -312,6 +312,11 @@ set_log_category_level -l base_bash_libs.git DEBUG `base_bash_libs` DEBUG gate. The deprecated `--verbose-wrapper` continues to enable both at VERBOSE during the compatibility window. +`lib_std.sh` does not log the process argument vector automatically. Arguments +may contain credentials or other sensitive data; applications that need +invocation diagnostics should apply schema-aware redaction before calling +`log_debug`. + Use `log_is_enabled` to avoid constructing an expensive diagnostic unless a terminal or persistent sink will consume it: diff --git a/lib/bash/std/lib_std.sh b/lib/bash/std/lib_std.sh index 124b22a..1d12d0f 100644 --- a/lib/bash/std/lib_std.sh +++ b/lib/bash/std/lib_std.sh @@ -316,7 +316,6 @@ __stdlib_init__() { fi done __init_colors__ - log_debug -l base_bash_libs.std "Command line: $0 ${__SCRIPT_ARGS__[*]}" return 0 } diff --git a/lib/bash/std/tests/lib_std.bats b/lib/bash/std/tests/lib_std.bats index 9bb0450..c6e97ed 100644 --- a/lib/bash/std/tests/lib_std.bats +++ b/lib/bash/std/tests/lib_std.bats @@ -146,6 +146,7 @@ EOF [[ "$output" == *"terminal-level=5"* ]] [[ "$output" == *"library-level=5"* ]] [[ "$output" != *"deprecated"* ]] + [[ "$output" != *"Command line:"* ]] } @test "--debug-wrapper enables caller and reusable-library DEBUG" { @@ -171,6 +172,49 @@ EOF [[ "$output" == *"library-level=4"* ]] } +@test "stdlib never logs process arguments automatically" { + local script="$TEST_TMPDIR/check-argv-logging.sh" + local primary_log="$TEST_TMPDIR/check-argv-logging.log" + local primary_content secret + local separate_secret="separate-secret-191" + local inline_secret="inline-secret-191" + local positional_secret="positional-secret-191" + local url_secret="url-secret-191" + + create_script "$script" <