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!

Merge pull request #45 from rhaxma/ip-blacklist

Andrii Reda686aa9527
diff --cc src/project/project.service.ts
index c7de0a529,98731db3f..7da1f1596
--- a/src/project/project.service.ts
+++ b/src/project/project.service.ts
@@@ -223,20 -223,12 +223,18 @@@ export class ProjectService
if (_size(_join(projectDTO.origins, ',')) > 300) throw new UnprocessableEntityException('The list of allowed origins has to be smaller than 300 symbols')
if (_size(_join(projectDTO.ipBlacklist, ',')) > 300) throw new UnprocessableEntityException('The list of allowed blacklisted IP addresses must be less than 300 characters.')
+
+ _map(projectDTO.origins, host => {
+ if (!ORIGINS_REGEX.test(_trim(host))) {
+ throw new ConflictException(`Host ${host} is not correct`)
+ }
+ })
+
_map(projectDTO.ipBlacklist, ip => {
- if (!validateIP(_trim(ip))) {
- if (!IP_REGEX.test(_trim(ip))) {
- throw new ConflictException(`IP address ${ip} is not correct`)
- }
+ if (!validateIP(_trim(ip)) && !IP_REGEX.test(_trim(ip))) {
+ throw new ConflictException(`IP address ${ip} is not correct`)
}
- });
+ })
}
// Returns amount of exirsting events starting from month