Skip to content

📈 Open source, privacy-first web analytics — a cookie-less Google Analytics alternative with built-in error tracking and performance monitoring. Self-host it or use our cloud. Get started for free!

implemented Paddle IP webhook verification

Blue Mouse1d3f8e17fdb2
diff --git a/src/webhook/webhook.service.ts b/src/webhook/webhook.service.ts
index 4399fefd7..d721d4332 100644
--- a/src/webhook/webhook.service.ts
+++ b/src/webhook/webhook.service.ts
@@ -1,6 +1,7 @@
-import { Injectable, BadRequestException } from '@nestjs/common'
+import { Injectable, BadRequestException, ForbiddenException } from '@nestjs/common'
import * as crypto from 'crypto'
import * as Serialize from 'php-serialize'
+import * as _includes from 'lodash/includes'
import { AppLoggerService } from '../logger/logger.service'
const PADDLE_PUB_KEY = ` -----BEGIN PUBLIC KEY-----
@@ -77,6 +78,8 @@ export class WebhookService {
}
verifyIP(reqIP: string) {
- // TODO
+ if (!_includes(paddleWhitelistIPs, reqIP)) {
+ throw new ForbiddenException('You have no access to this endpoint')
+ }
}
}