mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 04:01:23 +00:00
fix(security): redact Telegram bot tokens in errors
This commit is contained in:
@@ -49,6 +49,16 @@ describe("redactSensitiveText", () => {
|
||||
expect(output).toBe("123456…cdef");
|
||||
});
|
||||
|
||||
it("masks Telegram Bot API URL tokens", () => {
|
||||
const input =
|
||||
"GET https://api.telegram.org/bot123456:ABCDEFGHIJKLMNOPQRSTUVWXYZabcdef/getMe HTTP/1.1";
|
||||
const output = redactSensitiveText(input, {
|
||||
mode: "tools",
|
||||
patterns: defaults,
|
||||
});
|
||||
expect(output).toBe("GET https://api.telegram.org/bot123456…cdef/getMe HTTP/1.1");
|
||||
});
|
||||
|
||||
it("redacts short tokens fully", () => {
|
||||
const input = "TOKEN=shortvalue";
|
||||
const output = redactSensitiveText(input, {
|
||||
|
||||
Reference in New Issue
Block a user