惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

WordPress大学
WordPress大学
Stack Overflow Blog
Stack Overflow Blog
人人都是产品经理
人人都是产品经理
Y
Y Combinator Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
D
DataBreaches.Net
GbyAI
GbyAI
Microsoft Security Blog
Microsoft Security Blog
博客园_首页
大猫的无限游戏
大猫的无限游戏
Jina AI
Jina AI
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Engineering at Meta
Engineering at Meta
IT之家
IT之家
MongoDB | Blog
MongoDB | Blog
The GitHub Blog
The GitHub Blog
月光博客
月光博客
U
Unit 42
Hugging Face - Blog
Hugging Face - Blog
博客园 - 叶小钗
腾讯CDC
B
Blog RSS Feed
博客园 - Franky
爱范儿
爱范儿

Recent Commits to openclaw:main

test: merge chat side-result checks · openclaw/openclaw@ddd2c2a test: merge cron history checks · openclaw/openclaw@f7eb746 test: merge responsive navigation shell checks · openclaw/openclaw@c2e4b47 docs(changelog): add codex oauth fixes · openclaw/openclaw@628e6cd test: merge navigation routing cases · openclaw/openclaw@5d8cecb Tests: mock channel registry bundled fallback · openclaw/openclaw@2b08233 Secrets: avoid broad web search discovery for single plugin config · openclaw/openclaw@a464f59 test: merge config view browser checks · openclaw/openclaw@20cf511 fix(status): align oauth health with runtime · openclaw/openclaw@eed7116 feat: add macOS screen snapshots for monitor preview (#67954) thanks … · openclaw/openclaw@f377db1 fix: report shared auth scopes in hello-ok (#67810) thanks @BunsDev · openclaw/openclaw@0b6c39b Auto-reply: avoid eager bundled route fallback · openclaw/openclaw@3ea1bf4 Tests: narrow session binding contract setup · openclaw/openclaw@54e4e16 fix(macOS): enable undo/redo in webchat composer text input (#34962) · openclaw/openclaw@00951dc Tests: speed up channel setup promotion · openclaw/openclaw@82b529a Docs: refresh agent instructions · openclaw/openclaw@5775fe2 fix(auth): serialize OAuth refresh across agents to fix #26322 (#67876) · openclaw/openclaw@8e79080 test: allow ollama public surface boundary test · openclaw/openclaw@7d4f1a6 Docs: add test performance guardrails · openclaw/openclaw@89706d3 Tests: restore context-engine usage proof · openclaw/openclaw@e4c4f95 Tests: slim context engine runtime coverage · openclaw/openclaw@74c198f ci: retry failed custom checkouts · openclaw/openclaw@0ee5baf test: trim duplicate provider auth onboarding cases · openclaw/openclaw@1ffc02e matrix: fix sessions_spawn --thread subagent session spawning (#67643) · openclaw/openclaw@1ce2596 test: reduce auth choice fixture churn · openclaw/openclaw@857b9cd test: mock health status config boundaries · openclaw/openclaw@9d5ab4a test: mock onboard config io boundary · openclaw/openclaw@299694d test: mock legacy state plugin boundaries · openclaw/openclaw@2713089 test: mock channel install boundaries · openclaw/openclaw@b945248 test: mock doctor preview channel boundaries · openclaw/openclaw@b1a3ad4
fix(telegram): redact raw update logs (#82945) · openclaw...
galiniliev · 2026-05-18 · via Recent Commits to openclaw:main

@@ -0,0 +1,175 @@

1+

import { describe, expect, it } from "vitest";

2+

import { stringifyTelegramRawUpdateForLog } from "./raw-update-log.js";

3+4+

describe("stringifyTelegramRawUpdateForLog", () => {

5+

it("redacts private Telegram raw update fields before verbose logging", () => {

6+

const update = {

7+

update_id: 98765,

8+

message: {

9+

message_id: 44,

10+

from: {

11+

id: 123456,

12+

is_bot: false,

13+

first_name: "Alice",

14+

last_name: "Example",

15+

username: "alice_private",

16+

language_code: "en-US",

17+

is_premium: true,

18+

},

19+

chat: {

20+

id: -1001234567890,

21+

type: "private",

22+

title: "Private Chat",

23+

username: "private_chat",

24+

},

25+

text: "please inspect https://private.example/secret",

26+

entities: [{ type: "url", offset: 15, length: 30, url: "https://private.example/entity" }],

27+

link_preview_options: { url: "https://private.example/preview" },

28+

new_chat_members: [

29+

{

30+

id: 246810,

31+

is_bot: false,

32+

first_name: "New",

33+

last_name: "Member",

34+

username: "new_member_user",

35+

language_code: "fr-CA",

36+

added_to_attachment_menu: true,

37+

},

38+

],

39+

},

40+

callback_query: {

41+

id: "callback-id",

42+

from: { id: 7777, first_name: "Bob", username: "bob_private" },

43+

data: "sensitive callback payload",

44+

},

45+

};

46+47+

const rawLog = stringifyTelegramRawUpdateForLog(update);

48+49+

expect(rawLog).toContain('"update_id":98765');

50+

expect(rawLog).toContain('"message_id":44');

51+

expect(rawLog).toContain('"text":"[redacted]"');

52+

expect(rawLog).toContain('"url":"[redacted]"');

53+

for (const privateValue of [

54+

"123456",

55+

"-1001234567890",

56+

"Alice",

57+

"Example",

58+

"alice_private",

59+

"en-US",

60+

"Private Chat",

61+

"private_chat",

62+

"please inspect",

63+

"https://private.example",

64+

"246810",

65+

"New",

66+

"Member",

67+

"new_member_user",

68+

"fr-CA",

69+

"added_to_attachment_menu",

70+

"7777",

71+

"Bob",

72+

"bob_private",

73+

"sensitive callback payload",

74+

]) {

75+

expect(rawLog).not.toContain(privateValue);

76+

}

77+

});

78+79+

it("redacts identifiers from less common Telegram update shapes", () => {

80+

const update = {

81+

update_id: 45678,

82+

business_connection: {

83+

id: "business-connection-id",

84+

user: {

85+

id: 111222,

86+

is_bot: false,

87+

first_name: "Business",

88+

username: "business_user",

89+

},

90+

user_chat_id: 333444,

91+

date: 1712345678,

92+

can_reply: true,

93+

is_enabled: true,

94+

},

95+

chat_join_request: {

96+

chat: {

97+

id: -100555666,

98+

type: "supergroup",

99+

title: "Join Request Group",

100+

username: "join_request_group",

101+

},

102+

from: {

103+

id: 777888,

104+

is_bot: false,

105+

first_name: "Joiner",

106+

username: "join_user",

107+

},

108+

user_chat_id: 999000,

109+

date: 1712345679,

110+

bio: "private bio",

111+

invite_link: {

112+

invite_link: "https://t.me/+private-invite",

113+

creator: {

114+

id: 222333,

115+

is_bot: false,

116+

first_name: "Creator",

117+

username: "invite_creator",

118+

},

119+

},

120+

},

121+

message_reaction: {

122+

chat: {

123+

id: -100111222,

124+

type: "supergroup",

125+

title: "Reaction Group",

126+

},

127+

message_id: 99,

128+

actor_chat: {

129+

id: -100333444,

130+

type: "channel",

131+

title: "Actor Channel",

132+

username: "actor_channel",

133+

},

134+

date: 1712345680,

135+

old_reaction: [],

136+

new_reaction: [],

137+

},

138+

};

139+140+

const rawLog = stringifyTelegramRawUpdateForLog(update);

141+142+

expect(rawLog).toContain('"update_id":45678');

143+

expect(rawLog).toContain('"message_id":99');

144+

expect(rawLog).toContain('"can_reply":true');

145+

expect(rawLog).toContain('"is_enabled":true');

146+

expect(rawLog).toContain('"user_chat_id":"[redacted]"');

147+

expect(rawLog).toContain('"id":"[redacted]"');

148+

for (const privateValue of [

149+

"business-connection-id",

150+

"111222",

151+

"Business",

152+

"business_user",

153+

"333444",

154+

"-100555666",

155+

"Join Request Group",

156+

"join_request_group",

157+

"777888",

158+

"Joiner",

159+

"join_user",

160+

"999000",

161+

"private bio",

162+

"https://t.me/+private-invite",

163+

"222333",

164+

"Creator",

165+

"invite_creator",

166+

"-100111222",

167+

"Reaction Group",

168+

"-100333444",

169+

"Actor Channel",

170+

"actor_channel",

171+

]) {

172+

expect(rawLog).not.toContain(privateValue);

173+

}

174+

});

175+

});