Skip to content

Commit

Permalink
fix(Telegram Trigger Node): Fix header secret check (#12018)
Browse files Browse the repository at this point in the history
  • Loading branch information
tomi authored Dec 3, 2024
1 parent 7ad4bad commit f16de4d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/nodes-base/nodes/Telegram/TelegramTrigger.node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,10 @@ export class TelegramTrigger implements INodeType {
const headerSecretBuffer = Buffer.from(
String(headerData['x-telegram-bot-api-secret-token'] ?? ''),
);
if (!crypto.timingSafeEqual(secretBuffer, headerSecretBuffer)) {
if (
secretBuffer.byteLength !== headerSecretBuffer.byteLength ||
!crypto.timingSafeEqual(secretBuffer, headerSecretBuffer)
) {
const res = this.getResponseObject();
res.status(403).json({ message: 'Provided secret is not valid' });
return {
Expand Down

0 comments on commit f16de4d

Please sign in to comment.