Mask potential secrets in text before saving to disk.
(text: str)
| 23 | ] |
| 24 | |
| 25 | def redact_secrets(text: str) -> str: |
| 26 | """Mask potential secrets in text before saving to disk.""" |
| 27 | if not isinstance(text, str): |
| 28 | return text |
| 29 | for pattern, replacement in _SECRET_PATTERNS: |
| 30 | text = pattern.sub(replacement, text) |
| 31 | return text |
| 32 | |
| 33 | def _session_path(project_dir: str = None) -> Path: |
| 34 | """Get session file path for a project directory.""" |