Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions syft/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -655,12 +655,13 @@ def bug_report(
OS details, Python configuration, virtual environments, package managers,
installed packages, and Jupyter/Colab environment detection.

The output is safe to share: it prints only versions, paths, and config
metadata. No tokens, secrets, or sensitive credentials are included.
The output is safe to share: it prints only versions and config
metadata. No tokens, secrets, paths, or PII are included.

Args:
as_dict: If True, return the report as a dictionary instead of printing.
redact_paths: If True, redact user-specific paths in the output.
redact_paths: Kept for forward and backward compatibility. By design,
the generated report contains no user-specific paths or PII to redact.

Returns:
If as_dict is True, returns a dictionary containing all collected info.
Expand Down
28 changes: 28 additions & 0 deletions tests/unit/test_bug_report.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import io
import sys
from syft.utils import bug_report


def test_bug_report_as_dict():
report = bug_report(as_dict=True)
assert isinstance(report, dict)
assert "syft" in report
assert "os_info" in report
assert "python_env" in report


def test_bug_report_redact_paths_compatibility():
report_default = bug_report(as_dict=True, redact_paths=False)
report_redacted = bug_report(as_dict=True, redact_paths=True)
assert report_default == report_redacted


def test_bug_report_stdout_safe_notes():
captured = io.StringIO()
old_stdout = sys.stdout
try:
sys.stdout = captured
bug_report(as_dict=False)
finally:
sys.stdout = old_stdout
assert "This report contains no tokens, secrets, paths, or PII." in captured.getvalue()