Skip to content

Application Security Engine support #6

Application Security Engine support

Application Security Engine support #6

name: Waap Rules Tests
on:
pull_request:
branches: [ master ]
paths:
- 'waap-configs/**.yaml'
- 'waap-configs/**.yml'
- 'waap-rules/**.yaml'
- 'waap-rules/**.yml'
- '.github/workflows/test_waap_rules.yaml'
- '.waap-tests/**'
push:
branches: [ master ]
paths:
- 'waap-configs/**.yaml'
- 'waap-configs/**.yml'
- 'waap-rules/**.yaml'
- 'waap-rules/**.yml'
- '.github/workflows/test_waap_rules.yaml'
- '.waap-tests/**'
jobs:
run-hub-tests:
runs-on: ubuntu-20.04
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v4
- uses: actions/setup-go@v4
with:
go-version: '1.21'
- name: Install requirements
run: |
sudo apt install libre2-dev
- name: Install CrowdSec
run: |
git clone https://github.com/crowdsecurity/crowdsec.git
cd crowdsec
git checkout "coraza_poc_acquis"
BUILD_STATIC=1 make release
cd crowdsec-v*
sudo ./wizard.sh --unattended
- name: Install NGINX
run: |
sudo apt install nginx
- name: Install CrowdSec NGINX Bouncer
run: |
git clone https://github.com/crowdsecurity/cs-nginx-bouncer.git
cd cs-nginx-bouncer/
git checkout waf_integration
make release
tar xzvf crowdsec-nginx-bouncer.tgz
cd crowdsec-nginx-bouncer-v*
sudo ./install.sh -y
- name: Setup NGINX Bouncer API key
run: |
sudo cscli bouncers add hubtestWaap -k "this_is_a_bad_password"
sed -i 's/API_KEY=.*$/API_KEY=this_is_a_bad_password/' /etc/crowdsec/bouncers/crowdsec-nginx-bouncer.conf
sudo systemctl restart nginx
- name: run tests on last crowdsec tag
run: |
cscli hubtest list --waap
#echo "SCENARIOS_COV=$(cscli hubtest coverage --scenarios --percent | cut -d '=' -f2)" >> $GITHUB_ENV
#SCENARIOS_COV_NUMBER=$(cscli hubtest coverage --scenarios --percent | cut -d '=' -f2 | tr -d '%' | tr -d '[[:space:]]')
#SCENARIO_BADGE_COLOR=$(if [ "$SCENARIOS_COV_NUMBER" -lt "70" ]; then echo 'red'; else echo 'green'; fi)" >> $GITHUB_ENV
- name: Create Scenarios badge
uses: schneegans/[email protected]
#if: ${{ github.ref == 'refs/heads/master' }}
if: false
with:
auth: ${{ secrets.GIST_BADGES_SECRET }}
gistID: ${{ secrets.GIST_BADGES_ID }}
filename: hub_scenarios_badge.json
label: Hub Scenarios
message: ${{ env.SCENARIOS_COV }}
color: ${{ env.SCENARIO_BADGE_COLOR }}