This repository demonstrates how to implement Authenticated Dynamic Application Security Testing (DAST) using OWASP ZAP on a SOAP web application with session-based authentication.
- Backend: Node.js/Express with SOAP endpoints
- Authentication: SOAP-based login with Express sessions
- Frontend: Vanilla HTML/CSS/JavaScript
- Protected Pages: Dashboard, Profile, Settings (require authentication)
- SOAP Login: Client sends XML request to
/soap/authendpoint - Session Creation: Server validates credentials and creates Express session
- Cookie Management: Session cookie (
connect.sid) maintains authentication - Protected Access: Authenticated requests access protected SOAP endpoints
The project includes comprehensive ZAP configuration for authenticated scanning:
zap-auth-script.js: JavaScript authentication script for ZAPzap-context.xml: ZAP context configuration defining scan scopezap-auth.py: Python alternative for authentication testingDockerfile: Containerizes the SOAP application
Public Endpoints:
/- Login page- Static assets (CSS, JS)
Authenticated Endpoints:
/soap/dashboard- Dashboard data via SOAP/soap/profile- User profile via SOAP/soap/settings- User settings via SOAP/dashboard.html- Dashboard page/profile.html- Profile page/settings.html- Settings page
- Node.js 18+
- Docker
- Git
# Clone the repository
git clone <repository-url>
cd authenticated-dast-soap
# Install dependencies
npm install
# Run the application
npm startThe application will be available at http://localhost:3000
- Username:
demo| Password:password - Username:
admin| Password:admin123
Test the SOAP authentication endpoint:
curl -X POST http://localhost:3000/soap/auth \
-H "Content-Type: text/xml" \
-d '<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<AuthenticateUser>
<username>demo</username>
<password>password</password>
</AuthenticateUser>
</soap:Body>
</soap:Envelope>'The .github/workflows/authenticated-dast.yml workflow provides:
- Application Build: Containerizes the SOAP app
- Service Startup: Runs the app with proper networking
- Connectivity Tests: Verifies app and SOAP endpoints
- Authenticated Scanning:
- ZAP Baseline Scan (quick security check)
- ZAP Full Scan (comprehensive security analysis)
- Coverage Verification: Ensures authenticated pages were scanned
- Artifact Upload: Stores scan reports as GitHub artifacts
- Codacy Integration: Uploads results to Codacy Security Dashboard
Add to your GitHub repository secrets:
CODACY_API_TOKEN: Your Codacy API token for security report uploads
- Push to
mainordevelopbranches - Pull requests to
mainbranch
The scan produces multiple report formats:
- JSON:
zap_full_report.json- Machine-readable results - HTML:
zap_full_report.html- Human-readable web report - Markdown:
zap_full_report.md- Documentation-friendly format
The workflow automatically:
- Counts security findings
- Verifies authenticated page coverage
- Uploads results to Codacy Security Dashboard
- Stores reports as GitHub artifacts (30-day retention)
JavaScript authentication script that:
- Performs SOAP login with credentials
- Extracts session cookies from response
- Configures ZAP to maintain authenticated session
- Defines logged-in/logged-out indicators
XML configuration that:
- Defines scan scope (target URLs)
- Configures authentication method
- Sets up user credentials
- Specifies session management
Multi-stage build that:
- Uses Node.js 18 Alpine base image
- Installs production dependencies only
- Exposes port 3000
- Optimized for CI/CD environments
This implementation demonstrates:
- SOAP Authentication: XML-based login requests
- Session Management: Express.js session cookies
- Context-based Scanning: ZAP context configuration
- Script-based Auth: Custom JavaScript authentication logic
- High: Critical vulnerabilities requiring immediate attention
- Medium: Important security issues to address
- Low: Minor security improvements
- Informational: Security-related information
Authenticated scans typically identify:
- Session management vulnerabilities
- Authorization bypass issues
- Cross-site scripting (XSS) in authenticated pages
- SQL injection in authenticated endpoints
- Insecure direct object references
If authentication fails:
- Check SOAP endpoint connectivity
- Verify credentials in ZAP context
- Review authentication script logs
- Test SOAP login manually
If authenticated pages aren't scanned:
- Verify session cookie extraction
- Check ZAP context configuration
- Review logged-in/logged-out indicators
- Examine authentication script execution
If reports aren't generated:
- Check ZAP container logs
- Verify file permissions on output directory
- Ensure sufficient scan time
- Review ZAP command parameters
- Fork the repository
- Create a feature branch
- Make your changes
- Add/update tests
- Update documentation
- Submit a pull request
This project is licensed under the MIT License - see the LICENSE file for details.