fix(log): redact the debug_requests record and write each body to a file in a per-run folder

This commit is contained in:
imSp4rky
2026-12-04 13:18:35 -07:00
parent 8e850d168e
commit 67dea28712
8 changed files with 304 additions and 212 deletions
+6 -7
View File
@@ -165,8 +165,8 @@ calls.
| `redact_paths` | bool | `true` | Mask install-root / venv / home prefixes in logged paths (`<unshackle>`, `<venv>`, `~`). Set `false` to show full paths. |
| `debug` | bool | `false` | Global debug mode. |
| `debug_keys` | bool | `false` | Log decryption keys. |
| `debug_requests` | bool | `false` | The one switch that writes an `http_request` entry for each HTTP attempt to the JSON debug log, with the text response body as received; `-d` and `debug` alone write none. With `-d` it also keeps the HTTP library logs in the console. See [Debugging HTTP traffic](../../guide/troubleshooting.md#debug-requests). |
| `debug_requests_body_limit` | int | `0` | The maximum number of bytes of a response body in an `http_request` entry. `0` or unset records the full body. unshackle cuts a longer body and records its full size. |
| `debug_requests` | bool | `false` | The one switch that writes an `http_request` entry for each HTTP attempt to the JSON debug log, and the request and response bodies as files in a folder beside it; `-d` and `debug` alone write neither. With `-d` it also keeps the HTTP library logs in the console. See [Debugging HTTP traffic](../../guide/troubleshooting.md#debug-requests). |
| `debug_requests_body_limit` | int | `0` | The maximum number of bytes of a body file of `debug_requests`. `0` or unset records the full body. unshackle cuts a longer body and records its full size. |
| `set_terminal_bg` | bool | `false` | Append the theme's background colour to output styling. |
!!! note "Effect of `set_terminal_bg`"
@@ -183,12 +183,11 @@ calls.
`debug_keys` affects **only** content-encryption keys (the `content_key`/`key` fields).
Passwords, tokens, cookies, and session tokens are **always** redacted regardless of this
setting, and KIDs, content key counts, and other metadata are always logged either way.
The `http_request` entries of `debug_requests` are the exception.
!!! danger "`debug_requests` writes secrets"
With `debug_requests` on, the JSONL file holds tokens, passwords, cookies, content keys and account data
as the servers sent them. unshackle masks only the local folder prefixes in these entries. Keep the file on
your computer. Never attach it to a report.
!!! danger "The body folder of `debug_requests` holds secrets"
With `debug_requests` on, unshackle writes the request and response bodies as sent and received to files in a
folder beside the JSONL file (`unshackle_debug_*/`), with no redaction. They hold passwords, tokens, cookies,
content keys and account data. Keep the folder on your computer. Never attach it to a report.
---