@zivis/mcp 0.1.8 → 0.1.10
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/LICENSE +201 -0
- package/README.md +19 -0
- package/dist/api-client.d.ts +2 -24
- package/dist/api-client.js +32 -52
- package/dist/auth/index.d.ts +1 -22
- package/dist/auth/index.js +17 -38
- package/dist/auth/jwt.d.ts +0 -16
- package/dist/auth/jwt.js +0 -13
- package/dist/auth/keychain.d.ts +6 -32
- package/dist/auth/keychain.js +83 -114
- package/dist/auth/oauth.d.ts +3 -32
- package/dist/auth/oauth.js +67 -61
- package/dist/auth/sessions.d.ts +5 -25
- package/dist/auth/sessions.js +20 -39
- package/dist/auth/token-refresh.d.ts +2 -22
- package/dist/auth/token-refresh.js +33 -36
- package/dist/cli.d.ts +1 -18
- package/dist/cli.js +30 -908
- package/dist/index.d.ts +0 -6
- package/dist/index.js +0 -7
- package/dist/lib/inspect-cache.d.ts +10 -0
- package/dist/lib/inspect-cache.js +75 -0
- package/dist/lib/next-steps.d.ts +27 -0
- package/dist/lib/next-steps.js +21 -0
- package/dist/matcher/ast-eval.d.ts +8 -0
- package/dist/matcher/ast-eval.js +95 -0
- package/dist/matcher/finding.d.ts +55 -0
- package/dist/matcher/finding.js +1 -0
- package/dist/matcher/index.d.ts +8 -0
- package/dist/matcher/index.js +202 -0
- package/dist/matcher/inference-candidates.d.ts +26 -0
- package/dist/matcher/inference-candidates.js +81 -0
- package/dist/matcher/walker.d.ts +7 -0
- package/dist/matcher/walker.js +71 -0
- package/dist/pattern-pack/index.d.ts +125 -0
- package/dist/pattern-pack/index.js +189 -0
- package/dist/pattern-packs/zivis-public-0.2.0/capsules/agents/privilege-separation.yaml +224 -0
- package/dist/pattern-packs/zivis-public-0.2.0/capsules/prompting/self-consistency-no-isolation.yaml +237 -0
- package/dist/pattern-packs/zivis-public-0.2.0/capsules/retrieval/context-injection-no-validator.yaml +348 -0
- package/dist/pattern-packs/zivis-public-0.2.0/capsules/security/late-org-filter.yaml +266 -0
- package/dist/pattern-packs/zivis-public-0.2.0/controls/external_validator_on_facts.yaml +37 -0
- package/dist/pattern-packs/zivis-public-0.2.0/controls/fact_validator_present.yaml +68 -0
- package/dist/pattern-packs/zivis-public-0.2.0/controls/human_approval_gate.yaml +44 -0
- package/dist/pattern-packs/zivis-public-0.2.0/controls/langgraph_state_machine_with_per_node_tools.yaml +35 -0
- package/dist/pattern-packs/zivis-public-0.2.0/controls/per_sample_retrieval_diversification.yaml +38 -0
- package/dist/pattern-packs/zivis-public-0.2.0/controls/prisma_extension_or_middleware_attaching_org_filter.yaml +31 -0
- package/dist/pattern-packs/zivis-public-0.2.0/controls/row_level_security_policy.yaml +37 -0
- package/dist/pattern-packs/zivis-public-0.2.0/controls/source_attribution_present.yaml +58 -0
- package/dist/pattern-packs/zivis-public-0.2.0/manifest.json +167 -0
- package/dist/pattern-packs/zivis-public-0.2.0/prompts/agents/privilege-separation/identify.md +54 -0
- package/dist/pattern-packs/zivis-public-0.2.0/prompts/prompting/self-consistency-no-isolation/identify.md +60 -0
- package/dist/pattern-packs/zivis-public-0.2.0/prompts/retrieval/context-injection-no-validator/identify.md +109 -0
- package/dist/pattern-packs/zivis-public-0.2.0/prompts/security/late-org-filter/identify.md +78 -0
- package/dist/project-binding.d.ts +2 -19
- package/dist/project-binding.js +38 -21
- package/dist/prompts/audit-dependencies.d.ts +2 -0
- package/dist/prompts/audit-dependencies.js +47 -0
- package/dist/prompts/getting-started.d.ts +2 -0
- package/dist/prompts/getting-started.js +37 -0
- package/dist/prompts/index.d.ts +2 -0
- package/dist/prompts/index.js +6 -0
- package/dist/resolve-application-id.d.ts +0 -4
- package/dist/resolve-application-id.js +0 -5
- package/dist/sanitize.d.ts +1 -21
- package/dist/sanitize.js +7 -41
- package/dist/server.d.ts +1 -13
- package/dist/server.js +142 -265
- package/dist/tools/artifacts.d.ts +76 -0
- package/dist/tools/artifacts.js +178 -0
- package/dist/tools/check-project.d.ts +5 -18
- package/dist/tools/check-project.js +122 -110
- package/dist/tools/check-repo-trust.d.ts +4 -19
- package/dist/tools/check-repo-trust.js +56 -47
- package/dist/tools/create-diagram.d.ts +0 -5
- package/dist/tools/create-diagram.js +0 -10
- package/dist/tools/create-document.d.ts +0 -5
- package/dist/tools/create-document.js +3 -9
- package/dist/tools/create-finding.d.ts +85 -0
- package/dist/tools/create-finding.js +136 -0
- package/dist/tools/delete-finding.d.ts +19 -0
- package/dist/tools/delete-finding.js +36 -0
- package/dist/tools/devx-run.d.ts +88 -0
- package/dist/tools/devx-run.js +175 -0
- package/dist/tools/discover-local-infra.d.ts +0 -10
- package/dist/tools/discover-local-infra.js +3 -73
- package/dist/tools/enterprise/get-org-zat.d.ts +0 -5
- package/dist/tools/enterprise/get-org-zat.js +0 -6
- package/dist/tools/explain-signal-for-diff.d.ts +34 -0
- package/dist/tools/explain-signal-for-diff.js +75 -0
- package/dist/tools/generate-diagram.d.ts +0 -6
- package/dist/tools/generate-diagram.js +21 -13
- package/dist/tools/get-application-overview.d.ts +0 -5
- package/dist/tools/get-application-overview.js +0 -6
- package/dist/tools/get-application.d.ts +0 -5
- package/dist/tools/get-application.js +0 -6
- package/dist/tools/get-diagram.d.ts +0 -5
- package/dist/tools/get-diagram.js +1 -11
- package/dist/tools/get-document.d.ts +0 -5
- package/dist/tools/get-document.js +0 -6
- package/dist/tools/get-oss-zat.d.ts +0 -5
- package/dist/tools/get-oss-zat.js +0 -7
- package/dist/tools/get-signal.d.ts +24 -0
- package/dist/tools/get-signal.js +75 -0
- package/dist/tools/get-started.d.ts +18 -0
- package/dist/tools/get-started.js +470 -0
- package/dist/tools/get-trust-keys.d.ts +0 -5
- package/dist/tools/get-trust-keys.js +0 -6
- package/dist/tools/import-openapi-endpoints.d.ts +0 -5
- package/dist/tools/import-openapi-endpoints.js +0 -6
- package/dist/tools/inspect-zat.d.ts +0 -5
- package/dist/tools/inspect-zat.js +0 -19
- package/dist/tools/inspect.d.ts +21 -0
- package/dist/tools/inspect.js +222 -0
- package/dist/tools/list-applications.d.ts +1 -6
- package/dist/tools/list-applications.js +0 -6
- package/dist/tools/list-diagrams.d.ts +0 -5
- package/dist/tools/list-diagrams.js +0 -6
- package/dist/tools/list-documents.d.ts +0 -5
- package/dist/tools/list-documents.js +0 -6
- package/dist/tools/list-endpoints.d.ts +1 -6
- package/dist/tools/list-endpoints.js +0 -6
- package/dist/tools/list-signals.d.ts +37 -0
- package/dist/tools/list-signals.js +83 -0
- package/dist/tools/manage-application.d.ts +64 -0
- package/dist/tools/manage-application.js +129 -0
- package/dist/tools/manage-diagram.d.ts +0 -5
- package/dist/tools/manage-diagram.js +0 -16
- package/dist/tools/manage-endpoint-lifecycle.d.ts +80 -0
- package/dist/tools/manage-endpoint-lifecycle.js +180 -0
- package/dist/tools/open-in-ide.d.ts +2 -14
- package/dist/tools/open-in-ide.js +0 -13
- package/dist/tools/review-change.d.ts +34 -0
- package/dist/tools/review-change.js +93 -0
- package/dist/tools/security-memory.d.ts +76 -0
- package/dist/tools/security-memory.js +202 -0
- package/dist/tools/security-review.d.ts +1 -21
- package/dist/tools/security-review.js +8 -108
- package/dist/tools/threat-get-capsule.d.ts +15 -0
- package/dist/tools/threat-get-capsule.js +53 -0
- package/dist/tools/threat-get-inference-prompt.d.ts +15 -0
- package/dist/tools/threat-get-inference-prompt.js +73 -0
- package/dist/tools/threat-list-relevant-capsules.d.ts +17 -0
- package/dist/tools/threat-list-relevant-capsules.js +158 -0
- package/dist/tools/threat-run-matcher.d.ts +17 -0
- package/dist/tools/threat-run-matcher.js +145 -0
- package/dist/tools/update-document.d.ts +0 -5
- package/dist/tools/update-document.js +3 -9
- package/dist/tools/update-endpoint.d.ts +1 -6
- package/dist/tools/update-endpoint.js +0 -7
- package/dist/tools/update-finding.d.ts +61 -0
- package/dist/tools/update-finding.js +80 -0
- package/dist/tools/update-mermaid-source.d.ts +0 -13
- package/dist/tools/update-mermaid-source.js +0 -14
- package/dist/tools/verify-trust-mark.d.ts +0 -5
- package/dist/tools/verify-trust-mark.js +0 -6
- package/dist/types.d.ts +14 -14
- package/dist/types.js +22 -28
- package/package.json +38 -15
- package/dist/api-client.js.map +0 -1
- package/dist/auth/index.js.map +0 -1
- package/dist/auth/jwt.js.map +0 -1
- package/dist/auth/keychain.js.map +0 -1
- package/dist/auth/oauth.js.map +0 -1
- package/dist/auth/sessions.js.map +0 -1
- package/dist/auth/token-refresh.js.map +0 -1
- package/dist/cli.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/project-binding.js.map +0 -1
- package/dist/resolve-application-id.js.map +0 -1
- package/dist/sanitize.js.map +0 -1
- package/dist/server.js.map +0 -1
- package/dist/tools/check-project.js.map +0 -1
- package/dist/tools/check-repo-trust.js.map +0 -1
- package/dist/tools/create-diagram.js.map +0 -1
- package/dist/tools/create-document.js.map +0 -1
- package/dist/tools/discover-local-infra.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-org-zat.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/get-threat-model.d.ts +0 -29
- package/dist/tools/enterprise/get-threat-model.js +0 -83
- package/dist/tools/enterprise/get-threat-model.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-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/list-threat-models.d.ts +0 -36
- package/dist/tools/enterprise/list-threat-models.js +0 -82
- package/dist/tools/enterprise/list-threat-models.js.map +0 -1
- package/dist/tools/enterprise/manage-actor.d.ts +0 -58
- package/dist/tools/enterprise/manage-actor.js +0 -99
- package/dist/tools/enterprise/manage-actor.js.map +0 -1
- package/dist/tools/enterprise/manage-attack-scenario.d.ts +0 -70
- package/dist/tools/enterprise/manage-attack-scenario.js +0 -89
- package/dist/tools/enterprise/manage-attack-scenario.js.map +0 -1
- package/dist/tools/enterprise/manage-component.d.ts +0 -58
- package/dist/tools/enterprise/manage-component.js +0 -90
- package/dist/tools/enterprise/manage-component.js.map +0 -1
- package/dist/tools/enterprise/manage-data-asset.d.ts +0 -53
- package/dist/tools/enterprise/manage-data-asset.js +0 -90
- package/dist/tools/enterprise/manage-data-asset.js.map +0 -1
- package/dist/tools/enterprise/manage-data-flow.d.ts +0 -57
- package/dist/tools/enterprise/manage-data-flow.js +0 -98
- package/dist/tools/enterprise/manage-data-flow.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/manage-security-control.d.ts +0 -59
- package/dist/tools/enterprise/manage-security-control.js +0 -96
- package/dist/tools/enterprise/manage-security-control.js.map +0 -1
- package/dist/tools/enterprise/manage-test-case.d.ts +0 -88
- package/dist/tools/enterprise/manage-test-case.js +0 -119
- package/dist/tools/enterprise/manage-test-case.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/generate-diagram.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-overview.js.map +0 -1
- package/dist/tools/get-application.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-diagram.js.map +0 -1
- package/dist/tools/get-document.js.map +0 -1
- package/dist/tools/get-finding-details.d.ts +0 -28
- package/dist/tools/get-finding-details.js +0 -43
- package/dist/tools/get-finding-details.js.map +0 -1
- package/dist/tools/get-findings.d.ts +0 -57
- package/dist/tools/get-findings.js +0 -103
- package/dist/tools/get-findings.js.map +0 -1
- package/dist/tools/get-oss-zat.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/get-trust-keys.js.map +0 -1
- package/dist/tools/import-openapi-endpoints.js.map +0 -1
- package/dist/tools/inspect-zat.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-applications.js.map +0 -1
- package/dist/tools/list-diagrams.js.map +0 -1
- package/dist/tools/list-documents.js.map +0 -1
- package/dist/tools/list-endpoints.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 -44
- package/dist/tools/list-scans.js +0 -91
- 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 -31
- package/dist/tools/list-test-scenarios.js +0 -66
- 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/manage-diagram.js.map +0 -1
- package/dist/tools/open-in-ide.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/security-review.js.map +0 -1
- package/dist/tools/setup-red-team-target.d.ts +0 -79
- package/dist/tools/setup-red-team-target.js +0 -430
- package/dist/tools/setup-red-team-target.js.map +0 -1
- package/dist/tools/triage-finding.d.ts +0 -47
- package/dist/tools/triage-finding.js +0 -116
- package/dist/tools/triage-finding.js.map +0 -1
- package/dist/tools/update-document.js.map +0 -1
- package/dist/tools/update-endpoint.js.map +0 -1
- package/dist/tools/update-mermaid-source.js.map +0 -1
- package/dist/tools/verify-trust-mark.js.map +0 -1
- package/dist/types.js.map +0 -1
|
@@ -0,0 +1,470 @@
|
|
|
1
|
+
import * as fs from "node:fs/promises";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import { detectProjectBinding } from "../project-binding.js";
|
|
4
|
+
import { loadActivePack, findRelevantCapsules, } from "../pattern-pack/index.js";
|
|
5
|
+
import { locateLatestArtifact } from "../lib/inspect-cache.js";
|
|
6
|
+
export const GET_STARTED_NAME = "zivis_get_started";
|
|
7
|
+
export const GET_STARTED_DESCRIPTION = `Call this FIRST on any turn where the user asks about security, vulnerabilities, code review, deployment readiness, threat modeling, dependencies, or "what should I do next." Idempotent and safe to call repeatedly — detects prior inspect runs and never re-inspects unnecessarily. Prefer this over calling zivis_inspect directly.
|
|
8
|
+
|
|
9
|
+
Use this when the user says any of:
|
|
10
|
+
- "what should I do for security on this app"
|
|
11
|
+
- "uhh, where do I start"
|
|
12
|
+
- "is my app safe" / "is my chatbot safe"
|
|
13
|
+
- "I need to do security stuff before launch"
|
|
14
|
+
- "I have an audit / pen test / customer asking about security"
|
|
15
|
+
- "check my dependencies / libraries / repos"
|
|
16
|
+
- "how do I use ZIVIS"
|
|
17
|
+
- "what can ZIVIS do for me"
|
|
18
|
+
|
|
19
|
+
This tool inspects the current project state — binding, application, scans, findings —
|
|
20
|
+
AND if a recent 'zivis inspect' artifact exists for this repo, evaluates the local
|
|
21
|
+
threat library against it to surface architectural patterns ZIVIS thinks may apply
|
|
22
|
+
(self-consistency without context isolation, late org filter, privilege separation, etc.).
|
|
23
|
+
The 'relevant_threats' field in the response is what makes this tool different from a
|
|
24
|
+
generic security menu: ZIVIS is reading the user's actual codebase via the graph
|
|
25
|
+
artifact and naming threats by their architectural shape.
|
|
26
|
+
|
|
27
|
+
Always speak to the user in threat-model language: components, flows, trust boundaries,
|
|
28
|
+
attack scenarios. Even when they don't yet know those terms — that's how they learn.
|
|
29
|
+
|
|
30
|
+
Output is a structured JSON object. Present recommended_next_steps as a numbered list
|
|
31
|
+
to the user, in order, and ask them to pick one. If relevant_threats is non-empty, lead
|
|
32
|
+
with that — it's the most concrete thing ZIVIS knows about their repo. Use the label
|
|
33
|
+
and why fields verbatim; do not invent new steps. If the user is unsure which to pick,
|
|
34
|
+
recommend the item flagged in if_user_unsure.`;
|
|
35
|
+
export const GET_STARTED_SCHEMA = {
|
|
36
|
+
concern: z
|
|
37
|
+
.string()
|
|
38
|
+
.optional()
|
|
39
|
+
.describe("Free-form sentence describing what the user wants. " +
|
|
40
|
+
"Examples: 'is my chatbot safe', 'check the libraries we use', " +
|
|
41
|
+
"'audit coming up next month', 'just deployed a new API'. " +
|
|
42
|
+
"If omitted, returns a generic getting-started menu based on project state."),
|
|
43
|
+
cwd: z
|
|
44
|
+
.string()
|
|
45
|
+
.optional()
|
|
46
|
+
.describe("Working directory to inspect (defaults to server working directory)."),
|
|
47
|
+
};
|
|
48
|
+
const INTENT_MAP = [
|
|
49
|
+
{
|
|
50
|
+
patterns: /chatbot|llm|ai chat|assistant|agent|prompt injection|jailbreak|openai|anthropic|langchain|llamaindex|cohere|together/i,
|
|
51
|
+
intent: "ai_red_team",
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
patterns: /librar|dependenc|package|npm|pip|repo|crate|gem|module|import|third.?party/i,
|
|
55
|
+
intent: "dep_audit",
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
patterns: /audit|compliance|soc\s*2|iso\s*27001|fedramp|vendor questionnaire|customer ask|certif/i,
|
|
59
|
+
intent: "pre_audit",
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
patterns: /launch|deploy|release|production|go\s*live|prod|ship/i,
|
|
63
|
+
intent: "pre_launch",
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
patterns: /finding|issue|vulnerabilit|vuln|bug|report|result|scan result/i,
|
|
67
|
+
intent: "view_findings",
|
|
68
|
+
},
|
|
69
|
+
];
|
|
70
|
+
function detectIntent(concern) {
|
|
71
|
+
if (!concern)
|
|
72
|
+
return "generic";
|
|
73
|
+
for (const { patterns, intent } of INTENT_MAP) {
|
|
74
|
+
if (patterns.test(concern))
|
|
75
|
+
return intent;
|
|
76
|
+
}
|
|
77
|
+
return "generic";
|
|
78
|
+
}
|
|
79
|
+
function stepCheckDeps() {
|
|
80
|
+
return {
|
|
81
|
+
id: "check_dependencies",
|
|
82
|
+
label: "Check the open source libraries you depend on",
|
|
83
|
+
tool: "zivis_check_repo_trust",
|
|
84
|
+
why: "Free, no setup. Catches risky AI SDKs and known-bad dependencies before they cause problems.",
|
|
85
|
+
estimated_time: "1 minute per repo",
|
|
86
|
+
requires_auth: false,
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
function stepSetupAiTarget(hint) {
|
|
90
|
+
return {
|
|
91
|
+
id: "setup_ai_target",
|
|
92
|
+
label: "Tell ZIVIS about your chatbot or AI system so it can test it",
|
|
93
|
+
tool: "zivis_setup_red_team_target",
|
|
94
|
+
args_hint: { target_type: "ai_chat", ...hint },
|
|
95
|
+
why: "ZIVIS needs to know your endpoint to run prompt-injection, jailbreak, and PII-leakage tests.",
|
|
96
|
+
estimated_time: "2 minutes",
|
|
97
|
+
requires_auth: true,
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
function stepSetupWebTarget(hint) {
|
|
101
|
+
return {
|
|
102
|
+
id: "setup_web_target",
|
|
103
|
+
label: "Register your web app or API with ZIVIS for testing",
|
|
104
|
+
tool: "zivis_setup_red_team_target",
|
|
105
|
+
args_hint: { target_type: "web_app", ...hint },
|
|
106
|
+
why: "ZIVIS needs to know your app URL to run security tests against it.",
|
|
107
|
+
estimated_time: "2 minutes",
|
|
108
|
+
requires_auth: true,
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
function stepBrowseTests() {
|
|
112
|
+
return {
|
|
113
|
+
id: "browse_test_library",
|
|
114
|
+
label: "Browse what ZIVIS can test for",
|
|
115
|
+
tool: "zivis_list_test_scenarios",
|
|
116
|
+
why: "See the menu of attack categories (prompt injection, auth bypass, data leakage, etc.) before committing to a scan.",
|
|
117
|
+
estimated_time: "30 seconds",
|
|
118
|
+
requires_auth: true,
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
function stepViewFindings(count) {
|
|
122
|
+
return {
|
|
123
|
+
id: "view_open_findings",
|
|
124
|
+
label: count
|
|
125
|
+
? `Review the ${count} open security issue${count === 1 ? "" : "s"} ZIVIS found`
|
|
126
|
+
: "Review open security issues ZIVIS found",
|
|
127
|
+
tool: "zivis_get_findings",
|
|
128
|
+
args_hint: { status: "open" },
|
|
129
|
+
why: "Look at what's been found already before starting new scans — no point duplicating work.",
|
|
130
|
+
estimated_time: "5 minutes",
|
|
131
|
+
requires_auth: true,
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
function stepRunSecurityReview() {
|
|
135
|
+
return {
|
|
136
|
+
id: "run_security_review",
|
|
137
|
+
label: "Get a security readiness summary before launch or audit",
|
|
138
|
+
tool: "zivis_security_review",
|
|
139
|
+
why: "Pulls together all open findings, past fixes, and known attack scenarios into one pre-launch checklist.",
|
|
140
|
+
estimated_time: "3 minutes",
|
|
141
|
+
requires_auth: true,
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
function stepSetupProject() {
|
|
145
|
+
return {
|
|
146
|
+
id: "setup_project",
|
|
147
|
+
label: "Connect this project to your ZIVIS org",
|
|
148
|
+
tool: "zivis_check_project",
|
|
149
|
+
why: "ZIVIS needs to know which org this project belongs to before it can run tests or store results.",
|
|
150
|
+
estimated_time: "2 minutes (run 'zivis auth init' in your terminal)",
|
|
151
|
+
requires_auth: false,
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
function stepInstallGitHubApp(installUrl) {
|
|
155
|
+
return {
|
|
156
|
+
id: "install_github_app",
|
|
157
|
+
label: "Install the ZIVIS GitHub App to enable continuous monitoring",
|
|
158
|
+
tool: "external_link",
|
|
159
|
+
args_hint: { url: installUrl },
|
|
160
|
+
why: "Linking a repo unlocks deeper analysis on every push — threat model updates automatically as architecture changes. Today this org has no GitHub App installation.",
|
|
161
|
+
estimated_time: "2 minutes",
|
|
162
|
+
requires_auth: false,
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
async function fetchState(apiClient, cwd) {
|
|
166
|
+
const detected = detectProjectBinding(cwd);
|
|
167
|
+
if (!detected) {
|
|
168
|
+
return {
|
|
169
|
+
bound: false,
|
|
170
|
+
has_application: false,
|
|
171
|
+
has_scans: false,
|
|
172
|
+
has_findings: false,
|
|
173
|
+
open_findings_count: 0,
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
const state = {
|
|
177
|
+
bound: true,
|
|
178
|
+
org_name: detected.binding.orgName,
|
|
179
|
+
has_application: false,
|
|
180
|
+
has_scans: false,
|
|
181
|
+
has_findings: false,
|
|
182
|
+
open_findings_count: 0,
|
|
183
|
+
};
|
|
184
|
+
try {
|
|
185
|
+
const appsResp = await apiClient.get("/api/rt/applications?limit=1");
|
|
186
|
+
if ((appsResp.applications?.length ?? 0) > 0 || (appsResp.total ?? 0) > 0) {
|
|
187
|
+
state.has_application = true;
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
catch {
|
|
191
|
+
}
|
|
192
|
+
try {
|
|
193
|
+
const scansResp = await apiClient.get("/api/rt/scans?limit=1");
|
|
194
|
+
if ((scansResp.scans?.length ?? 0) > 0) {
|
|
195
|
+
state.has_scans = true;
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
catch {
|
|
199
|
+
}
|
|
200
|
+
try {
|
|
201
|
+
const findingsResp = await apiClient.get("/api/findings/unified?status=open&limit=1");
|
|
202
|
+
const total = findingsResp.summary?.total ?? findingsResp.findings?.length ?? 0;
|
|
203
|
+
if (total > 0) {
|
|
204
|
+
state.has_findings = true;
|
|
205
|
+
state.open_findings_count = total;
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
catch {
|
|
209
|
+
}
|
|
210
|
+
try {
|
|
211
|
+
const gh = await apiClient.get("/api/github-app/status");
|
|
212
|
+
state.github_app_installed = gh.installed;
|
|
213
|
+
state.github_app_install_url = gh.installUrl;
|
|
214
|
+
}
|
|
215
|
+
catch {
|
|
216
|
+
state.github_app_installed = null;
|
|
217
|
+
}
|
|
218
|
+
return state;
|
|
219
|
+
}
|
|
220
|
+
function buildMenu(intent, state, concern) {
|
|
221
|
+
if (!state.bound) {
|
|
222
|
+
return {
|
|
223
|
+
headline: "Welcome to ZIVIS! First, let's connect this project to your organization so results are stored and tracked.",
|
|
224
|
+
recommended_next_steps: [
|
|
225
|
+
stepSetupProject(),
|
|
226
|
+
stepCheckDeps(),
|
|
227
|
+
stepBrowseTests(),
|
|
228
|
+
],
|
|
229
|
+
guidance_for_assistant: "Present these as a numbered list. The user should run 'zivis auth init' in their terminal to complete step 1. " +
|
|
230
|
+
"Step 2 (check_dependencies) requires no auth and can be done immediately. " +
|
|
231
|
+
"If they ask 'why' something matters, expand on the 'why' field — do not make new claims.",
|
|
232
|
+
if_user_unsure: "Recommend option 2 (check_dependencies) — it requires no setup and gives immediate results.",
|
|
233
|
+
};
|
|
234
|
+
}
|
|
235
|
+
if (state.has_findings && intent !== "dep_audit") {
|
|
236
|
+
const steps = [
|
|
237
|
+
stepViewFindings(state.open_findings_count),
|
|
238
|
+
stepCheckDeps(),
|
|
239
|
+
];
|
|
240
|
+
if (!state.has_application) {
|
|
241
|
+
steps.push(stepSetupWebTarget());
|
|
242
|
+
}
|
|
243
|
+
else {
|
|
244
|
+
steps.push(stepBrowseTests());
|
|
245
|
+
}
|
|
246
|
+
return {
|
|
247
|
+
headline: `ZIVIS sees your project (${state.org_name ?? "connected"}) and has found ${state.open_findings_count} open security issue${state.open_findings_count === 1 ? "" : "s"}.`,
|
|
248
|
+
recommended_next_steps: steps,
|
|
249
|
+
guidance_for_assistant: "Present these as a numbered list. Prioritize reviewing existing findings before starting new scans. " +
|
|
250
|
+
"If they ask 'why' something matters, expand on the 'why' field — do not make new claims.",
|
|
251
|
+
if_user_unsure: "Recommend option 1 (view_open_findings) — reviewing what's already known is the best first step.",
|
|
252
|
+
};
|
|
253
|
+
}
|
|
254
|
+
if (intent === "ai_red_team") {
|
|
255
|
+
const steps = [
|
|
256
|
+
stepSetupAiTarget(),
|
|
257
|
+
stepCheckDeps(),
|
|
258
|
+
stepBrowseTests(),
|
|
259
|
+
];
|
|
260
|
+
return {
|
|
261
|
+
headline: state.has_application
|
|
262
|
+
? `ZIVIS sees your project (${state.org_name ?? "connected"}) and has a target configured. Ready to test your AI system.`
|
|
263
|
+
: `ZIVIS sees your project (${state.org_name ?? "connected"}) but no security testing has run yet.`,
|
|
264
|
+
recommended_next_steps: steps,
|
|
265
|
+
guidance_for_assistant: "The user wants to test an AI/chatbot system. Present these as a numbered list. " +
|
|
266
|
+
"If they already have a target URL, include it in args_hint. " +
|
|
267
|
+
"If they ask 'why' something matters, expand on the 'why' field — do not make new claims.",
|
|
268
|
+
if_user_unsure: "Recommend option 1 (setup_ai_target) — setting up the chatbot as a test target is the fastest path to finding real issues.",
|
|
269
|
+
};
|
|
270
|
+
}
|
|
271
|
+
if (intent === "dep_audit") {
|
|
272
|
+
return {
|
|
273
|
+
headline: "Checking your dependencies is a great place to start — it's free, needs no setup, and often finds the most impactful issues.",
|
|
274
|
+
recommended_next_steps: [
|
|
275
|
+
stepCheckDeps(),
|
|
276
|
+
stepSetupWebTarget(),
|
|
277
|
+
stepBrowseTests(),
|
|
278
|
+
],
|
|
279
|
+
guidance_for_assistant: "Present these as a numbered list. For step 1, ask the user to share which packages they want to check " +
|
|
280
|
+
"(the GitHub org/repo of the dependency, e.g. openai/openai-python). " +
|
|
281
|
+
"If they ask 'why' something matters, expand on the 'why' field — do not make new claims.",
|
|
282
|
+
if_user_unsure: "Recommend option 1 (check_dependencies) — it works right now with no setup.",
|
|
283
|
+
};
|
|
284
|
+
}
|
|
285
|
+
if (intent === "pre_audit" || intent === "pre_launch") {
|
|
286
|
+
const steps = [
|
|
287
|
+
stepRunSecurityReview(),
|
|
288
|
+
stepCheckDeps(),
|
|
289
|
+
];
|
|
290
|
+
if (!state.has_application) {
|
|
291
|
+
steps.push(stepSetupWebTarget());
|
|
292
|
+
}
|
|
293
|
+
else {
|
|
294
|
+
steps.push(stepBrowseTests());
|
|
295
|
+
}
|
|
296
|
+
const headline = intent === "pre_audit"
|
|
297
|
+
? `ZIVIS can help you prepare for an audit. Let's get a security readiness picture first.`
|
|
298
|
+
: `ZIVIS can help you check security before you go live.`;
|
|
299
|
+
return {
|
|
300
|
+
headline,
|
|
301
|
+
recommended_next_steps: steps,
|
|
302
|
+
guidance_for_assistant: "The user has a deadline (audit or launch). Start with a security review to understand the current state, " +
|
|
303
|
+
"then address the highest-severity issues first. " +
|
|
304
|
+
"If they ask 'why' something matters, expand on the 'why' field — do not make new claims.",
|
|
305
|
+
if_user_unsure: "Recommend option 1 (run_security_review) — it gives the fastest complete picture and shows what needs to be fixed before the deadline.",
|
|
306
|
+
};
|
|
307
|
+
}
|
|
308
|
+
if (intent === "view_findings") {
|
|
309
|
+
return {
|
|
310
|
+
headline: state.has_findings
|
|
311
|
+
? `ZIVIS has ${state.open_findings_count} open finding${state.open_findings_count === 1 ? "" : "s"} for this project.`
|
|
312
|
+
: `No open findings found yet — ZIVIS may not have run a scan, or all issues are resolved.`,
|
|
313
|
+
recommended_next_steps: [
|
|
314
|
+
stepViewFindings(state.open_findings_count > 0 ? state.open_findings_count : undefined),
|
|
315
|
+
state.has_application ? stepBrowseTests() : stepSetupWebTarget(),
|
|
316
|
+
stepCheckDeps(),
|
|
317
|
+
],
|
|
318
|
+
guidance_for_assistant: "Present these as a numbered list. If the user wants to see findings, call zivis_get_findings directly. " +
|
|
319
|
+
"If they ask 'why' something matters, expand on the 'why' field — do not make new claims.",
|
|
320
|
+
if_user_unsure: "Recommend option 1 (view_open_findings) — let's see what ZIVIS already knows.",
|
|
321
|
+
};
|
|
322
|
+
}
|
|
323
|
+
const steps = [];
|
|
324
|
+
if (!state.has_application) {
|
|
325
|
+
steps.push(stepSetupWebTarget());
|
|
326
|
+
}
|
|
327
|
+
steps.push(stepCheckDeps());
|
|
328
|
+
if (state.has_findings) {
|
|
329
|
+
steps.push(stepViewFindings(state.open_findings_count));
|
|
330
|
+
}
|
|
331
|
+
else {
|
|
332
|
+
steps.push(stepBrowseTests());
|
|
333
|
+
}
|
|
334
|
+
if (steps.length < 3)
|
|
335
|
+
steps.push(stepBrowseTests());
|
|
336
|
+
return {
|
|
337
|
+
headline: state.has_application
|
|
338
|
+
? `ZIVIS is connected to your project (${state.org_name ?? "org"}). Here are the most useful things to do next.`
|
|
339
|
+
: `ZIVIS is connected to your project (${state.org_name ?? "org"}) but no app has been registered for testing yet.`,
|
|
340
|
+
recommended_next_steps: steps.slice(0, 4),
|
|
341
|
+
guidance_for_assistant: "Present these as a numbered list. Ask the user to pick one before taking any action. " +
|
|
342
|
+
"If they ask 'why' something matters, expand on the 'why' field — do not make new claims.",
|
|
343
|
+
if_user_unsure: "Recommend option 2 (check_dependencies) — it's free, fast, and shows value without setup.",
|
|
344
|
+
};
|
|
345
|
+
}
|
|
346
|
+
async function findRelevantThreats(cwd) {
|
|
347
|
+
const located = await locateLatestArtifact(cwd);
|
|
348
|
+
if (!located) {
|
|
349
|
+
return {
|
|
350
|
+
threats: [],
|
|
351
|
+
reason: "No 'zivis inspect' artifact found in user cache. Run 'zivis inspect' from the repo to populate the threat library against this codebase.",
|
|
352
|
+
};
|
|
353
|
+
}
|
|
354
|
+
const artifactPath = located.path;
|
|
355
|
+
let artifact;
|
|
356
|
+
try {
|
|
357
|
+
const raw = await fs.readFile(artifactPath, "utf8");
|
|
358
|
+
artifact = JSON.parse(raw);
|
|
359
|
+
}
|
|
360
|
+
catch {
|
|
361
|
+
return { threats: [], reason: `Failed to read artifact at ${artifactPath}.` };
|
|
362
|
+
}
|
|
363
|
+
let handle;
|
|
364
|
+
try {
|
|
365
|
+
handle = await loadActivePack();
|
|
366
|
+
}
|
|
367
|
+
catch {
|
|
368
|
+
return {
|
|
369
|
+
threats: [],
|
|
370
|
+
artifact_path: artifactPath,
|
|
371
|
+
reason: "Pattern pack not available — run 'pnpm build' to bundle the public pack.",
|
|
372
|
+
};
|
|
373
|
+
}
|
|
374
|
+
const relevant = await findRelevantCapsules(handle, artifact);
|
|
375
|
+
return {
|
|
376
|
+
threats: relevant.map((cap) => summarizeCapsule(cap, artifact)),
|
|
377
|
+
artifact_path: artifactPath,
|
|
378
|
+
};
|
|
379
|
+
}
|
|
380
|
+
function summarizeCapsule(cap, artifact) {
|
|
381
|
+
const matched = [];
|
|
382
|
+
const pkgs = new Set();
|
|
383
|
+
for (const node of artifact.nodes) {
|
|
384
|
+
if (node.type === "external_dependency" && node.attributes?.package) {
|
|
385
|
+
pkgs.add(node.attributes.package);
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
const langs = new Set(artifact.scope.languages ?? []);
|
|
389
|
+
const f = cap.relevance_filter;
|
|
390
|
+
if (f) {
|
|
391
|
+
for (const term of [...(f.any_of ?? []), ...(f.all_of ?? [])]) {
|
|
392
|
+
if (term.dependency && pkgs.has(term.dependency))
|
|
393
|
+
matched.push(`dep:${term.dependency}`);
|
|
394
|
+
if (term.language && langs.has(term.language))
|
|
395
|
+
matched.push(`language:${term.language}`);
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
if (matched.length === 0)
|
|
399
|
+
matched.push("language match only");
|
|
400
|
+
return {
|
|
401
|
+
pattern_id: cap.id,
|
|
402
|
+
title: cap.title,
|
|
403
|
+
category: cap.category,
|
|
404
|
+
safe_summary: cap.safe_summary,
|
|
405
|
+
matched_on: matched,
|
|
406
|
+
next_action_tool: "zivis_threat_run_matcher",
|
|
407
|
+
};
|
|
408
|
+
}
|
|
409
|
+
export function createGetStartedHandler(apiClient, _config) {
|
|
410
|
+
return async (params) => {
|
|
411
|
+
const cwd = params.cwd ?? process.cwd();
|
|
412
|
+
const intent = detectIntent(params.concern);
|
|
413
|
+
const state = await fetchState(apiClient, cwd);
|
|
414
|
+
const menu = buildMenu(intent, state, params.concern);
|
|
415
|
+
let threatHit = { threats: [] };
|
|
416
|
+
try {
|
|
417
|
+
threatHit = await findRelevantThreats(cwd);
|
|
418
|
+
}
|
|
419
|
+
catch (err) {
|
|
420
|
+
threatHit = {
|
|
421
|
+
threats: [],
|
|
422
|
+
reason: `threat-library lookup failed: ${err.message}`,
|
|
423
|
+
};
|
|
424
|
+
}
|
|
425
|
+
if (threatHit.threats.length > 0) {
|
|
426
|
+
menu.recommended_next_steps = [
|
|
427
|
+
{
|
|
428
|
+
id: "review_relevant_threats",
|
|
429
|
+
label: `Review the ${threatHit.threats.length} architectural pattern${threatHit.threats.length === 1 ? "" : "s"} ZIVIS sees in this repo`,
|
|
430
|
+
tool: "zivis_threat_run_matcher",
|
|
431
|
+
why: "ZIVIS read your codebase via the inspect artifact and identified threat-model patterns that match your architecture. Run the matcher to see exactly which lines fire each pattern.",
|
|
432
|
+
estimated_time: "30 seconds",
|
|
433
|
+
requires_auth: false,
|
|
434
|
+
},
|
|
435
|
+
...menu.recommended_next_steps,
|
|
436
|
+
];
|
|
437
|
+
menu.headline =
|
|
438
|
+
`ZIVIS read this repo's threat library and sees ${threatHit.threats.length} architectural pattern${threatHit.threats.length === 1 ? "" : "s"} that may apply. ` +
|
|
439
|
+
menu.headline;
|
|
440
|
+
menu.if_user_unsure = `Recommend option 1 (review_relevant_threats) — that's the most repo-specific thing ZIVIS knows.`;
|
|
441
|
+
}
|
|
442
|
+
if (state.bound &&
|
|
443
|
+
state.github_app_installed === false &&
|
|
444
|
+
state.github_app_install_url) {
|
|
445
|
+
menu.recommended_next_steps = [
|
|
446
|
+
...menu.recommended_next_steps,
|
|
447
|
+
stepInstallGitHubApp(state.github_app_install_url),
|
|
448
|
+
];
|
|
449
|
+
}
|
|
450
|
+
const payload = {
|
|
451
|
+
current_state: state,
|
|
452
|
+
intent_detected: intent,
|
|
453
|
+
concern_received: params.concern ?? null,
|
|
454
|
+
...menu,
|
|
455
|
+
relevant_threats: threatHit.threats,
|
|
456
|
+
threat_library: {
|
|
457
|
+
artifact_used: threatHit.artifact_path ?? null,
|
|
458
|
+
reason_no_threats: threatHit.threats.length === 0 ? threatHit.reason ?? null : null,
|
|
459
|
+
},
|
|
460
|
+
};
|
|
461
|
+
return {
|
|
462
|
+
content: [
|
|
463
|
+
{
|
|
464
|
+
type: "text",
|
|
465
|
+
text: JSON.stringify(payload, null, 2),
|
|
466
|
+
},
|
|
467
|
+
],
|
|
468
|
+
};
|
|
469
|
+
};
|
|
470
|
+
}
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* zivis_get_trust_keys — Retrieve JWKS public keys for signature verification
|
|
3
|
-
*
|
|
4
|
-
* Maps to: GET /.well-known/jwks.json (public, no auth required)
|
|
5
|
-
*/
|
|
6
1
|
import type { ZivisConfig } from "../types.js";
|
|
7
2
|
export declare const GET_TRUST_KEYS_NAME = "zivis_get_trust_keys";
|
|
8
3
|
export declare const GET_TRUST_KEYS_DESCRIPTION = "Retrieve the ZIVIS public signing keys (JWKS) for independent cryptographic verification of trust marks and ZATs.\n\nReturns a JWKS (JSON Web Key Set) containing two keys:\n\n1. **ML-DSA-65 key** (post-quantum, FIPS-204):\n - Algorithm: CRYSTALS-Dilithium Level 3\n - NIST Security Category 3 (128-bit quantum security)\n - Used to verify the full digital signature on ZATs and trust marks\n - Key type: \"PQ-LWE\" (proposed post-quantum JWK key type)\n - The \"x\" field is the base64url-encoded public key bytes\n\n2. **Ed25519 key** (RFC 8032):\n - Used to verify compact trust tokens (shorter, URL-safe format)\n - Standard JWK format (kty: \"OKP\", crv: \"Ed25519\")\n\nThese keys enable third-party, offline verification without trusting ZIVIS infrastructure.\nThis is critical for ATNP (Agent Trust Negotiation Protocol) where agents must independently verify trust marks.\n\nVerification workflow:\n1. Get a ZAT (from zivis_get_oss_zat or zivis_get_org_zat)\n2. Get the public keys (this tool)\n3. Verify the signature using ML-DSA-65 or Ed25519 library of your choice\n4. Check expiration and claims\n\nNo parameters required. No authentication required.";
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* zivis_get_trust_keys — Retrieve JWKS public keys for signature verification
|
|
3
|
-
*
|
|
4
|
-
* Maps to: GET /.well-known/jwks.json (public, no auth required)
|
|
5
|
-
*/
|
|
6
1
|
export const GET_TRUST_KEYS_NAME = "zivis_get_trust_keys";
|
|
7
2
|
export const GET_TRUST_KEYS_DESCRIPTION = `Retrieve the ZIVIS public signing keys (JWKS) for independent cryptographic verification of trust marks and ZATs.
|
|
8
3
|
|
|
@@ -64,4 +59,3 @@ export function createGetTrustKeysHandler(config) {
|
|
|
64
59
|
}
|
|
65
60
|
};
|
|
66
61
|
}
|
|
67
|
-
//# sourceMappingURL=get-trust-keys.js.map
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* zivis_import_openapi_endpoints — Import endpoints from an OpenAPI/Swagger spec
|
|
3
|
-
*
|
|
4
|
-
* Maps to: POST /api/rt/applications/:id/endpoints/import-openapi
|
|
5
|
-
*/
|
|
6
1
|
import { z } from "zod";
|
|
7
2
|
import type { ApiClient } from "../api-client.js";
|
|
8
3
|
export declare const IMPORT_OPENAPI_ENDPOINTS_NAME = "zivis_import_openapi_endpoints";
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* zivis_import_openapi_endpoints — Import endpoints from an OpenAPI/Swagger spec
|
|
3
|
-
*
|
|
4
|
-
* Maps to: POST /api/rt/applications/:id/endpoints/import-openapi
|
|
5
|
-
*/
|
|
6
1
|
import { z } from "zod";
|
|
7
2
|
import { requireApplicationId } from "../resolve-application-id.js";
|
|
8
3
|
import { sanitizeResponse } from "../sanitize.js";
|
|
@@ -90,4 +85,3 @@ export function createImportOpenApiEndpointsHandler(apiClient) {
|
|
|
90
85
|
}
|
|
91
86
|
};
|
|
92
87
|
}
|
|
93
|
-
//# sourceMappingURL=import-openapi-endpoints.js.map
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* zivis_inspect_zat — Parse and explain a ZAT token
|
|
3
|
-
*
|
|
4
|
-
* No API call — client-side parsing and human-readable interpretation.
|
|
5
|
-
*/
|
|
6
1
|
import { z } from "zod";
|
|
7
2
|
export declare const INSPECT_ZAT_NAME = "zivis_inspect_zat";
|
|
8
3
|
export declare const INSPECT_ZAT_DESCRIPTION = "Parse a ZIVIS Attestation Token (ZAT) JSON and produce a human-readable explanation of all fields.\n\nThis tool does NOT make any API calls \u2014 it parses the ZAT locally and explains what each field means.\n\nUse this after retrieving a ZAT from zivis_get_oss_zat or zivis_get_org_zat to understand:\n- What the claims mean (Z-Score, trust tiers, coverage, findings)\n- Whether signatures are present and which algorithms were used\n- Token validity and expiration\n- Evidence manifest integrity\n- Framework and methodology details\n- Lens-level scores (for OSS ZATs)\n\nAccepts either:\n- A JSON string (the raw ZAT output)\n- A JSON object with a \"zat\" field (the wrapper returned by the API)\n\nZAT Field Reference:\n- **iss**: Issuer (always \"zivis.ai\")\n- **sub**: Subject \u2014 \"org:<slug>\" for enterprise, \"github:<owner>/<repo>\" for OSS\n- **mark_id**: Unique identifier (ztm_...) \u2014 references the trust mark\n- **issued_at / expires_at**: ISO 8601 timestamps \u2014 ZATs are short-lived (48h)\n- **frameworks[]**: Which security frameworks were assessed (NIST IR 8596, ISO 42001, OWASP LLM Top 10, etc.)\n - basis: \"tested\" | \"mapped\" | \"self-attested\" | \"third-party\" \u2014 how the assessment was performed\n - csf_version: Present if framework is NIST CSF 2.0 derived (enables cross-framework comparison)\n- **claims**: The actual trust posture\n - For enterprise: z_score_raw (0-1), z_score_display (0-1000), tier (0-3), tier_label, coverage_pct, mapped_outcomes\n - For OSS: score (0-100), grade (A+ to F), check_types, findings by severity, commit SHA\n - Tier meanings: 0=Commitment, 1=Foundational Trust (600+), 2=Operational Trust (700+), 3=Systemic Trust (800+)\n- **evidence_manifest**: SHA-256 hash of the evidence bundle \u2014 proves the assessment data hasn't been tampered with\n- **methodology**: How the assessment was performed (model version, scoring algorithm, evaluator type)\n- **sig**: Cryptographic signatures\n - alg: \"ML-DSA-65\" (FIPS-204, post-quantum CRYSTALS-Dilithium Level 3)\n - compact: Ed25519 (RFC 8032) compact token for lightweight verification\n- **ver**: ZAT spec version (e.g., \"0.3.0\")";
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* zivis_inspect_zat — Parse and explain a ZAT token
|
|
3
|
-
*
|
|
4
|
-
* No API call — client-side parsing and human-readable interpretation.
|
|
5
|
-
*/
|
|
6
1
|
import { z } from "zod";
|
|
7
2
|
export const INSPECT_ZAT_NAME = "zivis_inspect_zat";
|
|
8
3
|
export const INSPECT_ZAT_DESCRIPTION = `Parse a ZIVIS Attestation Token (ZAT) JSON and produce a human-readable explanation of all fields.
|
|
@@ -62,23 +57,19 @@ export function createInspectZatHandler() {
|
|
|
62
57
|
isError: true,
|
|
63
58
|
};
|
|
64
59
|
}
|
|
65
|
-
// Unwrap if the API returned { zat: {...}, ... }
|
|
66
60
|
const zat = (parsed.zat && typeof parsed.zat === "object" ? parsed.zat : parsed);
|
|
67
61
|
const lines = [];
|
|
68
62
|
lines.push("# ZAT Inspection Report");
|
|
69
63
|
lines.push("");
|
|
70
|
-
// Identity
|
|
71
64
|
lines.push("## Identity");
|
|
72
65
|
lines.push(`- **Issuer**: ${zat.iss || "unknown"}`);
|
|
73
66
|
lines.push(`- **Subject**: ${zat.sub || "unknown"}`);
|
|
74
67
|
lines.push(`- **Mark ID**: ${zat.mark_id || "none"}`);
|
|
75
68
|
if (zat.ver)
|
|
76
69
|
lines.push(`- **Spec Version**: ${zat.ver}`);
|
|
77
|
-
// Determine ZAT type
|
|
78
70
|
const isOss = typeof zat.sub === "string" && zat.sub.startsWith("github:");
|
|
79
71
|
lines.push(`- **Type**: ${isOss ? "OSS Repository" : "Enterprise Organization"}`);
|
|
80
72
|
lines.push("");
|
|
81
|
-
// Validity
|
|
82
73
|
lines.push("## Validity");
|
|
83
74
|
const issuedAt = zat.issued_at;
|
|
84
75
|
const expiresAt = zat.expires_at;
|
|
@@ -93,12 +84,10 @@ export function createInspectZatHandler() {
|
|
|
93
84
|
lines.push(`- **Status**: ${now > exp ? "EXPIRED" : now < iss ? "NOT YET VALID" : "ACTIVE"}`);
|
|
94
85
|
}
|
|
95
86
|
lines.push("");
|
|
96
|
-
// Claims
|
|
97
87
|
const claims = zat.claims;
|
|
98
88
|
if (claims) {
|
|
99
89
|
lines.push("## Claims");
|
|
100
90
|
if (isOss) {
|
|
101
|
-
// OSS ZAT claims
|
|
102
91
|
lines.push(`- **Trust Score**: ${claims.score ?? "N/A"} / 100`);
|
|
103
92
|
lines.push(`- **Grade**: ${claims.grade ?? "N/A"}`);
|
|
104
93
|
lines.push(`- **Commit**: ${claims.commit || "unknown"}`);
|
|
@@ -110,7 +99,6 @@ export function createInspectZatHandler() {
|
|
|
110
99
|
const total = (findings.critical || 0) + (findings.high || 0) + (findings.medium || 0) + (findings.low || 0);
|
|
111
100
|
lines.push(`- **Findings**: ${total} total (${findings.critical || 0} critical, ${findings.high || 0} high, ${findings.medium || 0} medium, ${findings.low || 0} low)`);
|
|
112
101
|
}
|
|
113
|
-
// Lens scores
|
|
114
102
|
const lensScores = claims.lens_scores;
|
|
115
103
|
if (lensScores && Object.keys(lensScores).length > 0) {
|
|
116
104
|
lines.push("");
|
|
@@ -121,12 +109,10 @@ export function createInspectZatHandler() {
|
|
|
121
109
|
}
|
|
122
110
|
}
|
|
123
111
|
else {
|
|
124
|
-
// Enterprise ZAT claims
|
|
125
112
|
lines.push(`- **Z-Score**: ${claims.z_score_display ?? "N/A"} / 1000 (raw: ${claims.z_score_raw ?? "N/A"})`);
|
|
126
113
|
lines.push(`- **Trust Tier**: ${claims.tier ?? "N/A"} — ${claims.tier_label || "Unknown"}`);
|
|
127
114
|
lines.push(`- **Tier Score**: ${claims.tier_score ?? "N/A"}% (progress within current tier)`);
|
|
128
115
|
lines.push(`- **Coverage**: ${typeof claims.coverage_pct === "number" ? (claims.coverage_pct * 100).toFixed(1) + "%" : "N/A"}`);
|
|
129
|
-
// Tier explanation
|
|
130
116
|
const tier = claims.tier;
|
|
131
117
|
if (typeof tier === "number") {
|
|
132
118
|
const tierExplanations = {
|
|
@@ -148,7 +134,6 @@ export function createInspectZatHandler() {
|
|
|
148
134
|
}
|
|
149
135
|
lines.push("");
|
|
150
136
|
}
|
|
151
|
-
// Frameworks
|
|
152
137
|
const frameworks = zat.frameworks;
|
|
153
138
|
if (frameworks && frameworks.length > 0) {
|
|
154
139
|
lines.push("## Frameworks");
|
|
@@ -163,7 +148,6 @@ export function createInspectZatHandler() {
|
|
|
163
148
|
}
|
|
164
149
|
lines.push("");
|
|
165
150
|
}
|
|
166
|
-
// Evidence
|
|
167
151
|
const evidence = zat.evidence_manifest;
|
|
168
152
|
if (evidence) {
|
|
169
153
|
lines.push("## Evidence Manifest");
|
|
@@ -174,7 +158,6 @@ export function createInspectZatHandler() {
|
|
|
174
158
|
lines.push("- *The bundle hash is a SHA-256 digest of all assessment evidence. If the underlying data changes, this hash will no longer match, indicating tampering.*");
|
|
175
159
|
lines.push("");
|
|
176
160
|
}
|
|
177
|
-
// Methodology
|
|
178
161
|
const methodology = zat.methodology;
|
|
179
162
|
if (methodology) {
|
|
180
163
|
lines.push("## Methodology");
|
|
@@ -188,7 +171,6 @@ export function createInspectZatHandler() {
|
|
|
188
171
|
}
|
|
189
172
|
lines.push("");
|
|
190
173
|
}
|
|
191
|
-
// Signatures
|
|
192
174
|
const sig = zat.sig;
|
|
193
175
|
if (sig) {
|
|
194
176
|
lines.push("## Cryptographic Signatures");
|
|
@@ -244,4 +226,3 @@ function formatKey(key) {
|
|
|
244
226
|
.replace(/_/g, " ")
|
|
245
227
|
.replace(/\b\w/g, (c) => c.toUpperCase());
|
|
246
228
|
}
|
|
247
|
-
//# sourceMappingURL=inspect-zat.js.map
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import type { ApiClient } from "../api-client.js";
|
|
3
|
+
import type { ZivisConfig } from "../types.js";
|
|
4
|
+
export declare const INSPECT_NAME = "zivis_inspect";
|
|
5
|
+
export declare const INSPECT_DESCRIPTION = "Build a local repo graph and run the local pattern matcher to emit threat-model findings. The threat-model-first conversion event.\n\nPrefer zivis_get_started first \u2014 it reads the local inspect cache and only calls this tool when a fresh artifact is missing. Calling zivis_inspect directly always re-runs (no idempotency at this layer); reach for it when the user explicitly says \"re-inspect\" / \"rebuild the graph\" / \"/inspect\" or when an entry tool tells you to.\n\nUse this when the user says any of:\n- \"model this app\" / \"threat model this repo\"\n- \"what should we be worried about in this code\"\n- \"set up security for this project\" (after auth/binding is done)\n- \"/inspect\"\n\nWhat it does, all locally (no source code leaves the machine):\n 1. Spawns 'zivis inspect' to walk the repo and produce a typed graph artifact\n (services, endpoints, external dependencies; auth boundaries + dataflow are Phase 1.5)\n 2. Runs the local matcher against the public pattern pack:\n - AST strategies fire via @ast-grep/napi for TS/JS/Python/Go\n - META strategies fire via the controls library (when no defending control is present)\n - INFER strategies emit candidates the host LLM picks up via zivis_threat_get_inference_prompt\n 3. Returns normalized findings with lane (trusted/inferred), confidence, and evidence spans\n\nTrusted-lane findings are evidence-backed (deterministic strategies fired) and ready for the threat model. Inferred-lane findings need host-LLM confirmation via zivis_threat_get_inference_prompt before promotion. Proprietary platform-side eval (Phase 4 cloud upload) and trust-promoted aggregation are separate steps.\n\nThis is the conversion moment for the threat-model-first sidekick \u2014 the user sees specific patterns naming specific files in their repo, in their IDE, in under 30 seconds.";
|
|
6
|
+
export declare const INSPECT_SCHEMA: {
|
|
7
|
+
cwd: z.ZodOptional<z.ZodString>;
|
|
8
|
+
application_id: z.ZodOptional<z.ZodString>;
|
|
9
|
+
skip_matcher: z.ZodOptional<z.ZodBoolean>;
|
|
10
|
+
};
|
|
11
|
+
export declare function createInspectHandler(_apiClient: ApiClient, _config: ZivisConfig): (params: {
|
|
12
|
+
cwd?: string;
|
|
13
|
+
application_id?: string;
|
|
14
|
+
skip_matcher?: boolean;
|
|
15
|
+
}) => Promise<{
|
|
16
|
+
content: Array<{
|
|
17
|
+
type: "text";
|
|
18
|
+
text: string;
|
|
19
|
+
}>;
|
|
20
|
+
isError?: boolean;
|
|
21
|
+
}>;
|