@zivis/mcp 0.1.0-alpha.21 → 0.1.0-alpha.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/pattern-pack/index.d.ts +133 -0
- package/dist/pattern-pack/index.js +212 -0
- package/dist/pattern-pack/index.js.map +1 -0
- package/dist/pattern-packs/zivis-public-0.1.0/capsules/agents/privilege-separation.yaml +228 -0
- package/dist/pattern-packs/zivis-public-0.1.0/capsules/prompting/self-consistency-no-isolation.yaml +240 -0
- package/dist/pattern-packs/zivis-public-0.1.0/capsules/security/late-org-filter.yaml +270 -0
- package/dist/pattern-packs/zivis-public-0.1.0/manifest.json +68 -0
- package/dist/pattern-packs/zivis-public-0.1.0/prompts/agents/privilege-separation/identify.md +54 -0
- package/dist/pattern-packs/zivis-public-0.1.0/prompts/prompting/self-consistency-no-isolation/identify.md +60 -0
- package/dist/pattern-packs/zivis-public-0.1.0/prompts/security/late-org-filter/identify.md +78 -0
- package/dist/prompts/index.d.ts +1 -1
- package/dist/prompts/index.js +1 -7
- package/dist/prompts/index.js.map +1 -1
- package/dist/server.js +26 -166
- package/dist/server.js.map +1 -1
- package/dist/tools/enterprise/get-threat-model-artifact.d.ts +30 -0
- package/dist/tools/enterprise/get-threat-model-artifact.js +80 -0
- package/dist/tools/enterprise/get-threat-model-artifact.js.map +1 -0
- package/dist/tools/enterprise/get-threat-model.d.ts +1 -1
- package/dist/tools/enterprise/get-threat-model.js +59 -11
- package/dist/tools/enterprise/get-threat-model.js.map +1 -1
- package/dist/tools/enterprise/list-threat-model-artifacts.d.ts +67 -0
- package/dist/tools/enterprise/list-threat-model-artifacts.js +121 -0
- package/dist/tools/enterprise/list-threat-model-artifacts.js.map +1 -0
- package/dist/tools/enterprise/manage-data-asset.d.ts +1 -1
- package/dist/tools/enterprise/manage-data-flow.d.ts +1 -1
- package/dist/tools/enterprise/manage-test-case.d.ts +1 -1
- package/dist/tools/inspect.d.ts +31 -0
- package/dist/tools/inspect.js +100 -0
- package/dist/tools/inspect.js.map +1 -0
- package/dist/tools/manage-application.d.ts +1 -1
- package/dist/tools/security-review.js +67 -50
- package/dist/tools/security-review.js.map +1 -1
- package/dist/tools/threat-get-capsule.d.ts +25 -0
- package/dist/tools/threat-get-capsule.js +64 -0
- package/dist/tools/threat-get-capsule.js.map +1 -0
- package/dist/tools/threat-get-inference-prompt.d.ts +32 -0
- package/dist/tools/threat-get-inference-prompt.js +91 -0
- package/dist/tools/threat-get-inference-prompt.js.map +1 -0
- package/dist/tools/threat-list-relevant-capsules.d.ts +30 -0
- package/dist/tools/threat-list-relevant-capsules.js +176 -0
- package/dist/tools/threat-list-relevant-capsules.js.map +1 -0
- package/package.json +10 -3
- package/dist/prompts/prep-for-launch.d.ts +0 -9
- package/dist/prompts/prep-for-launch.js +0 -62
- package/dist/prompts/prep-for-launch.js.map +0 -1
- package/dist/prompts/secure-my-app.d.ts +0 -9
- package/dist/prompts/secure-my-app.js +0 -70
- package/dist/prompts/secure-my-app.js.map +0 -1
- package/dist/prompts/weekly-check.d.ts +0 -9
- package/dist/prompts/weekly-check.js +0 -48
- package/dist/prompts/weekly-check.js.map +0 -1
- package/dist/tools/enterprise/capture-evidence.d.ts +0 -54
- package/dist/tools/enterprise/capture-evidence.js +0 -72
- package/dist/tools/enterprise/capture-evidence.js.map +0 -1
- package/dist/tools/enterprise/create-report-ticket.d.ts +0 -34
- package/dist/tools/enterprise/create-report-ticket.js +0 -44
- package/dist/tools/enterprise/create-report-ticket.js.map +0 -1
- package/dist/tools/enterprise/end-pentest-session.d.ts +0 -33
- package/dist/tools/enterprise/end-pentest-session.js +0 -42
- package/dist/tools/enterprise/end-pentest-session.js.map +0 -1
- package/dist/tools/enterprise/generate-report.d.ts +0 -55
- package/dist/tools/enterprise/generate-report.js +0 -111
- package/dist/tools/enterprise/generate-report.js.map +0 -1
- package/dist/tools/enterprise/get-campaign.d.ts +0 -27
- package/dist/tools/enterprise/get-campaign.js +0 -31
- package/dist/tools/enterprise/get-campaign.js.map +0 -1
- package/dist/tools/enterprise/get-report-status.d.ts +0 -27
- package/dist/tools/enterprise/get-report-status.js +0 -38
- package/dist/tools/enterprise/get-report-status.js.map +0 -1
- package/dist/tools/enterprise/list-agents.d.ts +0 -42
- package/dist/tools/enterprise/list-agents.js +0 -95
- package/dist/tools/enterprise/list-agents.js.map +0 -1
- package/dist/tools/enterprise/list-campaigns.d.ts +0 -37
- package/dist/tools/enterprise/list-campaigns.js +0 -60
- package/dist/tools/enterprise/list-campaigns.js.map +0 -1
- package/dist/tools/enterprise/list-report-issues.d.ts +0 -36
- package/dist/tools/enterprise/list-report-issues.js +0 -50
- package/dist/tools/enterprise/list-report-issues.js.map +0 -1
- package/dist/tools/enterprise/manage-campaign-agent-instance.d.ts +0 -42
- package/dist/tools/enterprise/manage-campaign-agent-instance.js +0 -68
- package/dist/tools/enterprise/manage-campaign-agent-instance.js.map +0 -1
- package/dist/tools/enterprise/manage-campaign-target.d.ts +0 -44
- package/dist/tools/enterprise/manage-campaign-target.js +0 -70
- package/dist/tools/enterprise/manage-campaign-target.js.map +0 -1
- package/dist/tools/enterprise/manage-campaign.d.ts +0 -62
- package/dist/tools/enterprise/manage-campaign.js +0 -114
- package/dist/tools/enterprise/manage-campaign.js.map +0 -1
- package/dist/tools/enterprise/manage-finding.d.ts +0 -69
- package/dist/tools/enterprise/manage-finding.js +0 -106
- package/dist/tools/enterprise/manage-finding.js.map +0 -1
- package/dist/tools/enterprise/promote-finding-to-issue.d.ts +0 -36
- package/dist/tools/enterprise/promote-finding-to-issue.js +0 -65
- package/dist/tools/enterprise/promote-finding-to-issue.js.map +0 -1
- package/dist/tools/enterprise/publish-report-version.d.ts +0 -34
- package/dist/tools/enterprise/publish-report-version.js +0 -75
- package/dist/tools/enterprise/publish-report-version.js.map +0 -1
- package/dist/tools/enterprise/publish-test-to-library.d.ts +0 -31
- package/dist/tools/enterprise/publish-test-to-library.js +0 -40
- package/dist/tools/enterprise/publish-test-to-library.js.map +0 -1
- package/dist/tools/enterprise/record-test-result.d.ts +0 -67
- package/dist/tools/enterprise/record-test-result.js +0 -75
- package/dist/tools/enterprise/record-test-result.js.map +0 -1
- package/dist/tools/enterprise/start-pentest-session.d.ts +0 -35
- package/dist/tools/enterprise/start-pentest-session.js +0 -50
- package/dist/tools/enterprise/start-pentest-session.js.map +0 -1
- package/dist/tools/enterprise/sync-report-section.d.ts +0 -41
- package/dist/tools/enterprise/sync-report-section.js +0 -79
- package/dist/tools/enterprise/sync-report-section.js.map +0 -1
- package/dist/tools/enterprise/update-report-issue.d.ts +0 -55
- package/dist/tools/enterprise/update-report-issue.js +0 -69
- package/dist/tools/enterprise/update-report-issue.js.map +0 -1
- package/dist/tools/get-agent-test-results.d.ts +0 -41
- package/dist/tools/get-agent-test-results.js +0 -86
- package/dist/tools/get-agent-test-results.js.map +0 -1
- package/dist/tools/get-application-auth-config.d.ts +0 -27
- package/dist/tools/get-application-auth-config.js +0 -44
- package/dist/tools/get-application-auth-config.js.map +0 -1
- package/dist/tools/get-artifact-content.d.ts +0 -29
- package/dist/tools/get-artifact-content.js +0 -86
- package/dist/tools/get-artifact-content.js.map +0 -1
- package/dist/tools/get-finding-details.d.ts +0 -22
- package/dist/tools/get-finding-details.js +0 -61
- package/dist/tools/get-finding-details.js.map +0 -1
- package/dist/tools/get-findings.d.ts +0 -51
- package/dist/tools/get-findings.js +0 -124
- package/dist/tools/get-findings.js.map +0 -1
- package/dist/tools/get-recon-scan.d.ts +0 -27
- package/dist/tools/get-recon-scan.js +0 -46
- package/dist/tools/get-recon-scan.js.map +0 -1
- package/dist/tools/get-scan-output.d.ts +0 -27
- package/dist/tools/get-scan-output.js +0 -64
- package/dist/tools/get-scan-output.js.map +0 -1
- package/dist/tools/get-scenario-details.d.ts +0 -27
- package/dist/tools/get-scenario-details.js +0 -46
- package/dist/tools/get-scenario-details.js.map +0 -1
- package/dist/tools/get-test-case-results.d.ts +0 -37
- package/dist/tools/get-test-case-results.js +0 -66
- package/dist/tools/get-test-case-results.js.map +0 -1
- package/dist/tools/get-test-details.d.ts +0 -29
- package/dist/tools/get-test-details.js +0 -49
- package/dist/tools/get-test-details.js.map +0 -1
- package/dist/tools/list-agent-test-cases.d.ts +0 -41
- package/dist/tools/list-agent-test-cases.js +0 -73
- package/dist/tools/list-agent-test-cases.js.map +0 -1
- package/dist/tools/list-recon-scans.d.ts +0 -36
- package/dist/tools/list-recon-scans.js +0 -74
- package/dist/tools/list-recon-scans.js.map +0 -1
- package/dist/tools/list-scan-artifacts.d.ts +0 -41
- package/dist/tools/list-scan-artifacts.js +0 -63
- package/dist/tools/list-scan-artifacts.js.map +0 -1
- package/dist/tools/list-scans.d.ts +0 -38
- package/dist/tools/list-scans.js +0 -125
- package/dist/tools/list-scans.js.map +0 -1
- package/dist/tools/list-test-library.d.ts +0 -44
- package/dist/tools/list-test-library.js +0 -83
- package/dist/tools/list-test-library.js.map +0 -1
- package/dist/tools/list-test-scenarios.d.ts +0 -25
- package/dist/tools/list-test-scenarios.js +0 -94
- package/dist/tools/list-test-scenarios.js.map +0 -1
- package/dist/tools/local-scan.d.ts +0 -40
- package/dist/tools/local-scan.js +0 -261
- package/dist/tools/local-scan.js.map +0 -1
- package/dist/tools/run-test-scenario.d.ts +0 -37
- package/dist/tools/run-test-scenario.js +0 -70
- package/dist/tools/run-test-scenario.js.map +0 -1
- package/dist/tools/scan-pr.d.ts +0 -27
- package/dist/tools/scan-pr.js +0 -51
- package/dist/tools/scan-pr.js.map +0 -1
- package/dist/tools/setup-red-team-target.d.ts +0 -73
- package/dist/tools/setup-red-team-target.js +0 -461
- package/dist/tools/setup-red-team-target.js.map +0 -1
- package/dist/tools/triage-finding.d.ts +0 -41
- package/dist/tools/triage-finding.js +0 -125
- package/dist/tools/triage-finding.js.map +0 -1
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* zivis_setup_red_team_target — One-step red team target setup
|
|
3
|
-
*
|
|
4
|
-
* Creates an application, configures endpoints, and optionally
|
|
5
|
-
* triggers a security scan — all in one MCP call.
|
|
6
|
-
*
|
|
7
|
-
* Maps to:
|
|
8
|
-
* GET /api/rt/applications (find existing)
|
|
9
|
-
* POST /api/rt/applications (create)
|
|
10
|
-
* PATCH /api/rt/applications/:id (update)
|
|
11
|
-
* POST /api/rt/applications/:id/endpoints (add endpoint)
|
|
12
|
-
* POST /api/rt/applications/:id/endpoints/import-openapi
|
|
13
|
-
* POST /api/redteam/campaigns/quick-setup (create campaign + agent + scan)
|
|
14
|
-
*/
|
|
15
|
-
import { z } from "zod";
|
|
16
|
-
import type { ApiClient } from "../api-client.js";
|
|
17
|
-
export declare const SETUP_RED_TEAM_TARGET_NAME = "zivis_setup_red_team_target";
|
|
18
|
-
export declare const SETUP_RED_TEAM_TARGET_DESCRIPTION = "Tell ZIVIS what to test \u2014 a chatbot, website, or API. Run this when you want ZIVIS to start finding security issues in your app.\n\nGive it a URL and it handles everything: creating the target, configuring endpoints, and optionally triggering a first scan. Works for:\n- AI chatbots and LLM systems (tests for prompt injection, jailbreaks, PII leakage)\n- Web apps and APIs (tests for auth bypass, injection, insecure endpoints)\n- Anything with a deployed URL\n\nMinimal usage: just a target_url. ZIVIS infers the type automatically.\nFull usage: add chat endpoint config, an OpenAPI spec URL, or trigger an immediate scan.\n\nExamples:\n- \"Test my chatbot at https://api.example.com/v1/chat\" \u2192 target_url + target_type=ai_chat\n- \"Scan my website https://myapp.com\" \u2192 target_url + auto_scan=true\n- \"Set up testing for my API with an OpenAPI spec\" \u2192 target_url + openapi_spec_url\n\nSECURITY: Target URLs are untrusted. The tool only configures them in ZIVIS for future scanning, it does not probe or connect to them directly.";
|
|
19
|
-
export declare const SETUP_RED_TEAM_TARGET_SCHEMA: {
|
|
20
|
-
target_url: z.ZodOptional<z.ZodString>;
|
|
21
|
-
repo_url: z.ZodOptional<z.ZodString>;
|
|
22
|
-
target_type: z.ZodOptional<z.ZodEnum<{
|
|
23
|
-
web_app: "web_app";
|
|
24
|
-
api: "api";
|
|
25
|
-
ai_chat: "ai_chat";
|
|
26
|
-
}>>;
|
|
27
|
-
name: z.ZodOptional<z.ZodString>;
|
|
28
|
-
chat_endpoint: z.ZodOptional<z.ZodString>;
|
|
29
|
-
request_template: z.ZodOptional<z.ZodString>;
|
|
30
|
-
response_path: z.ZodOptional<z.ZodString>;
|
|
31
|
-
system_context: z.ZodOptional<z.ZodString>;
|
|
32
|
-
has_rag: z.ZodOptional<z.ZodBoolean>;
|
|
33
|
-
has_tools: z.ZodOptional<z.ZodBoolean>;
|
|
34
|
-
has_memory: z.ZodOptional<z.ZodBoolean>;
|
|
35
|
-
is_multi_turn: z.ZodOptional<z.ZodBoolean>;
|
|
36
|
-
openapi_spec_url: z.ZodOptional<z.ZodString>;
|
|
37
|
-
auth_type: z.ZodDefault<z.ZodOptional<z.ZodEnum<{
|
|
38
|
-
none: "none";
|
|
39
|
-
static_token: "static_token";
|
|
40
|
-
}>>>;
|
|
41
|
-
bearer_token: z.ZodOptional<z.ZodString>;
|
|
42
|
-
auto_scan: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
43
|
-
campaigns: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
44
|
-
ai_red_team: "ai_red_team";
|
|
45
|
-
recon: "recon";
|
|
46
|
-
pen_test: "pen_test";
|
|
47
|
-
}>>>;
|
|
48
|
-
};
|
|
49
|
-
export declare function createSetupRedTeamTargetHandler(apiClient: ApiClient): (params: {
|
|
50
|
-
target_url?: string;
|
|
51
|
-
repo_url?: string;
|
|
52
|
-
target_type?: "ai_chat" | "web_app" | "api";
|
|
53
|
-
name?: string;
|
|
54
|
-
chat_endpoint?: string;
|
|
55
|
-
request_template?: string;
|
|
56
|
-
response_path?: string;
|
|
57
|
-
system_context?: string;
|
|
58
|
-
has_rag?: boolean;
|
|
59
|
-
has_tools?: boolean;
|
|
60
|
-
has_memory?: boolean;
|
|
61
|
-
is_multi_turn?: boolean;
|
|
62
|
-
openapi_spec_url?: string;
|
|
63
|
-
auth_type?: "none" | "static_token";
|
|
64
|
-
bearer_token?: string;
|
|
65
|
-
auto_scan?: boolean;
|
|
66
|
-
campaigns?: ("ai_red_team" | "pen_test" | "recon")[];
|
|
67
|
-
}) => Promise<{
|
|
68
|
-
content: Array<{
|
|
69
|
-
type: "text";
|
|
70
|
-
text: string;
|
|
71
|
-
}>;
|
|
72
|
-
isError?: boolean;
|
|
73
|
-
}>;
|
|
@@ -1,461 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* zivis_setup_red_team_target — One-step red team target setup
|
|
3
|
-
*
|
|
4
|
-
* Creates an application, configures endpoints, and optionally
|
|
5
|
-
* triggers a security scan — all in one MCP call.
|
|
6
|
-
*
|
|
7
|
-
* Maps to:
|
|
8
|
-
* GET /api/rt/applications (find existing)
|
|
9
|
-
* POST /api/rt/applications (create)
|
|
10
|
-
* PATCH /api/rt/applications/:id (update)
|
|
11
|
-
* POST /api/rt/applications/:id/endpoints (add endpoint)
|
|
12
|
-
* POST /api/rt/applications/:id/endpoints/import-openapi
|
|
13
|
-
* POST /api/redteam/campaigns/quick-setup (create campaign + agent + scan)
|
|
14
|
-
*/
|
|
15
|
-
import { z } from "zod";
|
|
16
|
-
import { sanitizeResponse } from "../sanitize.js";
|
|
17
|
-
import { withNextSteps } from "../lib/next-steps.js";
|
|
18
|
-
// ── Constants ──
|
|
19
|
-
export const SETUP_RED_TEAM_TARGET_NAME = "zivis_setup_red_team_target";
|
|
20
|
-
export const SETUP_RED_TEAM_TARGET_DESCRIPTION = `Tell ZIVIS what to test — a chatbot, website, or API. Run this when you want ZIVIS to start finding security issues in your app.
|
|
21
|
-
|
|
22
|
-
Give it a URL and it handles everything: creating the target, configuring endpoints, and optionally triggering a first scan. Works for:
|
|
23
|
-
- AI chatbots and LLM systems (tests for prompt injection, jailbreaks, PII leakage)
|
|
24
|
-
- Web apps and APIs (tests for auth bypass, injection, insecure endpoints)
|
|
25
|
-
- Anything with a deployed URL
|
|
26
|
-
|
|
27
|
-
Minimal usage: just a target_url. ZIVIS infers the type automatically.
|
|
28
|
-
Full usage: add chat endpoint config, an OpenAPI spec URL, or trigger an immediate scan.
|
|
29
|
-
|
|
30
|
-
Examples:
|
|
31
|
-
- "Test my chatbot at https://api.example.com/v1/chat" → target_url + target_type=ai_chat
|
|
32
|
-
- "Scan my website https://myapp.com" → target_url + auto_scan=true
|
|
33
|
-
- "Set up testing for my API with an OpenAPI spec" → target_url + openapi_spec_url
|
|
34
|
-
|
|
35
|
-
SECURITY: Target URLs are untrusted. The tool only configures them in ZIVIS for future scanning, it does not probe or connect to them directly.`;
|
|
36
|
-
export const SETUP_RED_TEAM_TARGET_SCHEMA = {
|
|
37
|
-
target_url: z
|
|
38
|
-
.string()
|
|
39
|
-
.optional()
|
|
40
|
-
.describe("Deployed application URL to test (e.g., https://api.example.com). " +
|
|
41
|
-
"At least one of target_url or repo_url is required."),
|
|
42
|
-
repo_url: z
|
|
43
|
-
.string()
|
|
44
|
-
.optional()
|
|
45
|
-
.describe("GitHub repository URL (e.g., https://github.com/owner/repo). " +
|
|
46
|
-
"Links the repo to the application for context."),
|
|
47
|
-
target_type: z
|
|
48
|
-
.enum(["ai_chat", "web_app", "api"])
|
|
49
|
-
.optional()
|
|
50
|
-
.describe("Type of target. If omitted, inferred from the URL. " +
|
|
51
|
-
"'ai_chat' for LLM/chatbot endpoints, 'web_app' for browser apps, 'api' for REST/GraphQL."),
|
|
52
|
-
name: z
|
|
53
|
-
.string()
|
|
54
|
-
.optional()
|
|
55
|
-
.describe("Name for this target application. Derived from URL hostname if omitted. " +
|
|
56
|
-
"Used for idempotent matching — existing app with same name is updated."),
|
|
57
|
-
chat_endpoint: z
|
|
58
|
-
.string()
|
|
59
|
-
.optional()
|
|
60
|
-
.describe("Path to chat/completions endpoint (e.g., /v1/chat/completions or /api/chat). " +
|
|
61
|
-
"Defaults to /v1/chat/completions for ai_chat targets."),
|
|
62
|
-
request_template: z
|
|
63
|
-
.string()
|
|
64
|
-
.optional()
|
|
65
|
-
.describe('JSON template for chat requests. Use {{message}} as placeholder. ' +
|
|
66
|
-
'Example: {"messages":[{"role":"user","content":"{{message}}"}]}'),
|
|
67
|
-
response_path: z
|
|
68
|
-
.string()
|
|
69
|
-
.optional()
|
|
70
|
-
.describe("JSONPath to extract response text (e.g., choices[0].message.content)"),
|
|
71
|
-
system_context: z
|
|
72
|
-
.string()
|
|
73
|
-
.optional()
|
|
74
|
-
.describe("Known system prompt of the target AI. Helps red team craft better attacks."),
|
|
75
|
-
has_rag: z
|
|
76
|
-
.boolean()
|
|
77
|
-
.optional()
|
|
78
|
-
.describe("Target uses Retrieval-Augmented Generation"),
|
|
79
|
-
has_tools: z
|
|
80
|
-
.boolean()
|
|
81
|
-
.optional()
|
|
82
|
-
.describe("Target has tool/function calling capabilities"),
|
|
83
|
-
has_memory: z
|
|
84
|
-
.boolean()
|
|
85
|
-
.optional()
|
|
86
|
-
.describe("Target maintains conversation memory"),
|
|
87
|
-
is_multi_turn: z
|
|
88
|
-
.boolean()
|
|
89
|
-
.optional()
|
|
90
|
-
.describe("Target supports multi-turn conversations"),
|
|
91
|
-
openapi_spec_url: z
|
|
92
|
-
.string()
|
|
93
|
-
.optional()
|
|
94
|
-
.describe("URL to OpenAPI/Swagger spec for auto-importing endpoints " +
|
|
95
|
-
"(e.g., https://api.example.com/openapi.json)"),
|
|
96
|
-
auth_type: z
|
|
97
|
-
.enum(["none", "static_token"])
|
|
98
|
-
.optional()
|
|
99
|
-
.default("none")
|
|
100
|
-
.describe("Auth method for the target. 'none' for unauthenticated testing."),
|
|
101
|
-
bearer_token: z
|
|
102
|
-
.string()
|
|
103
|
-
.optional()
|
|
104
|
-
.describe("Bearer token when auth_type is 'static_token'"),
|
|
105
|
-
auto_scan: z
|
|
106
|
-
.boolean()
|
|
107
|
-
.optional()
|
|
108
|
-
.default(false)
|
|
109
|
-
.describe("Immediately queue a red team scan after setup"),
|
|
110
|
-
campaigns: z
|
|
111
|
-
.array(z.enum(["ai_red_team", "pen_test", "recon"]))
|
|
112
|
-
.optional()
|
|
113
|
-
.describe("Campaigns to run if auto_scan is true. Defaults based on target_type."),
|
|
114
|
-
};
|
|
115
|
-
// ── Helpers ──
|
|
116
|
-
function deriveAppName(targetUrl, repoUrl) {
|
|
117
|
-
if (targetUrl) {
|
|
118
|
-
try {
|
|
119
|
-
const url = new URL(targetUrl);
|
|
120
|
-
const hostname = url.hostname;
|
|
121
|
-
if (hostname.startsWith("api.")) {
|
|
122
|
-
return hostname.replace("api.", "") + " API";
|
|
123
|
-
}
|
|
124
|
-
return hostname;
|
|
125
|
-
}
|
|
126
|
-
catch {
|
|
127
|
-
return targetUrl;
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
if (repoUrl) {
|
|
131
|
-
const match = repoUrl.match(/github\.com\/([^/]+\/[^/]+)/);
|
|
132
|
-
return match ? match[1] : "Untitled Application";
|
|
133
|
-
}
|
|
134
|
-
return "Untitled Application";
|
|
135
|
-
}
|
|
136
|
-
function inferTargetType(targetUrl, chatEndpoint) {
|
|
137
|
-
if (chatEndpoint)
|
|
138
|
-
return "ai_chat";
|
|
139
|
-
if (!targetUrl)
|
|
140
|
-
return "web_app";
|
|
141
|
-
const url = targetUrl.toLowerCase();
|
|
142
|
-
if (url.includes("/chat") ||
|
|
143
|
-
url.includes("/completions") ||
|
|
144
|
-
url.includes("/v1/") ||
|
|
145
|
-
url.includes("openai") ||
|
|
146
|
-
url.includes("anthropic")) {
|
|
147
|
-
return "ai_chat";
|
|
148
|
-
}
|
|
149
|
-
if (url.includes("/api/") || url.includes("api.")) {
|
|
150
|
-
return "api";
|
|
151
|
-
}
|
|
152
|
-
return "web_app";
|
|
153
|
-
}
|
|
154
|
-
function defaultCampaigns(targetType) {
|
|
155
|
-
switch (targetType) {
|
|
156
|
-
case "ai_chat":
|
|
157
|
-
return ["ai_red_team"];
|
|
158
|
-
case "api":
|
|
159
|
-
return ["pen_test", "recon"];
|
|
160
|
-
case "web_app":
|
|
161
|
-
return ["pen_test", "recon"];
|
|
162
|
-
default:
|
|
163
|
-
return ["recon"];
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
// ── Handler ──
|
|
167
|
-
export function createSetupRedTeamTargetHandler(apiClient) {
|
|
168
|
-
return async (params) => {
|
|
169
|
-
try {
|
|
170
|
-
// ── Step 0: Validate ──
|
|
171
|
-
if (!params.target_url && !params.repo_url) {
|
|
172
|
-
return {
|
|
173
|
-
content: [
|
|
174
|
-
{
|
|
175
|
-
type: "text",
|
|
176
|
-
text: "Error: At least one of target_url or repo_url is required.",
|
|
177
|
-
},
|
|
178
|
-
],
|
|
179
|
-
isError: true,
|
|
180
|
-
};
|
|
181
|
-
}
|
|
182
|
-
if (params.auth_type === "static_token" && !params.bearer_token) {
|
|
183
|
-
return {
|
|
184
|
-
content: [
|
|
185
|
-
{
|
|
186
|
-
type: "text",
|
|
187
|
-
text: "Error: bearer_token is required when auth_type is 'static_token'.",
|
|
188
|
-
},
|
|
189
|
-
],
|
|
190
|
-
isError: true,
|
|
191
|
-
};
|
|
192
|
-
}
|
|
193
|
-
// Validate URLs
|
|
194
|
-
const baseUrl = params.target_url;
|
|
195
|
-
if (baseUrl) {
|
|
196
|
-
try {
|
|
197
|
-
const parsed = new URL(baseUrl);
|
|
198
|
-
if (!["http:", "https:"].includes(parsed.protocol)) {
|
|
199
|
-
return {
|
|
200
|
-
content: [
|
|
201
|
-
{
|
|
202
|
-
type: "text",
|
|
203
|
-
text: "Error: target_url must use HTTP or HTTPS protocol.",
|
|
204
|
-
},
|
|
205
|
-
],
|
|
206
|
-
isError: true,
|
|
207
|
-
};
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
catch {
|
|
211
|
-
return {
|
|
212
|
-
content: [
|
|
213
|
-
{
|
|
214
|
-
type: "text",
|
|
215
|
-
text: `Error: Invalid target_url "${baseUrl}". Must be a valid URL (e.g., https://api.example.com).`,
|
|
216
|
-
},
|
|
217
|
-
],
|
|
218
|
-
isError: true,
|
|
219
|
-
};
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
// ── Step 1: Derive defaults ──
|
|
223
|
-
const appName = params.name || deriveAppName(params.target_url, params.repo_url);
|
|
224
|
-
const targetType = params.target_type ||
|
|
225
|
-
inferTargetType(params.target_url, params.chat_endpoint);
|
|
226
|
-
const authType = params.auth_type || "none";
|
|
227
|
-
// ── Step 2: Find existing application ──
|
|
228
|
-
let application = null;
|
|
229
|
-
let isNew = false;
|
|
230
|
-
try {
|
|
231
|
-
const list = await apiClient.get(`/api/rt/applications?limit=100`);
|
|
232
|
-
application =
|
|
233
|
-
(list.applications || []).find((a) => a.name.toLowerCase() === appName.toLowerCase()) || null;
|
|
234
|
-
}
|
|
235
|
-
catch {
|
|
236
|
-
// If listing fails (e.g., no apps yet), continue to create
|
|
237
|
-
}
|
|
238
|
-
// ── Step 3: Create or Update ──
|
|
239
|
-
const appPayload = {
|
|
240
|
-
name: appName,
|
|
241
|
-
...(baseUrl && { baseUrl }),
|
|
242
|
-
...(baseUrl && { apiUrl: baseUrl }),
|
|
243
|
-
authType,
|
|
244
|
-
...(params.system_context && { systemContext: params.system_context }),
|
|
245
|
-
...(params.has_rag !== undefined && { hasRag: params.has_rag }),
|
|
246
|
-
...(params.has_tools !== undefined && { hasTools: params.has_tools }),
|
|
247
|
-
...(params.has_memory !== undefined && { hasMemory: params.has_memory }),
|
|
248
|
-
...(params.is_multi_turn !== undefined && {
|
|
249
|
-
isMultiTurn: params.is_multi_turn,
|
|
250
|
-
}),
|
|
251
|
-
...(params.openapi_spec_url && {
|
|
252
|
-
openApiSpecUrl: params.openapi_spec_url,
|
|
253
|
-
}),
|
|
254
|
-
...(params.bearer_token && { bearerToken: params.bearer_token }),
|
|
255
|
-
};
|
|
256
|
-
// Set chat endpoint at application level for ai_chat targets
|
|
257
|
-
if (targetType === "ai_chat") {
|
|
258
|
-
const chatPath = params.chat_endpoint || "/v1/chat/completions";
|
|
259
|
-
appPayload.chatEndpoint = chatPath;
|
|
260
|
-
}
|
|
261
|
-
if (application) {
|
|
262
|
-
// Update existing
|
|
263
|
-
application = await apiClient.patch(`/api/rt/applications/${application.id}`, appPayload);
|
|
264
|
-
}
|
|
265
|
-
else {
|
|
266
|
-
// Create new — baseUrl is required for creation
|
|
267
|
-
if (!baseUrl) {
|
|
268
|
-
return {
|
|
269
|
-
content: [
|
|
270
|
-
{
|
|
271
|
-
type: "text",
|
|
272
|
-
text: "Error: target_url is required when creating a new application (no existing app found with this name).",
|
|
273
|
-
},
|
|
274
|
-
],
|
|
275
|
-
isError: true,
|
|
276
|
-
};
|
|
277
|
-
}
|
|
278
|
-
const createResult = await apiClient.post("/api/rt/applications", appPayload);
|
|
279
|
-
application = createResult.application;
|
|
280
|
-
isNew = true;
|
|
281
|
-
}
|
|
282
|
-
if (!application || !application.id) {
|
|
283
|
-
return {
|
|
284
|
-
content: [
|
|
285
|
-
{
|
|
286
|
-
type: "text",
|
|
287
|
-
text: "Error: Failed to create or find application. Check API credentials and permissions.",
|
|
288
|
-
},
|
|
289
|
-
],
|
|
290
|
-
isError: true,
|
|
291
|
-
};
|
|
292
|
-
}
|
|
293
|
-
// ── Step 4: Configure chat endpoint ──
|
|
294
|
-
let chatConfigured = false;
|
|
295
|
-
if (targetType === "ai_chat") {
|
|
296
|
-
const chatPath = params.chat_endpoint || "/v1/chat/completions";
|
|
297
|
-
const requestTemplate = params.request_template ||
|
|
298
|
-
'{"messages":[{"role":"user","content":"{{message}}"}]}';
|
|
299
|
-
const responsePath = params.response_path || "choices[0].message.content";
|
|
300
|
-
try {
|
|
301
|
-
await apiClient.post(`/api/rt/applications/${application.id}/endpoints`, {
|
|
302
|
-
path: chatPath,
|
|
303
|
-
method: "POST",
|
|
304
|
-
endpointType: "chat",
|
|
305
|
-
requestTemplate: requestTemplate,
|
|
306
|
-
responsePath: responsePath,
|
|
307
|
-
streamingEnabled: false,
|
|
308
|
-
summary: "AI Chat endpoint (auto-configured)",
|
|
309
|
-
requestContentType: "application/json",
|
|
310
|
-
});
|
|
311
|
-
chatConfigured = true;
|
|
312
|
-
}
|
|
313
|
-
catch (err) {
|
|
314
|
-
// 409 = endpoint already exists, that's fine
|
|
315
|
-
if (err instanceof Error && err.message.includes("409")) {
|
|
316
|
-
chatConfigured = true;
|
|
317
|
-
}
|
|
318
|
-
// Other errors: log but don't fail the whole operation
|
|
319
|
-
}
|
|
320
|
-
}
|
|
321
|
-
// ── Step 5: Import OpenAPI ──
|
|
322
|
-
let openApiImported = null;
|
|
323
|
-
if (params.openapi_spec_url) {
|
|
324
|
-
try {
|
|
325
|
-
const importResult = await apiClient.post(`/api/rt/applications/${application.id}/endpoints/import-openapi`, { specUrl: params.openapi_spec_url });
|
|
326
|
-
openApiImported = importResult.imported || importResult.endpoints?.length || 0;
|
|
327
|
-
}
|
|
328
|
-
catch {
|
|
329
|
-
// OpenAPI import failure shouldn't block setup
|
|
330
|
-
openApiImported = null;
|
|
331
|
-
}
|
|
332
|
-
}
|
|
333
|
-
// ── Step 6: Create campaign + agent + optional scan via quick-setup ──
|
|
334
|
-
const scanCampaigns = params.campaigns || defaultCampaigns(targetType);
|
|
335
|
-
let quickSetup = null;
|
|
336
|
-
if (baseUrl) {
|
|
337
|
-
try {
|
|
338
|
-
quickSetup = await apiClient.post("/api/redteam/campaigns/quick-setup", {
|
|
339
|
-
targetUrl: baseUrl,
|
|
340
|
-
targetType,
|
|
341
|
-
targetName: appName,
|
|
342
|
-
applicationId: application.id,
|
|
343
|
-
systemPrompt: params.system_context,
|
|
344
|
-
autoScan: params.auto_scan || false,
|
|
345
|
-
scanDepth: "standard",
|
|
346
|
-
campaigns: scanCampaigns,
|
|
347
|
-
authConfig: params.bearer_token
|
|
348
|
-
? { type: "bearer", token: params.bearer_token }
|
|
349
|
-
: { type: "none" },
|
|
350
|
-
});
|
|
351
|
-
}
|
|
352
|
-
catch {
|
|
353
|
-
// Campaign setup failure shouldn't block the response
|
|
354
|
-
}
|
|
355
|
-
}
|
|
356
|
-
// ── Step 7: Build response ──
|
|
357
|
-
const nextSteps = [];
|
|
358
|
-
if (authType === "none") {
|
|
359
|
-
nextSteps.push("Add authentication credentials in the ZIVIS dashboard for deeper testing");
|
|
360
|
-
}
|
|
361
|
-
if (quickSetup?.scan?.id) {
|
|
362
|
-
nextSteps.push(`Monitor scan progress at https://app.zivis.ai/rt/scans/${quickSetup.scan.id}`);
|
|
363
|
-
}
|
|
364
|
-
else if (!params.auto_scan) {
|
|
365
|
-
nextSteps.push("Run a scan with auto_scan=true or from the ZIVIS dashboard");
|
|
366
|
-
}
|
|
367
|
-
if (!params.openapi_spec_url && targetType === "api") {
|
|
368
|
-
nextSteps.push("Provide an openapi_spec_url to auto-import all API endpoints");
|
|
369
|
-
}
|
|
370
|
-
const result = sanitizeResponse({
|
|
371
|
-
status: isNew ? "created" : "updated",
|
|
372
|
-
application: {
|
|
373
|
-
id: application.id,
|
|
374
|
-
name: appName,
|
|
375
|
-
baseUrl: baseUrl || null,
|
|
376
|
-
targetType,
|
|
377
|
-
authType,
|
|
378
|
-
isNew,
|
|
379
|
-
},
|
|
380
|
-
endpoints: {
|
|
381
|
-
chatConfigured,
|
|
382
|
-
openApiImported,
|
|
383
|
-
},
|
|
384
|
-
campaign: quickSetup
|
|
385
|
-
? {
|
|
386
|
-
id: quickSetup.campaign.id,
|
|
387
|
-
name: quickSetup.campaign.name,
|
|
388
|
-
status: quickSetup.campaign.status,
|
|
389
|
-
isNew: quickSetup.status === "created",
|
|
390
|
-
}
|
|
391
|
-
: null,
|
|
392
|
-
agent: quickSetup?.agent
|
|
393
|
-
? {
|
|
394
|
-
id: quickSetup.agent.id,
|
|
395
|
-
name: quickSetup.agent.name,
|
|
396
|
-
type: quickSetup.agent.type,
|
|
397
|
-
strategy: quickSetup.agent.strategy,
|
|
398
|
-
}
|
|
399
|
-
: null,
|
|
400
|
-
scan: quickSetup?.scan?.id
|
|
401
|
-
? {
|
|
402
|
-
triggered: true,
|
|
403
|
-
scanId: quickSetup.scan.id,
|
|
404
|
-
campaigns: scanCampaigns,
|
|
405
|
-
status: quickSetup.scan.status,
|
|
406
|
-
}
|
|
407
|
-
: { triggered: false },
|
|
408
|
-
setupNotes: nextSteps,
|
|
409
|
-
});
|
|
410
|
-
const scanWasTriggered = !!quickSetup?.scan?.id;
|
|
411
|
-
return withNextSteps(result, [
|
|
412
|
-
...(scanWasTriggered
|
|
413
|
-
? [
|
|
414
|
-
{
|
|
415
|
-
id: "check_scan_results",
|
|
416
|
-
label: "Check the results of the scan that just started",
|
|
417
|
-
tool: "zivis_list_scans",
|
|
418
|
-
args_hint: { status: "running", limit: 5 },
|
|
419
|
-
why: "A scan was triggered — check back in a few minutes to see what ZIVIS finds.",
|
|
420
|
-
requires_tier: "free",
|
|
421
|
-
},
|
|
422
|
-
]
|
|
423
|
-
: [
|
|
424
|
-
{
|
|
425
|
-
id: "run_test_scenario",
|
|
426
|
-
label: "Run a security test against this target",
|
|
427
|
-
tool: "zivis_list_test_scenarios",
|
|
428
|
-
args_hint: {},
|
|
429
|
-
why: "Browse available test scenarios and pick one to run against the target you just set up.",
|
|
430
|
-
requires_tier: "free",
|
|
431
|
-
},
|
|
432
|
-
]),
|
|
433
|
-
{
|
|
434
|
-
id: "add_auth",
|
|
435
|
-
label: "Configure authentication for logged-in test coverage",
|
|
436
|
-
tool: "zivis_setup_red_team_target",
|
|
437
|
-
args_hint: { name: appName },
|
|
438
|
-
why: "Testing authenticated flows finds more vulnerabilities than unauthenticated testing alone.",
|
|
439
|
-
requires_tier: "free",
|
|
440
|
-
},
|
|
441
|
-
{
|
|
442
|
-
id: "check_deps",
|
|
443
|
-
label: "Check the dependencies this app uses",
|
|
444
|
-
tool: "zivis_check_repo_trust",
|
|
445
|
-
why: "Supply-chain risks in your libraries can be just as dangerous as app-level vulnerabilities.",
|
|
446
|
-
requires_tier: "free",
|
|
447
|
-
},
|
|
448
|
-
], `Target "${appName}" ${isNew ? "created" : "updated"}. ${scanWasTriggered ? "A scan has been triggered." : "Ready to run security tests."}`);
|
|
449
|
-
}
|
|
450
|
-
catch (err) {
|
|
451
|
-
const message = err instanceof Error
|
|
452
|
-
? err.message
|
|
453
|
-
: "Failed to set up red team target";
|
|
454
|
-
return {
|
|
455
|
-
content: [{ type: "text", text: `Error: ${message}` }],
|
|
456
|
-
isError: true,
|
|
457
|
-
};
|
|
458
|
-
}
|
|
459
|
-
};
|
|
460
|
-
}
|
|
461
|
-
//# sourceMappingURL=setup-red-team-target.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"setup-red-team-target.js","sourceRoot":"","sources":["../../src/tools/setup-red-team-target.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAErD,kBAAkB;AAElB,MAAM,CAAC,MAAM,0BAA0B,GAAG,6BAA6B,CAAC;AAExE,MAAM,CAAC,MAAM,iCAAiC,GAAG;;;;;;;;;;;;;;;gJAe+F,CAAC;AAEjJ,MAAM,CAAC,MAAM,4BAA4B,GAAG;IAC1C,UAAU,EAAE,CAAC;SACV,MAAM,EAAE;SACR,QAAQ,EAAE;SACV,QAAQ,CACP,oEAAoE;QAClE,qDAAqD,CACxD;IACH,QAAQ,EAAE,CAAC;SACR,MAAM,EAAE;SACR,QAAQ,EAAE;SACV,QAAQ,CACP,+DAA+D;QAC7D,gDAAgD,CACnD;IACH,WAAW,EAAE,CAAC;SACX,IAAI,CAAC,CAAC,SAAS,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC;SACnC,QAAQ,EAAE;SACV,QAAQ,CACP,qDAAqD;QACnD,0FAA0F,CAC7F;IACH,IAAI,EAAE,CAAC;SACJ,MAAM,EAAE;SACR,QAAQ,EAAE;SACV,QAAQ,CACP,0EAA0E;QACxE,wEAAwE,CAC3E;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reasoning back to ZIVIS
|
|
3
|
-
*
|
|
4
|
-
* Maps to: PATCH /api/findings/unified/:id
|
|
5
|
-
*
|
|
6
|
-
* This is the "write-back" that makes the platform smarter. The AI's
|
|
7
|
-
* triage decisions and reasoning are recorded as audit notes (via the
|
|
8
|
-
* `note` field), tagged as AI-generated so humans can distinguish them
|
|
9
|
-
* in the dashboard.
|
|
10
|
-
*/
|
|
11
|
-
import { z } from "zod";
|
|
12
|
-
import type { ApiClient } from "../api-client.js";
|
|
13
|
-
export declare const TRIAGE_FINDING_NAME = "zivis_triage_finding";
|
|
14
|
-
export declare const TRIAGE_FINDING_DESCRIPTION = "Mark a security issue as fixed, dismissed, or accepted. Use this after the user reviews a finding and decides what to do with it.\n\nThree outcomes:\n- \"resolve\" \u2014 the bug is fixed. ZIVIS logs the fix and generates remediation documentation.\n- \"dismiss\" \u2014 the finding is wrong (false positive) or doesn't apply to this project.\n- \"accept_risk\" \u2014 the team knows about the issue and has decided to live with it.\n\nA reasoning field is REQUIRED \u2014 this creates an audit trail. Explain briefly why the action is appropriate (e.g. \"Fixed by adding input validation in auth.ts\" or \"Not applicable \u2014 we don't accept user HTML input\").\n\nAfter resolving a finding, ZIVIS will provide markdown to append to .zivis/remediations.md as an audit trail.\n\nTriage one finding at a time. Use finding_id from zivis_get_findings or zivis_get_finding_details.";
|
|
15
|
-
export declare const TRIAGE_FINDING_SCHEMA: {
|
|
16
|
-
finding_id: z.ZodString;
|
|
17
|
-
action: z.ZodEnum<{
|
|
18
|
-
resolve: "resolve";
|
|
19
|
-
dismiss: "dismiss";
|
|
20
|
-
accept_risk: "accept_risk";
|
|
21
|
-
}>;
|
|
22
|
-
reasoning: z.ZodString;
|
|
23
|
-
dismiss_reason: z.ZodOptional<z.ZodEnum<{
|
|
24
|
-
false_positive: "false_positive";
|
|
25
|
-
not_applicable: "not_applicable";
|
|
26
|
-
wont_fix: "wont_fix";
|
|
27
|
-
duplicate: "duplicate";
|
|
28
|
-
}>>;
|
|
29
|
-
};
|
|
30
|
-
export declare function createTriageFindingHandler(apiClient: ApiClient): (params: {
|
|
31
|
-
finding_id: string;
|
|
32
|
-
action: "resolve" | "dismiss" | "accept_risk";
|
|
33
|
-
reasoning: string;
|
|
34
|
-
dismiss_reason?: string;
|
|
35
|
-
}) => Promise<{
|
|
36
|
-
content: Array<{
|
|
37
|
-
type: "text";
|
|
38
|
-
text: string;
|
|
39
|
-
}>;
|
|
40
|
-
isError?: boolean;
|
|
41
|
-
}>;
|