From 3dddaffa0bd1ce280b936ed84047f007703e6117 Mon Sep 17 00:00:00 2001 From: Berry Davenport Date: Wed, 17 Jan 2024 12:19:55 -0500 Subject: [PATCH] Make waf-controller use a set rather than append operation --- .github/waf-controller.sh | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/.github/waf-controller.sh b/.github/waf-controller.sh index 34e056c9ce..08265a2628 100755 --- a/.github/waf-controller.sh +++ b/.github/waf-controller.sh @@ -56,15 +56,19 @@ for ((i=1; i <= $CIRCUIT_BREAKER; i++)); do echo "Read was successful." + ##If this is used to whitelist individual ips or cidrs, using an additive approach is what is required #Parse out IP set addresses to array - IP_ADDRESSES=($(jq -r '.IPSet.Addresses | .[]' <<< ${WAF_CONFIG})) + #IP_ADDRESSES=($(jq -r '.IPSet.Addresses | .[]' <<< ${WAF_CONFIG})) #If CIDR is already present in IP set, eject - grep -q $RUNNER_CIDRS <<< ${IP_ADDRESSES} - [[ $? -ne 0 ]] || ( echo "CIDR is present in IP Set." && exit 0 ) + #grep -q $RUNNER_CIDRS <<< ${IP_ADDRESSES} + #[[ $? -ne 0 ]] || ( echo "CIDR is present in IP Set." && exit 0 ) #Add runner CIDR to array - IP_ADDRESSES+=("$RUNNER_CIDRS") + #IP_ADDRESSES+=("$RUNNER_CIDRS") + + ##If this is used to hard set the IP set, just clobber it + IP_ADDRESSES=("$RUNNER_CIDRS") #Stringify IPs STRINGIFIED=$(echo $(IFS=" " ; echo "${IP_ADDRESSES[*]}"))