@@ -94,21 +94,80 @@ jobs:
9494 --name ${{ matrix.target }}-test \
9595 --env-file "${{ matrix.target }}.env" \
9696 "${{ matrix.target }}-verification"
97- sleep 30
98- docker logs ${{ matrix.target }}-test
9997
10098 - name : Verify ${{ matrix.target }}
10199 run : |
102- [ $(docker inspect ${{ matrix.target }}-test --format='{{.State.Running}}') = 'true' ]
100+ HOST_AND_PORT="localhost:8080"
101+ counter=10
102+ while [ ${counter} -gt 0 ]; do
103+ printf "Checking whether container is running..."
104+ if [ $(docker inspect ${{ matrix.target }}-test --format='{{.State.Running}}') = 'true' ]; then
105+ echo "...ok"
106+ printf "Trying to connect..."
107+ if curl -s --connect-timeout 5; then
108+ echo "...ok"
109+ break
110+ fi
111+ fi
112+
113+ echo "...failed"
114+ ((counter--))
115+ if [ ${counter} -gt 0 ]; then
116+ echo "Will retry in 5 seconds"
117+ sleep 5
118+ else
119+ echo "No more retries"
120+ docker logs ${{ matrix.target }}-test
121+ exit 1
122+ fi
123+ done
124+
103125 if grep -q "nginx "<<< "${{ matrix.target }}"; then
104- curl -q -D headers.txt http://localhost:8080/?test=../../etc/passwd
126+ echo "### nginx tests ###"
127+
128+ printf "Storing headers for sample attack..."
129+ curl -q -D headers.txt "${HOST_AND_PORT}/?test=../../etc/passwd"
130+ printf "...done\n\n"
131+
132+ printf "Check status 403..."
105133 grep -q "HTTP/1.1 403 Forbidden" headers.txt
134+ printf "...yes\n\n"
135+
136+ printf "Check 'Access-Control-Allow-Origin' header..."
106137 grep -q "Access-Control-Allow-Origin: *" headers.txt
138+ printf "...yes\n\n"
139+
140+ printf "Check 'Access-Control-Max-Age' header..."
107141 grep -q "Access-Control-Max-Age: 3600" headers.txt
142+ printf "...yes\n\n"
143+
144+ printf "Check 'Access-Control-Allow-Methods' header..."
108145 grep -q "Access-Control-Allow-Methods: GET, POST, PUT, DELETE, OPTIONS" headers.txt
146+ printf "...yes\n\n"
147+
148+ printf "Check 'Access-Control-Allow-Headers'..."
109149 grep -q "Access-Control-Allow-Headers: *" headers.txt
150+ printf "...yes\n\n"
151+
152+ echo "### nginx tests - done ###"
110153 fi
111154
155+ echo "### generic tests ###"
156+
157+ echo "Test HTTP/2 upgrade..."
158+ curl -v --http2 "${HOST_AND_PORT}" 2>&1 | tee out.txt
159+ grep -iP "101 Switching Protocols|HTTP/2 200" < out.txt | tee out2.txt
160+ wc -l out2.txt | xargs -I % test % -eq 2
161+ rm out*.txt
162+ echo "...yes"
163+
164+ echo "Test HTTP/2 prior knowledge..."
165+ curl -v --http2-prior-knowledge "${HOST_AND_PORT}" 2>&1 | tee out.txt
166+ grep -i "HTTP/2 200" < out.txt
167+ echo "...yes"
168+
169+ echo "### generic tests - done ###"
170+
112171 - name : Checkout CRS
113172 uses : actions/checkout@v4
114173 with :
0 commit comments