The vulnerability lies in the unredacted logging of sensitive information, specifically Telegram bot tokens that can appear in error messages or stack traces. The analysis of the provided patch (commit cf69907015b659e5025efb735ee31bd05c4ee3d5) reveals that the openclaw application was not sanitizing error output before logging.
The two key functions responsible for this were formatErrorMessage and formatUncaughtError in src/infra/errors.ts. These functions are used to convert error objects and uncaught exceptions into strings for logging purposes. Before the fix, they returned the raw error details. If an error occurred during a request to the Telegram API, the URL containing the bot token (https://api.telegram.org/bot<token>/...) could be included in the error message or stack trace, which would then be written to the logs.
The patch rectifies this by introducing a call to a new redactSensitiveText function within both formatErrorMessage and formatUncaughtError. This function uses regular expressions, including a new one specifically for Telegram tokens (/\bbot(\d{6,}:[A-Za-z0-9_-]{20,})\b/), to find and mask sensitive data before it is returned for logging. Therefore, these two functions are the direct points in the code where the vulnerability manifested.