Skip to content

Commit bb31ffa

Browse files
committed
Integrate ZAP automation for MCP authentication
Replaced manual authentication and session management config in rapidast-config.yml with ZAP Automation Framework integration. Added automation-framework.yml for custom MCP protocol scripts. Updated mock server to return user data in expected results array format.
1 parent 3044442 commit bb31ffa

3 files changed

Lines changed: 60 additions & 20 deletions

File tree

rapidast-config.yml

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -11,28 +11,13 @@ application:
1111
shortName: "aap-mcp-server"
1212
url: "http://localhost:3000"
1313

14-
# General scanning configuration
15-
general:
16-
# Authentication configuration for MCP protocol
17-
authentication:
18-
type: "script_based"
19-
parameters:
20-
script_name: "mcp-authentication.js"
21-
script_engine: "ECMAScript : Graal.js"
22-
script_file: "/opt/rapidast/work/scripts/zap/mcp-authentication.js"
23-
Login URL: "http://localhost:3000/mcp"
24-
credentials:
25-
token: "test-token"
26-
27-
# Session management for MCP
28-
session_management:
29-
script_name: "mcp-session-management.js"
30-
script_engine: "ECMAScript : Graal.js"
31-
script_file: "/opt/rapidast/work/scripts/zap/mcp-session-management.js"
32-
3314
# Scanner configurations
3415
scanners:
3516
zap:
17+
# Use ZAP Automation Framework for custom MCP authentication
18+
automation:
19+
fileName: "scripts/zap/automation-framework.yml"
20+
3621
# Import URLs from file for comprehensive API scanning
3722
importUrlsFromFile:
3823
fileName: "rapidast-urls.txt"

scripts/mock-aap-server.cjs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,8 @@ const server = http.createServer((req, res) => {
223223
if (pathname === "/api/gateway/v1/me/") {
224224
console.log(`${logPrefix} - Returning mock user data`);
225225
res.writeHead(200, { "Content-Type": "application/json" });
226-
res.end(JSON.stringify(mockUserData));
226+
// MCP server expects results array format
227+
res.end(JSON.stringify({ results: [mockUserData] }));
227228
return;
228229
}
229230

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
---
2+
# ZAP Automation Framework Configuration for MCP Protocol
3+
# This configures custom authentication and session management scripts
4+
# for the MCP (Model Context Protocol) used by AAP MCP Server
5+
6+
env:
7+
contexts:
8+
- name: "aap-mcp-context"
9+
urls:
10+
- "http://localhost:3000"
11+
includePaths:
12+
- "http://localhost:3000/.*"
13+
excludePaths: []
14+
authentication:
15+
method: "script"
16+
parameters:
17+
script: "MCP Authentication"
18+
scriptEngine: "ECMAScript : Graal.js"
19+
Login URL: "http://localhost:3000/mcp"
20+
verification:
21+
method: "response"
22+
loggedInRegex: "\\Q{\"result\":\\E"
23+
loggedOutRegex: "\\Qerror\\E"
24+
sessionManagement:
25+
method: "script"
26+
parameters:
27+
script: "MCP Session Management"
28+
scriptEngine: "ECMAScript : Graal.js"
29+
users:
30+
- name: "test-user"
31+
credentials:
32+
token: "test-token"
33+
34+
parameters:
35+
failOnError: true
36+
failOnWarning: false
37+
progressToStdout: true
38+
39+
jobs:
40+
- type: script
41+
parameters:
42+
action: add
43+
name: "MCP Authentication"
44+
type: authentication
45+
engine: "ECMAScript : Graal.js"
46+
file: "/opt/rapidast/work/scripts/zap/mcp-authentication.js"
47+
48+
- type: script
49+
parameters:
50+
action: add
51+
name: "MCP Session Management"
52+
type: session
53+
engine: "ECMAScript : Graal.js"
54+
file: "/opt/rapidast/work/scripts/zap/mcp-session-management.js"

0 commit comments

Comments
 (0)