From e0bf591081c9e83183f5771936a3f6c6425963f0 Mon Sep 17 00:00:00 2001 From: Yann Stepienik Date: Fri, 6 Oct 2023 17:21:14 +0100 Subject: [PATCH] [release] v0.10.0-unstable25 --- package.json | 2 +- src/utils/middleware.go | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 16bf149..88e6f8c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "cosmos-server", - "version": "0.10.0-unstable24", + "version": "0.10.0-unstable25", "description": "", "main": "test-server.js", "bugs": { diff --git a/src/utils/middleware.go b/src/utils/middleware.go index 0b2069a..9f29b93 100644 --- a/src/utils/middleware.go +++ b/src/utils/middleware.go @@ -301,8 +301,12 @@ func Restrictions(RestrictToConstellation bool, WhitelistInboundIPs []string) fu } } + isInConstellationBlocking := !RestrictToConstellation || isInConstellation + isWhitelistBlocking := !isUsingWhiteList || isInWhitelist + // check if the request is coming from the constellation IP range 192.168.201.0/24 - if (RestrictToConstellation && !isInConstellation && (!isUsingWhiteList || !isInWhitelist)) || (!RestrictToConstellation && (!isUsingWhiteList || !isInWhitelist)) { + if (isInConstellationBlocking && isWhitelistBlocking) { + utils.Log("Request from " + ip + " is blocked because of restrictions isInConstellationBlocking: " + fmt.Sprintf("%v", isInConstellationBlocking) + " and isWhitelistBlocking: " + fmt.Sprintf("%v", isWhitelistBlocking) http.Error(w, "Access denied", http.StatusForbidden) return }