Skip to content

fix(logging): add runtime guard for unsafe logging methods#1219

Merged
chaliy merged 1 commit intomainfrom
fix/1179-unsafe-logging-guard
Apr 11, 2026
Merged

fix(logging): add runtime guard for unsafe logging methods#1219
chaliy merged 1 commit intomainfrom
fix/1179-unsafe-logging-guard

Conversation

@chaliy
Copy link
Copy Markdown
Contributor

@chaliy chaliy commented Apr 11, 2026

Summary

Closes #1179

  • unsafe_disable_redaction() and unsafe_log_scripts() now require BASHKIT_UNSAFE_LOGGING=1 env var to take effect
  • Without the env var, both methods are no-ops and emit a warning to stderr
  • When the env var is set, a warning is still emitted confirming unsafe logging is active
  • Updated docs/logging.md to document the env var requirement

Test plan

  • test_unsafe_methods_noop_without_env — verifies both methods are no-ops without env var
  • test_disabled_redaction — verifies methods work with env var set
  • test_script_formatting — verifies script logging works with env var
  • All 8 unit tests and 26 integration tests pass

unsafe_disable_redaction() and unsafe_log_scripts() now require
BASHKIT_UNSAFE_LOGGING=1 env var to take effect. Without it they
are no-ops that emit a warning to stderr. Prevents accidental use
in production.

Closes #1179
@chaliy chaliy merged commit 243f1b0 into main Apr 11, 2026
27 checks passed
@chaliy chaliy deleted the fix/1179-unsafe-logging-guard branch April 11, 2026 17:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

sec(logging): unsafe_disable_redaction() and unsafe_log_scripts() have no runtime guard against production use

1 participant