Some checks are pending
Go Benchmark / Performance Regression Check (push) Waiting to run
Cerberus Integration / Cerberus Security Stack Integration (push) Waiting to run
Upload Coverage to Codecov / Backend Codecov Upload (push) Waiting to run
Upload Coverage to Codecov / Frontend Codecov Upload (push) Waiting to run
CodeQL - Analyze / CodeQL analysis (go) (push) Waiting to run
CodeQL - Analyze / CodeQL analysis (javascript-typescript) (push) Waiting to run
CrowdSec Integration / CrowdSec Bouncer Integration (push) Waiting to run
Docker Build, Publish & Test / build-and-push (push) Waiting to run
Docker Build, Publish & Test / Security Scan PR Image (push) Blocked by required conditions
Quality Checks / Auth Route Protection Contract (push) Waiting to run
Quality Checks / Codecov Trigger/Comment Parity Guard (push) Waiting to run
Quality Checks / Backend (Go) (push) Waiting to run
Quality Checks / Frontend (React) (push) Waiting to run
Rate Limit integration / Rate Limiting Integration (push) Waiting to run
Security Scan (PR) / Trivy Binary Scan (push) Waiting to run
Supply Chain Verification (PR) / Verify Supply Chain (push) Waiting to run
WAF integration / Coraza WAF Integration (push) Waiting to run
38 lines
1.1 KiB
Go
Executable File
38 lines
1.1 KiB
Go
Executable File
//go:build integration
|
|
// +build integration
|
|
|
|
package integration
|
|
|
|
import (
|
|
"context"
|
|
"os/exec"
|
|
"strings"
|
|
"testing"
|
|
"time"
|
|
)
|
|
|
|
// TestCorazaIntegration runs the scripts/coraza_integration.sh and ensures it completes successfully.
|
|
// This test requires Docker and docker compose access locally; it is gated behind build tag `integration`.
|
|
func TestCorazaIntegration(t *testing.T) {
|
|
if testing.Short() {
|
|
t.Skip("Skipping integration test in short mode")
|
|
}
|
|
t.Parallel()
|
|
|
|
// Ensure the script exists
|
|
cmd := exec.CommandContext(context.Background(), "bash", "./scripts/coraza_integration.sh")
|
|
// set a timeout in case something hangs
|
|
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Minute)
|
|
defer cancel()
|
|
cmd = exec.CommandContext(ctx, "bash", "./scripts/coraza_integration.sh")
|
|
|
|
out, err := cmd.CombinedOutput()
|
|
t.Logf("coraza_integration script output:\n%s", string(out))
|
|
if err != nil {
|
|
t.Fatalf("coraza integration failed: %v", err)
|
|
}
|
|
if !strings.Contains(string(out), "Coraza WAF blocked payload as expected") {
|
|
t.Fatalf("unexpected script output, expected blocking assertion not found")
|
|
}
|
|
}
|