Skip to content

Instantly share code, notes, and snippets.

@BrooksCunningham
Created February 13, 2025 15:43
Show Gist options
  • Save BrooksCunningham/86c72cd41f857cc2c455181b82943e73 to your computer and use it in GitHub Desktop.
Save BrooksCunningham/86c72cd41f857cc2c455181b82943e73 to your computer and use it in GitHub Desktop.
name: WAF API Spec Demo
on:
workflow_dispatch:
jobs:
ngwaf-api-spec-job:
runs-on: ubuntu-latest
environment: production
timeout-minutes: 2
services:
sigsci:
image: signalsciences/sigsci-agent:latest
env:
SIGSCI_ACCESSKEYID: ${{ secrets.NGWAF_PETSTORE_AGENT_ACCESSKEYID }}
SIGSCI_SECRETACCESSKEY: ${{ secrets.NGWAF_PETSTORE_AGENT_SECRETACCESSKEY }}
SIGSCI_REVPROXY_LISTENER: "app1:{listener=http://0.0.0.0:8888,upstreams=https://http-me.edgecompute.app:443/,pass-host-header=false}; petstore:{listener=http://0.0.0.0:9999, upstreams=https://petstore3.swagger.io/,pass-host-header=false}"
SIGSCI_OPEN_API_SPEC_FILE: "https://petstore3.swagger.io/api/v3/openapi.json"
SIGSCI_UPLOAD_INTERVAL: "5s"
ports:
- 8888:8888
- 9999:9999
steps:
- name: Wait for NGWAF Agent
run: |
# Wait for agent to be ready
sleep 5
- name: Send requests through NGWAF
run: |
printf "\n\n#### 2 requests will be valid - HTTP-ME\n\n"
curl -si -H 'host:petstore3.swagger.io:80' -X GET 'http://0.0.0.0:8888/api/v3/user/login'
curl -si -H 'host:petstore3.swagger.io:80' -X DELETE 'http://0.0.0.0:8888/api/v3/user/alice'
printf "\n\n#### 1 request will be blocked - HTTP-ME\n\n"
curl -si -H "host:petstore3.swagger.io:80" -X POST 'http://0.0.0.0:8888/api/v3/user/bob'
- name: Wait for logs to upload
run: |
# Wait for agent to upload logs
sleep 10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment