mirror of
https://github.com/jhd3197/ServerKit.git
synced 2026-11-10 22:13:07 +09:00
Review catch on #97. The chat connection test failure log interpolated DeliveryResult.error verbatim. _deliver_webhook builds that from str(exc) on a network error, and requests embeds the full URL in its exception text -- so the line could carry a Discord/Slack/Teams webhook token or a Telegram bot token, all of which live in the URL *path*. to_dict() masks `destination` even from an admin, and /api/logs serves the log files back to the panel, so the log line leaked past the API's own masking. Dropping the reason would have restored the earlier problem of a failed test button leaving no diagnostics anywhere, so it is redacted instead: URLs keep scheme and host and lose the path, and bare bot tokens are substituted. The host is what makes the line worth keeping and is not a secret. Also normalise ChatWebhookConnection.raw_credentials() to {} when the stored JSON is well-formed but not an object. A hand-edited or corrupt row could hold `[]`, which every caller then treated as a mapping -- credentials() called .items() on it, so to_dict() and therefore the list endpoint raised before the write path was even reachable. Guarding at the source covers all callers and matches the existing categories() pattern. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>