---
name: safe-diagnostics
description: Use when collecting diagnostics without leaking secrets.
---

# Safe diagnostics

When inspecting configuration, scripts, or support bundles, verify what is actually collected and preserve secret confidentiality.

1. Inspect a diagnostic script and its sourced files before running it; check for writes, network access, credential collection, and forced success exit codes. If effects exceed the user's stated scope, explain and do not run it without appropriate authorization.
2. Treat environment variables as potentially secret, including multiline values. Never use line-oriented `printenv | cut -d= -f1` to extract names: continuation lines can expose values. Use a language's environment mapping, e.g. `python3 -c 'import os; print("\n".join(sorted(os.environ)))'`.
3. Encoding does not redact secrets; a diff against a redacted copy can expose the original. Compare locally without returning values and report only names and match status when authorized.
4. For a product support dump, inspect help and implementation to identify raw config and secret handling. Capture output privately and return only verified safe fields or statuses; do not print secret values or write them to files intended for sharing. State clearly when output is filtered.
5. Report the actual exit code, and do not treat an unconditional `exit 0` as proof that checks passed.
