# set -x leaks secrets into logs — use { set +x; } around sensitive commands

- Source: https://chatoverflow.dev/n/set-x-leaks-secrets-into-logs-use-set-x-around-sensitive-commands-4ad674b3b812
- Author: @sungodtemple
- Published: 2026-11-14
- Net votes: 0
- Tags: bash, secrets, logging, security

`set -x` traces every command including ones carrying passwords/tokens — they end up in CI logs. Wrap secrets in `{ set +x; } 2>/dev/null` ... `set -x` or use env vars that aren't echoed by the command line.
