diff --git a/clone/myapp.js b/clone/myapp.js index 576c393..47e3846 100644 --- a/clone/myapp.js +++ b/clone/myapp.js @@ -22,6 +22,7 @@ const homepage=` ${'CLONE'.split('').map(letter => `${letter}`).join('')}
+
CLONE
` @@ -44,6 +45,12 @@ body { height: 100vh; } +.label { + position: absolute; + right: 0; + bottom: 0; +} + .header { background-color: #282c34; color: white; @@ -128,6 +135,7 @@ const dashboard = `

3%

+
CLONE
` diff --git a/exhaust/myapp.js b/exhaust/myapp.js index 6d27e44..3f93b8c 100644 --- a/exhaust/myapp.js +++ b/exhaust/myapp.js @@ -22,6 +22,7 @@ const homepage=` ${'EXHAUST'.split('').map(letter => `${letter}`).join('')}
+
EXHAUST
`; @@ -39,6 +40,12 @@ body { margin-top: 100px; } +.label { + position: absolute; + right: 0; + bottom: 0; +} + .dashboard { display: flex; height: 100vh; @@ -128,6 +135,7 @@ const dashboard = `

3%

+
EXHAUST
` diff --git a/tests/docker-compose.yaml b/tests/docker-compose.yaml index 99a5ef0..c361aff 100644 --- a/tests/docker-compose.yaml +++ b/tests/docker-compose.yaml @@ -1,4 +1,3 @@ -version: '3' services: myapp: @@ -20,6 +19,7 @@ services: - myapp - fluent - clone + - exhaust logging: driver: fluentd @@ -35,4 +35,17 @@ services: clone: container_name: clone image: clonetest + depends_on: + - fluent + logging: + driver: fluentd + + exhaust: + container_name: exhaust + build: exhaust + image: exhausttest + depends_on: + - fluent + logging: + driver: fluentd diff --git a/tests/exhaustDockerfile b/tests/exhaustDockerfile new file mode 100644 index 0000000..c56eb7c --- /dev/null +++ b/tests/exhaustDockerfile @@ -0,0 +1,10 @@ +FROM node:21-alpine +WORKDIR /usr/app +RUN npm install express +RUN npm install body-parser +RUN npm install cookie-parser +ADD myapp.js /usr/app/myapp.js +ADD files/script.js /usr/app/files/script.js +USER nobody +EXPOSE 4000 +CMD [ "node", "myapp.js" ] diff --git a/tests/runTests.sh b/tests/runTests.sh index e3f9d56..1b48f11 100755 --- a/tests/runTests.sh +++ b/tests/runTests.sh @@ -5,12 +5,15 @@ docker build -f myappDockerfile -t myapptest ../myapp/ docker build -f configmanagerDockerfile -t configmanagertest ../configmanager/ docker build -f proxyDockerfile -t proxytest ../proxy/ docker build -f cloneDockerfile -t clonetest ../clone/ +docker build -f exhaustDockerfile -t exhausttest ../exhaust/ # Delete possible container conflicts docker rm -f myapp docker rm -f configmanager docker rm -f proxy docker rm -f clone +docker rm -f exhaust +docker rm -f fluentbit # Start the application in demo mode docker-compose up -d diff --git a/tests/tests/respond-clone.sh b/tests/tests/respond-clone.sh index 96c2c78..394c8b0 100644 --- a/tests/tests/respond-clone.sh +++ b/tests/tests/respond-clone.sh @@ -33,6 +33,12 @@ config=' # Configure global config globalconfig=' { + "alert": { + "session": { + "in": "cookie", + "key": "SESSION" + } + }, "blocklistReload": 1 } ' @@ -51,7 +57,7 @@ start_time=$(date +%s.%N) tempfile=$(bash ./uuidgen.sh) # Call it once first to trigger the alert and get blocklisted -curl -v -H "x-cloud-active-defense: ACTIVE" -s http://localhost:8000/ &>/dev/null +curl -v -H "x-cloud-active-defense: ACTIVE" --cookie SESSION=c32272b9-99d8-4687-b57e-a606952ae870 -s http://localhost:8000/ &>/dev/null # Wait a little for the delay option sleep 5