kaneo (minimalist kanban) fork to experiment adding a tangled integration github.com/usekaneo/kaneo
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix(telegram): redact sensitive config, avoid re-enabling, and skip no-op updates

Tin f3debeb4 d99c8b57

+24 -7
+9 -2
apps/api/src/telegram-integration/controllers/telegram-controller.ts
··· 64 64 function sanitizeTelegramConfigForLog(rawConfig: string): string { 65 65 try { 66 66 const parsed = JSON.parse(rawConfig) as Record<string, unknown>; 67 - if ("botToken" in parsed) { 68 - parsed.botToken = "[REDACTED]"; 67 + for (const key of [ 68 + "botToken", 69 + "chatId", 70 + "threadId", 71 + "chatLabel", 72 + ] as const) { 73 + if (key in parsed) { 74 + parsed[key] = "[REDACTED]"; 75 + } 69 76 } 70 77 return JSON.stringify(parsed); 71 78 } catch {
+15 -5
apps/api/src/telegram-integration/index.ts
··· 18 18 getTelegramIntegration, 19 19 parseTelegramIntegrationConfig, 20 20 telegramIntegrationPatchBodySchema, 21 + toResponse, 21 22 } from "./controllers/telegram-controller"; 22 23 23 24 function safePublishIntegrationEvent( ··· 133 134 eq(integrationTable.projectId, projectId), 134 135 eq(integrationTable.type, "telegram"), 135 136 ), 137 + columns: { id: true }, 136 138 }); 137 139 138 140 await db ··· 147 149 target: [integrationTable.projectId, integrationTable.type], 148 150 set: { 149 151 config: JSON.stringify(config), 150 - isActive: true, 151 152 updatedAt: new Date(), 152 153 }, 153 154 }); ··· 214 215 buildNextTelegramConfigFromPatch(body, currentConfig), 215 216 ); 216 217 218 + const resolvedIsActive = 219 + body.isActive !== undefined 220 + ? body.isActive 221 + : (existing.isActive ?? true); 222 + 223 + if ( 224 + JSON.stringify(currentConfig) === JSON.stringify(nextConfig) && 225 + resolvedIsActive === (existing.isActive ?? true) 226 + ) { 227 + return c.json(toResponse(existing)); 228 + } 229 + 217 230 const validation = validateTelegramConfig(nextConfig); 218 231 if (!validation.valid) { 219 232 throw new HTTPException(400, { ··· 225 238 .update(integrationTable) 226 239 .set({ 227 240 config: JSON.stringify(nextConfig), 228 - isActive: 229 - body.isActive !== undefined 230 - ? body.isActive 231 - : (existing.isActive ?? true), 241 + isActive: resolvedIsActive, 232 242 updatedAt: new Date(), 233 243 }) 234 244 .where(eq(integrationTable.id, existing.id));