@zivis/mcp 0.1.0-alpha.26 → 0.1.0-alpha.4
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/api-client.d.ts +24 -1
- package/dist/api-client.js +52 -29
- package/dist/api-client.js.map +1 -0
- package/dist/auth/index.d.ts +22 -1
- package/dist/auth/index.js +38 -17
- package/dist/auth/index.js.map +1 -0
- package/dist/auth/jwt.d.ts +16 -0
- package/dist/auth/jwt.js +13 -0
- package/dist/auth/jwt.js.map +1 -0
- package/dist/auth/keychain.d.ts +32 -6
- package/dist/auth/keychain.js +114 -83
- package/dist/auth/keychain.js.map +1 -0
- package/dist/auth/oauth.d.ts +42 -1
- package/dist/auth/oauth.js +50 -13
- package/dist/auth/oauth.js.map +1 -0
- package/dist/auth/sessions.d.ts +25 -5
- package/dist/auth/sessions.js +39 -20
- package/dist/auth/sessions.js.map +1 -0
- package/dist/auth/token-refresh.d.ts +22 -2
- package/dist/auth/token-refresh.js +35 -32
- package/dist/auth/token-refresh.js.map +1 -0
- package/dist/cli.d.ts +18 -1
- package/dist/cli.js +908 -30
- package/dist/cli.js.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -0
- package/dist/project-binding.d.ts +19 -2
- package/dist/project-binding.js +21 -38
- package/dist/project-binding.js.map +1 -0
- package/dist/resolve-application-id.d.ts +4 -0
- package/dist/resolve-application-id.js +5 -0
- package/dist/resolve-application-id.js.map +1 -0
- package/dist/sanitize.d.ts +21 -0
- package/dist/sanitize.js +41 -0
- package/dist/sanitize.js.map +1 -0
- package/dist/server.d.ts +13 -1
- package/dist/server.js +247 -122
- package/dist/server.js.map +1 -0
- package/dist/tools/check-project.d.ts +18 -5
- package/dist/tools/check-project.js +110 -122
- package/dist/tools/check-project.js.map +1 -0
- package/dist/tools/check-repo-trust.d.ts +19 -4
- package/dist/tools/check-repo-trust.js +47 -56
- package/dist/tools/check-repo-trust.js.map +1 -0
- package/dist/tools/create-diagram.d.ts +5 -0
- package/dist/tools/create-diagram.js +10 -0
- package/dist/tools/create-diagram.js.map +1 -0
- package/dist/tools/create-document.d.ts +5 -0
- package/dist/tools/create-document.js +6 -0
- package/dist/tools/create-document.js.map +1 -0
- package/dist/tools/discover-local-infra.d.ts +10 -0
- package/dist/tools/discover-local-infra.js +73 -3
- package/dist/tools/discover-local-infra.js.map +1 -0
- package/dist/tools/enterprise/capture-evidence.d.ts +54 -0
- package/dist/tools/enterprise/capture-evidence.js +72 -0
- package/dist/tools/enterprise/capture-evidence.js.map +1 -0
- package/dist/tools/enterprise/create-report-ticket.d.ts +34 -0
- package/dist/tools/enterprise/create-report-ticket.js +44 -0
- package/dist/tools/enterprise/create-report-ticket.js.map +1 -0
- package/dist/tools/enterprise/end-pentest-session.d.ts +33 -0
- package/dist/tools/enterprise/end-pentest-session.js +42 -0
- package/dist/tools/enterprise/end-pentest-session.js.map +1 -0
- package/dist/tools/enterprise/generate-report.d.ts +55 -0
- package/dist/tools/enterprise/generate-report.js +111 -0
- package/dist/tools/enterprise/generate-report.js.map +1 -0
- package/dist/tools/enterprise/get-org-zat.d.ts +5 -0
- package/dist/tools/enterprise/get-org-zat.js +6 -0
- package/dist/tools/enterprise/get-org-zat.js.map +1 -0
- package/dist/tools/enterprise/get-report-status.d.ts +27 -0
- package/dist/tools/enterprise/get-report-status.js +38 -0
- package/dist/tools/enterprise/get-report-status.js.map +1 -0
- package/dist/tools/enterprise/get-threat-model.d.ts +6 -1
- package/dist/tools/enterprise/get-threat-model.js +17 -52
- package/dist/tools/enterprise/get-threat-model.js.map +1 -0
- package/dist/tools/enterprise/list-agents.d.ts +42 -0
- package/dist/tools/enterprise/list-agents.js +95 -0
- package/dist/tools/enterprise/list-agents.js.map +1 -0
- package/dist/tools/enterprise/list-report-issues.d.ts +36 -0
- package/dist/tools/enterprise/list-report-issues.js +50 -0
- package/dist/tools/enterprise/list-report-issues.js.map +1 -0
- package/dist/tools/enterprise/list-threat-models.d.ts +5 -0
- package/dist/tools/enterprise/list-threat-models.js +8 -0
- package/dist/tools/enterprise/list-threat-models.js.map +1 -0
- package/dist/tools/enterprise/manage-actor.d.ts +6 -1
- package/dist/tools/enterprise/manage-actor.js +7 -14
- package/dist/tools/enterprise/manage-actor.js.map +1 -0
- package/dist/tools/enterprise/manage-attack-scenario.d.ts +6 -1
- package/dist/tools/enterprise/manage-attack-scenario.js +7 -13
- package/dist/tools/enterprise/manage-attack-scenario.js.map +1 -0
- package/dist/tools/enterprise/manage-component.d.ts +6 -1
- package/dist/tools/enterprise/manage-component.js +7 -20
- package/dist/tools/enterprise/manage-component.js.map +1 -0
- package/dist/tools/enterprise/manage-data-asset.d.ts +7 -2
- package/dist/tools/enterprise/manage-data-asset.js +7 -17
- package/dist/tools/enterprise/manage-data-asset.js.map +1 -0
- package/dist/tools/enterprise/manage-data-flow.d.ts +7 -2
- package/dist/tools/enterprise/manage-data-flow.js +7 -19
- package/dist/tools/enterprise/manage-data-flow.js.map +1 -0
- package/dist/tools/enterprise/manage-finding.d.ts +69 -0
- package/dist/tools/enterprise/manage-finding.js +106 -0
- package/dist/tools/enterprise/manage-finding.js.map +1 -0
- package/dist/tools/enterprise/manage-security-control.d.ts +6 -1
- package/dist/tools/enterprise/manage-security-control.js +7 -18
- package/dist/tools/enterprise/manage-security-control.js.map +1 -0
- package/dist/tools/enterprise/manage-test-case.d.ts +7 -2
- package/dist/tools/enterprise/manage-test-case.js +6 -8
- package/dist/tools/enterprise/manage-test-case.js.map +1 -0
- package/dist/tools/enterprise/promote-finding-to-issue.d.ts +36 -0
- package/dist/tools/enterprise/promote-finding-to-issue.js +65 -0
- package/dist/tools/enterprise/promote-finding-to-issue.js.map +1 -0
- package/dist/tools/enterprise/publish-report-version.d.ts +34 -0
- package/dist/tools/enterprise/publish-report-version.js +75 -0
- package/dist/tools/enterprise/publish-report-version.js.map +1 -0
- package/dist/tools/enterprise/publish-test-to-library.d.ts +31 -0
- package/dist/tools/enterprise/publish-test-to-library.js +40 -0
- package/dist/tools/enterprise/publish-test-to-library.js.map +1 -0
- package/dist/tools/enterprise/record-test-result.d.ts +67 -0
- package/dist/tools/enterprise/record-test-result.js +75 -0
- package/dist/tools/enterprise/record-test-result.js.map +1 -0
- package/dist/tools/enterprise/start-pentest-session.d.ts +35 -0
- package/dist/tools/enterprise/start-pentest-session.js +50 -0
- package/dist/tools/enterprise/start-pentest-session.js.map +1 -0
- package/dist/tools/enterprise/sync-report-section.d.ts +41 -0
- package/dist/tools/enterprise/sync-report-section.js +79 -0
- package/dist/tools/enterprise/sync-report-section.js.map +1 -0
- package/dist/tools/enterprise/update-report-issue.d.ts +55 -0
- package/dist/tools/enterprise/update-report-issue.js +69 -0
- package/dist/tools/enterprise/update-report-issue.js.map +1 -0
- package/dist/tools/generate-diagram.d.ts +6 -0
- package/dist/tools/generate-diagram.js +9 -0
- package/dist/tools/generate-diagram.js.map +1 -0
- package/dist/tools/get-agent-test-results.d.ts +41 -0
- package/dist/tools/get-agent-test-results.js +86 -0
- package/dist/tools/get-agent-test-results.js.map +1 -0
- package/dist/tools/get-application-overview.d.ts +5 -0
- package/dist/tools/get-application-overview.js +6 -0
- package/dist/tools/get-application-overview.js.map +1 -0
- package/dist/tools/get-application.d.ts +5 -0
- package/dist/tools/get-application.js +6 -0
- package/dist/tools/get-application.js.map +1 -0
- package/dist/tools/get-artifact-content.d.ts +29 -0
- package/dist/tools/get-artifact-content.js +86 -0
- package/dist/tools/get-artifact-content.js.map +1 -0
- package/dist/tools/get-diagram.d.ts +5 -0
- package/dist/tools/get-diagram.js +11 -1
- package/dist/tools/get-diagram.js.map +1 -0
- package/dist/tools/get-document.d.ts +5 -0
- package/dist/tools/get-document.js +6 -0
- package/dist/tools/get-document.js.map +1 -0
- package/dist/tools/get-finding-details.d.ts +28 -0
- package/dist/tools/get-finding-details.js +43 -0
- package/dist/tools/get-finding-details.js.map +1 -0
- package/dist/tools/get-findings.d.ts +57 -0
- package/dist/tools/get-findings.js +103 -0
- package/dist/tools/get-findings.js.map +1 -0
- package/dist/tools/get-oss-zat.d.ts +5 -0
- package/dist/tools/get-oss-zat.js +7 -0
- package/dist/tools/get-oss-zat.js.map +1 -0
- package/dist/tools/get-recon-scan.d.ts +27 -0
- package/dist/tools/get-recon-scan.js +46 -0
- package/dist/tools/get-recon-scan.js.map +1 -0
- package/dist/tools/get-scan-output.d.ts +27 -0
- package/dist/tools/get-scan-output.js +64 -0
- package/dist/tools/get-scan-output.js.map +1 -0
- package/dist/tools/get-scenario-details.d.ts +27 -0
- package/dist/tools/get-scenario-details.js +46 -0
- package/dist/tools/get-scenario-details.js.map +1 -0
- package/dist/tools/get-test-case-results.d.ts +37 -0
- package/dist/tools/get-test-case-results.js +66 -0
- package/dist/tools/get-test-case-results.js.map +1 -0
- package/dist/tools/get-test-details.d.ts +29 -0
- package/dist/tools/get-test-details.js +49 -0
- package/dist/tools/get-test-details.js.map +1 -0
- package/dist/tools/get-trust-keys.d.ts +5 -0
- package/dist/tools/get-trust-keys.js +6 -0
- package/dist/tools/get-trust-keys.js.map +1 -0
- package/dist/tools/import-openapi-endpoints.d.ts +5 -0
- package/dist/tools/import-openapi-endpoints.js +6 -0
- package/dist/tools/import-openapi-endpoints.js.map +1 -0
- package/dist/tools/inspect-zat.d.ts +5 -0
- package/dist/tools/inspect-zat.js +19 -0
- package/dist/tools/inspect-zat.js.map +1 -0
- package/dist/tools/list-agent-test-cases.d.ts +41 -0
- package/dist/tools/list-agent-test-cases.js +73 -0
- package/dist/tools/list-agent-test-cases.js.map +1 -0
- package/dist/tools/list-applications.d.ts +6 -1
- package/dist/tools/list-applications.js +6 -0
- package/dist/tools/list-applications.js.map +1 -0
- package/dist/tools/list-diagrams.d.ts +5 -0
- package/dist/tools/list-diagrams.js +6 -0
- package/dist/tools/list-diagrams.js.map +1 -0
- package/dist/tools/list-documents.d.ts +5 -0
- package/dist/tools/list-documents.js +6 -0
- package/dist/tools/list-documents.js.map +1 -0
- package/dist/tools/list-endpoints.d.ts +5 -0
- package/dist/tools/list-endpoints.js +6 -0
- package/dist/tools/list-endpoints.js.map +1 -0
- package/dist/tools/list-recon-scans.d.ts +36 -0
- package/dist/tools/list-recon-scans.js +74 -0
- package/dist/tools/list-recon-scans.js.map +1 -0
- package/dist/tools/list-scan-artifacts.d.ts +41 -0
- package/dist/tools/list-scan-artifacts.js +63 -0
- package/dist/tools/list-scan-artifacts.js.map +1 -0
- package/dist/tools/list-scans.d.ts +44 -0
- package/dist/tools/list-scans.js +91 -0
- package/dist/tools/list-scans.js.map +1 -0
- package/dist/tools/list-test-library.d.ts +44 -0
- package/dist/tools/list-test-library.js +83 -0
- package/dist/tools/list-test-library.js.map +1 -0
- package/dist/tools/list-test-scenarios.d.ts +31 -0
- package/dist/tools/list-test-scenarios.js +66 -0
- package/dist/tools/list-test-scenarios.js.map +1 -0
- package/dist/tools/local-scan.d.ts +40 -0
- package/dist/tools/local-scan.js +261 -0
- package/dist/tools/local-scan.js.map +1 -0
- package/dist/tools/manage-diagram.d.ts +5 -0
- package/dist/tools/manage-diagram.js +16 -0
- package/dist/tools/manage-diagram.js.map +1 -0
- package/dist/tools/open-in-ide.d.ts +13 -1
- package/dist/tools/open-in-ide.js +13 -0
- package/dist/tools/open-in-ide.js.map +1 -0
- package/dist/tools/run-test-scenario.d.ts +37 -0
- package/dist/tools/run-test-scenario.js +70 -0
- package/dist/tools/run-test-scenario.js.map +1 -0
- package/dist/tools/scan-pr.d.ts +27 -0
- package/dist/tools/scan-pr.js +51 -0
- package/dist/tools/scan-pr.js.map +1 -0
- package/dist/tools/security-review.d.ts +16 -0
- package/dist/tools/security-review.js +77 -63
- package/dist/tools/security-review.js.map +1 -0
- package/dist/tools/setup-red-team-target.d.ts +79 -0
- package/dist/tools/setup-red-team-target.js +430 -0
- package/dist/tools/setup-red-team-target.js.map +1 -0
- package/dist/tools/triage-finding.d.ts +47 -0
- package/dist/tools/triage-finding.js +116 -0
- package/dist/tools/triage-finding.js.map +1 -0
- package/dist/tools/update-document.d.ts +5 -0
- package/dist/tools/update-document.js +6 -0
- package/dist/tools/update-document.js.map +1 -0
- package/dist/tools/update-endpoint.d.ts +5 -0
- package/dist/tools/update-endpoint.js +7 -0
- package/dist/tools/update-endpoint.js.map +1 -0
- package/dist/tools/update-mermaid-source.d.ts +13 -0
- package/dist/tools/update-mermaid-source.js +14 -0
- package/dist/tools/update-mermaid-source.js.map +1 -0
- package/dist/tools/verify-trust-mark.d.ts +5 -0
- package/dist/tools/verify-trust-mark.js +6 -0
- package/dist/tools/verify-trust-mark.js.map +1 -0
- package/dist/types.d.ts +14 -14
- package/dist/types.js +28 -22
- package/dist/types.js.map +1 -0
- package/package.json +4 -24
- package/LICENSE +0 -201
- package/README.md +0 -19
- package/dist/lib/inspect-cache.d.ts +0 -10
- package/dist/lib/inspect-cache.js +0 -75
- package/dist/lib/next-steps.d.ts +0 -27
- package/dist/lib/next-steps.js +0 -21
- package/dist/matcher/ast-eval.d.ts +0 -8
- package/dist/matcher/ast-eval.js +0 -95
- package/dist/matcher/finding.d.ts +0 -55
- package/dist/matcher/finding.js +0 -1
- package/dist/matcher/index.d.ts +0 -8
- package/dist/matcher/index.js +0 -202
- package/dist/matcher/inference-candidates.d.ts +0 -26
- package/dist/matcher/inference-candidates.js +0 -81
- package/dist/matcher/walker.d.ts +0 -7
- package/dist/matcher/walker.js +0 -71
- package/dist/pattern-pack/index.d.ts +0 -125
- package/dist/pattern-pack/index.js +0 -189
- package/dist/pattern-packs/zivis-public-0.2.0/capsules/agents/privilege-separation.yaml +0 -224
- package/dist/pattern-packs/zivis-public-0.2.0/capsules/prompting/self-consistency-no-isolation.yaml +0 -237
- package/dist/pattern-packs/zivis-public-0.2.0/capsules/retrieval/context-injection-no-validator.yaml +0 -348
- package/dist/pattern-packs/zivis-public-0.2.0/capsules/security/late-org-filter.yaml +0 -266
- package/dist/pattern-packs/zivis-public-0.2.0/controls/external_validator_on_facts.yaml +0 -37
- package/dist/pattern-packs/zivis-public-0.2.0/controls/fact_validator_present.yaml +0 -68
- package/dist/pattern-packs/zivis-public-0.2.0/controls/human_approval_gate.yaml +0 -44
- package/dist/pattern-packs/zivis-public-0.2.0/controls/langgraph_state_machine_with_per_node_tools.yaml +0 -35
- package/dist/pattern-packs/zivis-public-0.2.0/controls/per_sample_retrieval_diversification.yaml +0 -38
- package/dist/pattern-packs/zivis-public-0.2.0/controls/prisma_extension_or_middleware_attaching_org_filter.yaml +0 -31
- package/dist/pattern-packs/zivis-public-0.2.0/controls/row_level_security_policy.yaml +0 -37
- package/dist/pattern-packs/zivis-public-0.2.0/controls/source_attribution_present.yaml +0 -58
- package/dist/pattern-packs/zivis-public-0.2.0/manifest.json +0 -167
- package/dist/pattern-packs/zivis-public-0.2.0/prompts/agents/privilege-separation/identify.md +0 -54
- package/dist/pattern-packs/zivis-public-0.2.0/prompts/prompting/self-consistency-no-isolation/identify.md +0 -60
- package/dist/pattern-packs/zivis-public-0.2.0/prompts/retrieval/context-injection-no-validator/identify.md +0 -109
- package/dist/pattern-packs/zivis-public-0.2.0/prompts/security/late-org-filter/identify.md +0 -78
- package/dist/prompts/audit-dependencies.d.ts +0 -2
- package/dist/prompts/audit-dependencies.js +0 -47
- package/dist/prompts/getting-started.d.ts +0 -2
- package/dist/prompts/getting-started.js +0 -37
- package/dist/prompts/index.d.ts +0 -2
- package/dist/prompts/index.js +0 -6
- package/dist/tools/enterprise/get-threat-model-artifact.d.ts +0 -24
- package/dist/tools/enterprise/get-threat-model-artifact.js +0 -68
- package/dist/tools/enterprise/list-attack-scenarios.d.ts +0 -24
- package/dist/tools/enterprise/list-attack-scenarios.js +0 -63
- package/dist/tools/enterprise/list-attack-step-library-tests.d.ts +0 -24
- package/dist/tools/enterprise/list-attack-step-library-tests.js +0 -55
- package/dist/tools/enterprise/list-threat-model-artifacts.d.ts +0 -55
- package/dist/tools/enterprise/list-threat-model-artifacts.js +0 -108
- package/dist/tools/enterprise/list-threat-model-review-items.d.ts +0 -30
- package/dist/tools/enterprise/list-threat-model-review-items.js +0 -54
- package/dist/tools/enterprise/list-threat-model-versions.d.ts +0 -24
- package/dist/tools/enterprise/list-threat-model-versions.js +0 -54
- package/dist/tools/enterprise/manage-threat-model-analysis.d.ts +0 -44
- package/dist/tools/enterprise/manage-threat-model-analysis.js +0 -83
- package/dist/tools/enterprise/manage-threat-model-review.d.ts +0 -38
- package/dist/tools/enterprise/manage-threat-model-review.js +0 -72
- package/dist/tools/get-started.d.ts +0 -18
- package/dist/tools/get-started.js +0 -470
- package/dist/tools/inspect.d.ts +0 -21
- package/dist/tools/inspect.js +0 -222
- package/dist/tools/manage-application.d.ts +0 -64
- package/dist/tools/manage-application.js +0 -129
- package/dist/tools/manage-endpoint-lifecycle.d.ts +0 -80
- package/dist/tools/manage-endpoint-lifecycle.js +0 -180
- package/dist/tools/threat-get-capsule.d.ts +0 -15
- package/dist/tools/threat-get-capsule.js +0 -53
- package/dist/tools/threat-get-inference-prompt.d.ts +0 -15
- package/dist/tools/threat-get-inference-prompt.js +0 -73
- package/dist/tools/threat-guide.d.ts +0 -28
- package/dist/tools/threat-guide.js +0 -175
- package/dist/tools/threat-list-relevant-capsules.d.ts +0 -17
- package/dist/tools/threat-list-relevant-capsules.js +0 -158
- package/dist/tools/threat-run-matcher.d.ts +0 -17
- package/dist/tools/threat-run-matcher.js +0 -145
|
@@ -1,19 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* zivis_check_project — Three-way org alignment check
|
|
3
|
+
*
|
|
4
|
+
* Answers: "am I safe to do tenant-scoped work in this project right now?"
|
|
5
|
+
*
|
|
6
|
+
* Verifies all three sources of truth agree on the org:
|
|
7
|
+
* 1. BINDING — .zivis/project.json's workosOrgId (what the project expects)
|
|
8
|
+
* 2. LOCAL JWT — the stored access token's org_id claim (what the token says)
|
|
9
|
+
* 3. API — GET /api/mcp/session (what the server resolves from the JWT)
|
|
10
|
+
*
|
|
11
|
+
* If any mismatch: returns isError=true with a concrete fix action.
|
|
12
|
+
* If no binding exists: isError=true (refuses to operate without cross-org safety).
|
|
13
|
+
*/
|
|
1
14
|
import { z } from "zod";
|
|
2
15
|
import type { ApiClient } from "../api-client.js";
|
|
3
16
|
import type { ZivisConfig } from "../types.js";
|
|
4
17
|
export declare const CHECK_PROJECT_NAME = "zivis_check_project";
|
|
5
|
-
export declare const CHECK_PROJECT_DESCRIPTION = "
|
|
18
|
+
export declare const CHECK_PROJECT_DESCRIPTION = "Pre-flight: verify the project, the stored JWT, and the API ALL agree on the org.\n\nThis is a defense-in-depth check that must pass before any tenant-scoped MCP\noperation (triage, create scan, manage threat model, etc.). It compares three\nindependent sources of truth:\n\n 1. Project binding (.zivis/project.json workosOrgId)\n 2. Local JWT org_id claim\n 3. API's resolved org (round-trip to /api/mcp/session)\n\nReturns isError=true on ANY mismatch or missing binding. Call this at the\nstart of any workflow where polluting another tenant with data would be bad.\n\nSet local_only=true to skip the API round-trip (faster, but weaker guarantee).";
|
|
6
19
|
export declare const CHECK_PROJECT_SCHEMA: {
|
|
7
20
|
cwd: z.ZodOptional<z.ZodString>;
|
|
8
21
|
local_only: z.ZodOptional<z.ZodBoolean>;
|
|
9
22
|
};
|
|
10
|
-
export declare function createCheckProjectHandler(apiClient: ApiClient,
|
|
23
|
+
export declare function createCheckProjectHandler(apiClient: ApiClient, config: ZivisConfig): (params: {
|
|
11
24
|
cwd?: string;
|
|
12
25
|
local_only?: boolean;
|
|
13
26
|
}) => Promise<{
|
|
14
|
-
content:
|
|
27
|
+
content: {
|
|
15
28
|
type: "text";
|
|
16
29
|
text: string;
|
|
17
|
-
}
|
|
18
|
-
isError
|
|
30
|
+
}[];
|
|
31
|
+
isError: boolean;
|
|
19
32
|
}>;
|
|
@@ -1,16 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* zivis_check_project — Three-way org alignment check
|
|
3
|
+
*
|
|
4
|
+
* Answers: "am I safe to do tenant-scoped work in this project right now?"
|
|
5
|
+
*
|
|
6
|
+
* Verifies all three sources of truth agree on the org:
|
|
7
|
+
* 1. BINDING — .zivis/project.json's workosOrgId (what the project expects)
|
|
8
|
+
* 2. LOCAL JWT — the stored access token's org_id claim (what the token says)
|
|
9
|
+
* 3. API — GET /api/mcp/session (what the server resolves from the JWT)
|
|
10
|
+
*
|
|
11
|
+
* If any mismatch: returns isError=true with a concrete fix action.
|
|
12
|
+
* If no binding exists: isError=true (refuses to operate without cross-org safety).
|
|
13
|
+
*/
|
|
1
14
|
import { z } from "zod";
|
|
2
15
|
import { detectProjectBinding } from "../project-binding.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
16
|
+
import { loadTokens } from "../auth/token-refresh.js";
|
|
17
|
+
import { decodeJwtPayload } from "../auth/jwt.js";
|
|
5
18
|
export const CHECK_PROJECT_NAME = "zivis_check_project";
|
|
6
|
-
export const CHECK_PROJECT_DESCRIPTION = `
|
|
19
|
+
export const CHECK_PROJECT_DESCRIPTION = `Pre-flight: verify the project, the stored JWT, and the API ALL agree on the org.
|
|
7
20
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
3. The ZIVIS API (probe via your key)
|
|
21
|
+
This is a defense-in-depth check that must pass before any tenant-scoped MCP
|
|
22
|
+
operation (triage, create scan, manage threat model, etc.). It compares three
|
|
23
|
+
independent sources of truth:
|
|
12
24
|
|
|
13
|
-
|
|
25
|
+
1. Project binding (.zivis/project.json workosOrgId)
|
|
26
|
+
2. Local JWT org_id claim
|
|
27
|
+
3. API's resolved org (round-trip to /api/mcp/session)
|
|
28
|
+
|
|
29
|
+
Returns isError=true on ANY mismatch or missing binding. Call this at the
|
|
30
|
+
start of any workflow where polluting another tenant with data would be bad.
|
|
31
|
+
|
|
32
|
+
Set local_only=true to skip the API round-trip (faster, but weaker guarantee).`;
|
|
14
33
|
export const CHECK_PROJECT_SCHEMA = {
|
|
15
34
|
cwd: z
|
|
16
35
|
.string()
|
|
@@ -21,53 +40,44 @@ export const CHECK_PROJECT_SCHEMA = {
|
|
|
21
40
|
.optional()
|
|
22
41
|
.describe("Skip the API round-trip. Default false — the API check is the strongest guarantee."),
|
|
23
42
|
};
|
|
24
|
-
function
|
|
25
|
-
if (!apiKey)
|
|
26
|
-
return null;
|
|
27
|
-
if (!apiKey.startsWith("sk_"))
|
|
28
|
-
return "***";
|
|
29
|
-
if (apiKey.length <= 16)
|
|
30
|
-
return "sk_…";
|
|
31
|
-
return `${apiKey.slice(0, 10)}…${apiKey.slice(-4)}`;
|
|
32
|
-
}
|
|
33
|
-
export function createCheckProjectHandler(apiClient, _config) {
|
|
43
|
+
export function createCheckProjectHandler(apiClient, config) {
|
|
34
44
|
return async (params) => {
|
|
35
45
|
const cwd = params.cwd || process.cwd();
|
|
36
|
-
const
|
|
37
|
-
const currentSession = effectiveConfig.session || "default";
|
|
46
|
+
const currentSession = config.session || "default";
|
|
38
47
|
const skipApi = params.local_only === true;
|
|
39
48
|
const detected = detectProjectBinding(cwd);
|
|
40
49
|
if (!detected) {
|
|
41
|
-
return
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
},
|
|
58
|
-
], "Project is not bound to a ZIVIS org. Run 'zivis auth init' in your terminal to fix this.");
|
|
50
|
+
return {
|
|
51
|
+
content: [
|
|
52
|
+
{
|
|
53
|
+
type: "text",
|
|
54
|
+
text: JSON.stringify({
|
|
55
|
+
ok: false,
|
|
56
|
+
bound: false,
|
|
57
|
+
currentSession,
|
|
58
|
+
message: "No .zivis/project.json found for this directory. " +
|
|
59
|
+
"Without a binding there is no cross-org safety — refusing to proceed. " +
|
|
60
|
+
"Run: zivis auth login (auto-binds) or zivis auth init",
|
|
61
|
+
}, null, 2),
|
|
62
|
+
},
|
|
63
|
+
],
|
|
64
|
+
isError: true,
|
|
65
|
+
};
|
|
59
66
|
}
|
|
60
67
|
const { binding, filePath } = detected;
|
|
61
68
|
const sessionMatches = currentSession === binding.session;
|
|
62
|
-
|
|
63
|
-
const
|
|
69
|
+
// Source 2: local JWT
|
|
70
|
+
const tokens = await loadTokens(config.session);
|
|
71
|
+
const accessClaims = tokens ? decodeJwtPayload(tokens.access_token) : null;
|
|
72
|
+
const idClaims = tokens?.id_token ? decodeJwtPayload(tokens.id_token) : null;
|
|
73
|
+
const localJwtOrgId = accessClaims?.org_id;
|
|
74
|
+
const localEmail = idClaims?.email || accessClaims?.email;
|
|
75
|
+
// Source 3: API session (skip if local_only)
|
|
64
76
|
let apiSession = null;
|
|
65
77
|
let apiError = null;
|
|
66
78
|
if (!skipApi) {
|
|
67
|
-
if (!
|
|
68
|
-
apiError =
|
|
69
|
-
`No MCP API key for session "${currentSession}". ` +
|
|
70
|
-
`Run: zivis auth bind`;
|
|
79
|
+
if (!tokens) {
|
|
80
|
+
apiError = `No stored credentials for session "${currentSession}" — cannot contact API.`;
|
|
71
81
|
}
|
|
72
82
|
else {
|
|
73
83
|
try {
|
|
@@ -79,114 +89,92 @@ export function createCheckProjectHandler(apiClient, _config) {
|
|
|
79
89
|
}
|
|
80
90
|
}
|
|
81
91
|
const problems = [];
|
|
92
|
+
// Session name
|
|
82
93
|
if (!sessionMatches) {
|
|
83
94
|
problems.push(`Session mismatch: project expects "${binding.session}", current is "${currentSession}". ` +
|
|
84
95
|
`Set ZIVIS_SESSION=${binding.session} in your MCP config or run: zivis mcp install --for <ide> --session ${binding.session}`);
|
|
85
96
|
}
|
|
97
|
+
// Binding vs local JWT
|
|
86
98
|
if (!binding.workosOrgId) {
|
|
87
|
-
problems.push("Binding has no workosOrgId —
|
|
99
|
+
problems.push("Binding has no workosOrgId — upgrade with: zivis auth login");
|
|
100
|
+
}
|
|
101
|
+
else if (!tokens) {
|
|
102
|
+
problems.push(`No stored credentials for session "${currentSession}". Run: zivis auth login --session ${binding.session}`);
|
|
88
103
|
}
|
|
89
|
-
else if (!
|
|
90
|
-
problems.push(
|
|
91
|
-
`OAuth mints the key once — run: zivis auth bind`);
|
|
104
|
+
else if (!localJwtOrgId) {
|
|
105
|
+
problems.push("Stored JWT has no org_id claim — re-login to refresh: zivis auth login --session " + binding.session);
|
|
92
106
|
}
|
|
107
|
+
else if (localJwtOrgId !== binding.workosOrgId) {
|
|
108
|
+
problems.push(`CROSS-ORG RISK: local JWT org_id "${localJwtOrgId}" != binding workosOrgId "${binding.workosOrgId}"` +
|
|
109
|
+
`${binding.orgName ? ` (${binding.orgName})` : ""}. ` +
|
|
110
|
+
`Fix: zivis auth login --session ${binding.session}`);
|
|
111
|
+
}
|
|
112
|
+
// API agreement
|
|
93
113
|
if (!skipApi) {
|
|
94
114
|
if (apiError) {
|
|
95
|
-
problems.push(apiError);
|
|
115
|
+
problems.push(`API session check failed: ${apiError}`);
|
|
96
116
|
}
|
|
97
117
|
else if (apiSession) {
|
|
98
118
|
if (binding.workosOrgId && apiSession.org.workosOrgId !== binding.workosOrgId) {
|
|
99
119
|
problems.push(`CROSS-ORG RISK: API resolved org "${apiSession.org.workosOrgId}" (${apiSession.org.name}) ` +
|
|
100
120
|
`!= binding workosOrgId "${binding.workosOrgId}"${binding.orgName ? ` (${binding.orgName})` : ""}. ` +
|
|
101
|
-
`The API thinks
|
|
102
|
-
`Fix: zivis auth
|
|
121
|
+
`The API thinks you are in a different tenant than this project. ` +
|
|
122
|
+
`Fix: zivis auth login --session ${binding.session}`);
|
|
103
123
|
}
|
|
104
124
|
if (binding.orgId && apiSession.org.id !== binding.orgId) {
|
|
105
125
|
problems.push(`Zivis orgId mismatch: API returned "${apiSession.org.id}", binding expects "${binding.orgId}".`);
|
|
106
126
|
}
|
|
107
|
-
if (apiSession.jwtOrgId &&
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
problems.push(`API jwtOrgId claim "${apiSession.jwtOrgId}" does not match binding workosOrgId "${binding.workosOrgId}". ` +
|
|
111
|
-
`Mint a fresh binding token: zivis auth bind`);
|
|
127
|
+
if (localJwtOrgId && apiSession.jwtOrgId && localJwtOrgId !== apiSession.jwtOrgId) {
|
|
128
|
+
problems.push(`JWT org_id drift: local token has "${localJwtOrgId}", API saw "${apiSession.jwtOrgId}". ` +
|
|
129
|
+
"Token may have been swapped mid-flight — re-login.");
|
|
112
130
|
}
|
|
113
131
|
}
|
|
114
132
|
}
|
|
115
133
|
const ok = problems.length === 0;
|
|
116
|
-
const coreResult = {
|
|
117
|
-
ok,
|
|
118
|
-
bound: true,
|
|
119
|
-
bindingFile: filePath,
|
|
120
|
-
currentSession,
|
|
121
|
-
expectedSession: binding.session,
|
|
122
|
-
sessionMatches,
|
|
123
|
-
binding: {
|
|
124
|
-
workosOrgId: binding.workosOrgId || null,
|
|
125
|
-
orgId: binding.orgId || null,
|
|
126
|
-
orgName: binding.orgName || null,
|
|
127
|
-
applicationId: binding.applicationId || null,
|
|
128
|
-
applicationName: binding.applicationName || null,
|
|
129
|
-
},
|
|
130
|
-
localCredential: {
|
|
131
|
-
method: hasApiKey ? "apikey" : "none",
|
|
132
|
-
maskedKey: maskApiKey(creds.method === "apikey" ? creds.apiKey : undefined),
|
|
133
|
-
},
|
|
134
|
-
apiSession: skipApi
|
|
135
|
-
? { skipped: true }
|
|
136
|
-
: apiSession
|
|
137
|
-
? {
|
|
138
|
-
userEmail: apiSession.user.email,
|
|
139
|
-
orgWorkosOrgId: apiSession.org.workosOrgId,
|
|
140
|
-
orgId: apiSession.org.id,
|
|
141
|
-
orgName: apiSession.org.name,
|
|
142
|
-
jwtOrgId: apiSession.jwtOrgId,
|
|
143
|
-
}
|
|
144
|
-
: { error: apiError },
|
|
145
|
-
problems: problems.length ? problems : undefined,
|
|
146
|
-
message: ok
|
|
147
|
-
? `\u2713 Org alignment OK (${binding.orgName || binding.workosOrgId || "tenant"})${binding.applicationId
|
|
148
|
-
? `. Default app context: ${binding.applicationName || binding.applicationId}`
|
|
149
|
-
: ""}.`
|
|
150
|
-
: `\u2717 Org alignment FAILED. Do NOT proceed with tenant-scoped operations. See "problems".`,
|
|
151
|
-
};
|
|
152
|
-
if (ok) {
|
|
153
|
-
return withNextSteps(coreResult, [
|
|
154
|
-
{
|
|
155
|
-
id: "get_started",
|
|
156
|
-
label: "See what ZIVIS recommends doing next for this project",
|
|
157
|
-
tool: "zivis_get_started",
|
|
158
|
-
why: "Project is connected and healthy — get a personalized menu of next security steps.",
|
|
159
|
-
requires_tier: "free",
|
|
160
|
-
},
|
|
161
|
-
{
|
|
162
|
-
id: "check_deps",
|
|
163
|
-
label: "Check the open source libraries you depend on",
|
|
164
|
-
tool: "zivis_check_repo_trust",
|
|
165
|
-
why: "Free and fast — catches risky AI SDKs and known-bad dependencies.",
|
|
166
|
-
requires_tier: "free",
|
|
167
|
-
},
|
|
168
|
-
], `Project is correctly connected to ${binding.orgName ?? "your ZIVIS org"}.`);
|
|
169
|
-
}
|
|
170
134
|
return {
|
|
171
135
|
content: [
|
|
172
136
|
{
|
|
173
137
|
type: "text",
|
|
174
138
|
text: JSON.stringify({
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
139
|
+
ok,
|
|
140
|
+
bound: true,
|
|
141
|
+
bindingFile: filePath,
|
|
142
|
+
currentSession,
|
|
143
|
+
expectedSession: binding.session,
|
|
144
|
+
sessionMatches,
|
|
145
|
+
binding: {
|
|
146
|
+
workosOrgId: binding.workosOrgId || null,
|
|
147
|
+
orgId: binding.orgId || null,
|
|
148
|
+
orgName: binding.orgName || null,
|
|
149
|
+
applicationId: binding.applicationId || null,
|
|
150
|
+
applicationName: binding.applicationName || null,
|
|
151
|
+
},
|
|
152
|
+
localJwt: {
|
|
153
|
+
orgId: localJwtOrgId || null,
|
|
154
|
+
email: localEmail || null,
|
|
155
|
+
},
|
|
156
|
+
apiSession: skipApi
|
|
157
|
+
? { skipped: true }
|
|
158
|
+
: apiSession
|
|
159
|
+
? {
|
|
160
|
+
userEmail: apiSession.user.email,
|
|
161
|
+
orgWorkosOrgId: apiSession.org.workosOrgId,
|
|
162
|
+
orgId: apiSession.org.id,
|
|
163
|
+
orgName: apiSession.org.name,
|
|
164
|
+
jwtOrgId: apiSession.jwtOrgId,
|
|
165
|
+
}
|
|
166
|
+
: { error: apiError },
|
|
167
|
+
problems: problems.length ? problems : undefined,
|
|
168
|
+
message: ok
|
|
169
|
+
? `\u2713 Org alignment OK (${binding.orgName || binding.workosOrgId || "tenant"})${binding.applicationId
|
|
170
|
+
? `. Default app context: ${binding.applicationName || binding.applicationId}`
|
|
171
|
+
: ""}.`
|
|
172
|
+
: `\u2717 Org alignment FAILED. Do NOT proceed with tenant-scoped operations. See "problems".`,
|
|
186
173
|
}, null, 2),
|
|
187
174
|
},
|
|
188
175
|
],
|
|
189
|
-
isError:
|
|
176
|
+
isError: !ok,
|
|
190
177
|
};
|
|
191
178
|
};
|
|
192
179
|
}
|
|
180
|
+
//# sourceMappingURL=check-project.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"check-project.js","sourceRoot":"","sources":["../../src/tools/check-project.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACtD,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAIlD,MAAM,CAAC,MAAM,kBAAkB,GAAG,qBAAqB,CAAC;AAExD,MAAM,CAAC,MAAM,yBAAyB,GAAG;;;;;;;;;;;;;+EAasC,CAAC;AAEhF,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAClC,GAAG,EAAE,CAAC;SACH,MAAM,EAAE;SACR,QAAQ,EAAE;SACV,QAAQ,CAAC,qEAAqE,CA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AAC,GAAG,CAAC,IAAI;oCAC5B,QAAQ,EAAE,UAAU,CAAC,QAAQ;iCAC9B;gCACH,CAAC,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE;wBACvB,QAAQ,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS;wBAChD,OAAO,EAAE,EAAE;4BACT,CAAC,CAAC,4BAA4B,OAAO,CAAC,OAAO,IAAI,OAAO,CAAC,WAAW,IAAI,QAAQ,IAC5E,OAAO,CAAC,aAAa;gCACnB,CAAC,CAAC,0BAA0B,OAAO,CAAC,eAAe,IAAI,OAAO,CAAC,aAAa,EAAE;gCAC9E,CAAC,CAAC,EACN,GAAG;4BACL,CAAC,CAAC,4FAA4F;qBACjG,EACD,IAAI,EACJ,CAAC,CACF;iBACF;aACF;YACD,OAAO,EAAE,CAAC,EAAE;SACb,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -1,7 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* zivis_check_repo_trust — Check the OSS trust score for a GitHub repository
|
|
3
|
+
*
|
|
4
|
+
* Maps to: GET /api/oss-trust/repos/:owner/:repo (public, no auth required)
|
|
5
|
+
* POST /api/oss-trust/scan (to trigger a new scan)
|
|
6
|
+
* GET /api/oss-trust/repos/:owner/:repo/findings (findings list)
|
|
7
|
+
*
|
|
8
|
+
* This tool works without authentication — all OSS Trust endpoints are public.
|
|
9
|
+
*/
|
|
1
10
|
import { z } from "zod";
|
|
2
11
|
import type { ZivisConfig } from "../types.js";
|
|
3
12
|
export declare const CHECK_REPO_TRUST_NAME = "zivis_check_repo_trust";
|
|
4
|
-
export declare const CHECK_REPO_TRUST_DESCRIPTION = "Check
|
|
13
|
+
export declare const CHECK_REPO_TRUST_DESCRIPTION = "Check the AI/LLM security trust score for a GitHub repository using the ZIVIS OSS Trust Registry.\n\nUse this tool BEFORE pulling code from, merging PRs from, or depending on an open source repository. It scans for:\n- Prompt injection vulnerabilities (instruction overrides, jailbreaks)\n- Unsafe AI/LLM patterns (unvalidated tool calls, model output injection)\n- Agentic security issues (privilege escalation, lack of human-in-the-loop)\n- Hardcoded secrets and API keys\n- Suspicious code patterns\n\nAccepts a GitHub URL (https://github.com/owner/repo) or owner/repo string.\n\nReturns the trust grade (A+ through F), score (0-100), and detailed findings.\nIf the repo hasn't been scanned yet, it will trigger a scan automatically.\n\nNo authentication required \u2014 works with any public GitHub repository.\n\nFor the cryptographically signed attestation token (ZAT) suitable for machine verification, supply chain trust gates, and ATNP agent-to-agent trust negotiation, use zivis_get_oss_zat instead.";
|
|
5
14
|
export declare const CHECK_REPO_TRUST_SCHEMA: {
|
|
6
15
|
repo: z.ZodString;
|
|
7
16
|
trigger_scan: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
@@ -10,9 +19,15 @@ export declare function createCheckRepoTrustHandler(config: ZivisConfig): (param
|
|
|
10
19
|
repo: string;
|
|
11
20
|
trigger_scan?: boolean;
|
|
12
21
|
}) => Promise<{
|
|
13
|
-
content:
|
|
22
|
+
content: {
|
|
14
23
|
type: "text";
|
|
15
24
|
text: string;
|
|
16
|
-
}
|
|
17
|
-
isError
|
|
25
|
+
}[];
|
|
26
|
+
isError: boolean;
|
|
27
|
+
} | {
|
|
28
|
+
content: {
|
|
29
|
+
type: "text";
|
|
30
|
+
text: string;
|
|
31
|
+
}[];
|
|
32
|
+
isError?: undefined;
|
|
18
33
|
}>;
|
|
@@ -1,27 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* zivis_check_repo_trust — Check the OSS trust score for a GitHub repository
|
|
3
|
+
*
|
|
4
|
+
* Maps to: GET /api/oss-trust/repos/:owner/:repo (public, no auth required)
|
|
5
|
+
* POST /api/oss-trust/scan (to trigger a new scan)
|
|
6
|
+
* GET /api/oss-trust/repos/:owner/:repo/findings (findings list)
|
|
7
|
+
*
|
|
8
|
+
* This tool works without authentication — all OSS Trust endpoints are public.
|
|
9
|
+
*/
|
|
1
10
|
import { z } from "zod";
|
|
2
11
|
import { sanitizeResponse } from "../sanitize.js";
|
|
3
|
-
import { withNextSteps } from "../lib/next-steps.js";
|
|
4
12
|
export const CHECK_REPO_TRUST_NAME = "zivis_check_repo_trust";
|
|
5
|
-
export const CHECK_REPO_TRUST_DESCRIPTION = `Check
|
|
13
|
+
export const CHECK_REPO_TRUST_DESCRIPTION = `Check the AI/LLM security trust score for a GitHub repository using the ZIVIS OSS Trust Registry.
|
|
6
14
|
|
|
7
|
-
|
|
8
|
-
Returns a trust grade (A+ to F) and score (0-100). If the repo hasn't been scanned yet, it triggers a scan automatically.
|
|
9
|
-
|
|
10
|
-
Checks for:
|
|
15
|
+
Use this tool BEFORE pulling code from, merging PRs from, or depending on an open source repository. It scans for:
|
|
11
16
|
- Prompt injection vulnerabilities (instruction overrides, jailbreaks)
|
|
12
17
|
- Unsafe AI/LLM patterns (unvalidated tool calls, model output injection)
|
|
13
18
|
- Agentic security issues (privilege escalation, lack of human-in-the-loop)
|
|
14
19
|
- Hardcoded secrets and API keys
|
|
15
|
-
- Suspicious
|
|
20
|
+
- Suspicious code patterns
|
|
21
|
+
|
|
22
|
+
Accepts a GitHub URL (https://github.com/owner/repo) or owner/repo string.
|
|
16
23
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
- "Check this dependency before we merge it" → repo=<owner>/<repo>
|
|
20
|
-
- User adds a new entry to package.json / requirements.txt / go.mod
|
|
24
|
+
Returns the trust grade (A+ through F), score (0-100), and detailed findings.
|
|
25
|
+
If the repo hasn't been scanned yet, it will trigger a scan automatically.
|
|
21
26
|
|
|
22
|
-
|
|
27
|
+
No authentication required — works with any public GitHub repository.
|
|
23
28
|
|
|
24
|
-
|
|
29
|
+
For the cryptographically signed attestation token (ZAT) suitable for machine verification, supply chain trust gates, and ATNP agent-to-agent trust negotiation, use zivis_get_oss_zat instead.`;
|
|
25
30
|
export const CHECK_REPO_TRUST_SCHEMA = {
|
|
26
31
|
repo: z
|
|
27
32
|
.string()
|
|
@@ -32,12 +37,15 @@ export const CHECK_REPO_TRUST_SCHEMA = {
|
|
|
32
37
|
.default(true)
|
|
33
38
|
.describe("If true (default), trigger a scan when no results exist yet"),
|
|
34
39
|
};
|
|
40
|
+
/** Parse GitHub URL or owner/repo into components */
|
|
35
41
|
function parseRepo(input) {
|
|
36
42
|
const trimmed = input.trim();
|
|
43
|
+
// URL: https://github.com/owner/repo[.git][/...]
|
|
37
44
|
const urlMatch = trimmed.match(/^https?:\/\/(?:www\.)?github\.com\/([a-zA-Z0-9._-]+)\/([a-zA-Z0-9._-]+)/);
|
|
38
45
|
if (urlMatch) {
|
|
39
46
|
return { owner: urlMatch[1], repo: urlMatch[2].replace(/\.git$/, "") };
|
|
40
47
|
}
|
|
48
|
+
// owner/repo
|
|
41
49
|
const slashMatch = trimmed.match(/^([a-zA-Z0-9._-]+)\/([a-zA-Z0-9._-]+)$/);
|
|
42
50
|
if (slashMatch) {
|
|
43
51
|
return { owner: slashMatch[1], repo: slashMatch[2] };
|
|
@@ -61,9 +69,12 @@ export function createCheckRepoTrustHandler(config) {
|
|
|
61
69
|
}
|
|
62
70
|
const { owner, repo } = parsed;
|
|
63
71
|
const baseUrl = config.apiBaseUrl;
|
|
72
|
+
// Step 1: Check if repo has existing trust data
|
|
64
73
|
const repoRes = await fetch(`${baseUrl}/api/oss-trust/repos/${owner}/${repo}`);
|
|
65
74
|
if (repoRes.status === 404 || (repoRes.ok && (await repoRes.clone().json()).trustScore == null)) {
|
|
75
|
+
// No scan results yet
|
|
66
76
|
if (params.trigger_scan !== false) {
|
|
77
|
+
// Trigger a scan
|
|
67
78
|
const scanRes = await fetch(`${baseUrl}/api/oss-trust/scan`, {
|
|
68
79
|
method: "POST",
|
|
69
80
|
headers: { "Content-Type": "application/json" },
|
|
@@ -72,6 +83,8 @@ export function createCheckRepoTrustHandler(config) {
|
|
|
72
83
|
if (scanRes.ok) {
|
|
73
84
|
const scanData = await scanRes.json();
|
|
74
85
|
if (scanData.deduplicated && scanData.status === "completed") {
|
|
86
|
+
// There's a completed scan but the entry wasn't found? Rare edge case.
|
|
87
|
+
// Re-fetch the entry
|
|
75
88
|
}
|
|
76
89
|
else {
|
|
77
90
|
return {
|
|
@@ -107,6 +120,7 @@ export function createCheckRepoTrustHandler(config) {
|
|
|
107
120
|
};
|
|
108
121
|
}
|
|
109
122
|
}
|
|
123
|
+
// Step 2: Fetch trust entry data
|
|
110
124
|
const entryRes = await fetch(`${baseUrl}/api/oss-trust/repos/${owner}/${repo}`);
|
|
111
125
|
if (!entryRes.ok) {
|
|
112
126
|
return {
|
|
@@ -120,6 +134,7 @@ export function createCheckRepoTrustHandler(config) {
|
|
|
120
134
|
};
|
|
121
135
|
}
|
|
122
136
|
const entry = await entryRes.json();
|
|
137
|
+
// Step 3: Fetch findings if scan is complete
|
|
123
138
|
let findings = [];
|
|
124
139
|
if (entry.trustScore != null) {
|
|
125
140
|
const findingsRes = await fetch(`${baseUrl}/api/oss-trust/repos/${owner}/${repo}/findings?limit=25`);
|
|
@@ -128,59 +143,34 @@ export function createCheckRepoTrustHandler(config) {
|
|
|
128
143
|
findings = findingsData.findings || [];
|
|
129
144
|
}
|
|
130
145
|
}
|
|
131
|
-
const findingCounts = {
|
|
132
|
-
critical: entry.findingsCritical ?? 0,
|
|
133
|
-
high: entry.findingsHigh ?? 0,
|
|
134
|
-
medium: entry.findingsMedium ?? 0,
|
|
135
|
-
low: entry.findingsLow ?? 0,
|
|
136
|
-
total: (entry.findingsCritical ?? 0) +
|
|
137
|
-
(entry.findingsHigh ?? 0) +
|
|
138
|
-
(entry.findingsMedium ?? 0) +
|
|
139
|
-
(entry.findingsLow ?? 0),
|
|
140
|
-
};
|
|
141
146
|
const result = sanitizeResponse({
|
|
142
147
|
repository: `${owner}/${repo}`,
|
|
143
148
|
trustGrade: entry.trustGrade,
|
|
144
149
|
trustScore: entry.trustScore,
|
|
145
150
|
lastScannedAt: entry.lastScannedAt,
|
|
146
151
|
lastCommitSha: entry.lastCommitSha,
|
|
147
|
-
findings:
|
|
152
|
+
findings: {
|
|
153
|
+
critical: entry.findingsCritical ?? 0,
|
|
154
|
+
high: entry.findingsHigh ?? 0,
|
|
155
|
+
medium: entry.findingsMedium ?? 0,
|
|
156
|
+
low: entry.findingsLow ?? 0,
|
|
157
|
+
total: (entry.findingsCritical ?? 0) +
|
|
158
|
+
(entry.findingsHigh ?? 0) +
|
|
159
|
+
(entry.findingsMedium ?? 0) +
|
|
160
|
+
(entry.findingsLow ?? 0),
|
|
161
|
+
},
|
|
148
162
|
verdict: getVerdict(entry.trustScore, entry.trustGrade),
|
|
149
163
|
details: findings,
|
|
150
164
|
viewUrl: `${baseUrl}/oss-trust/${owner}/${repo}`,
|
|
151
165
|
});
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
tool: "zivis_get_findings",
|
|
161
|
-
args_hint: { source_type: "agent" },
|
|
162
|
-
why: isHighRisk
|
|
163
|
-
? "High-risk repo — review findings before using this dependency."
|
|
164
|
-
: "See the specific issues found so you can decide whether to use this library.",
|
|
165
|
-
requires_tier: "free",
|
|
166
|
-
},
|
|
167
|
-
]
|
|
168
|
-
: []),
|
|
169
|
-
{
|
|
170
|
-
id: "check_another_dep",
|
|
171
|
-
label: "Check another dependency",
|
|
172
|
-
tool: "zivis_check_repo_trust",
|
|
173
|
-
why: "Run this for every external library you pull in — catches risks before they reach production.",
|
|
174
|
-
requires_tier: "free",
|
|
175
|
-
},
|
|
176
|
-
{
|
|
177
|
-
id: "setup_app_target",
|
|
178
|
-
label: "Set up your app for deeper security testing",
|
|
179
|
-
tool: "zivis_setup_red_team_target",
|
|
180
|
-
why: "Dep checks find supply-chain risk; a red team test finds runtime vulnerabilities in your own app.",
|
|
181
|
-
requires_tier: "free",
|
|
182
|
-
},
|
|
183
|
-
], `${owner}/${repo} — grade ${entry.trustGrade ?? "?"}, score ${entry.trustScore ?? "?"}/100. ${getVerdict(entry.trustScore, entry.trustGrade)}.`);
|
|
166
|
+
return {
|
|
167
|
+
content: [
|
|
168
|
+
{
|
|
169
|
+
type: "text",
|
|
170
|
+
text: JSON.stringify(result, null, 2),
|
|
171
|
+
},
|
|
172
|
+
],
|
|
173
|
+
};
|
|
184
174
|
}
|
|
185
175
|
catch (err) {
|
|
186
176
|
const message = err instanceof Error ? err.message : "Failed to check repo trust";
|
|
@@ -219,3 +209,4 @@ function formatScanPending(owner, repo, scanData, baseUrl) {
|
|
|
219
209
|
];
|
|
220
210
|
return lines.join("\n");
|
|
221
211
|
}
|
|
212
|
+
//# sourceMappingURL=check-repo-trust.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"check-repo-trust.js","sourceRoot":"","sources":["../../src/tools/check-repo-trust.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAElD,MAAM,CAAC,MAAM,qBAAqB,GAAG,wBAAwB,CAAC;AAE9D,MAAM,CAAC,MAAM,4BAA4B,GAAG;;;;;;;;;;;;;;;;gMAgBoJ,CAAC;AAEjM,MAAM,CAAC,MAAM,uBAAuB,GAAG;IACrC,IAAI,EAAE,CAAC;SACJ,MAAM,EAAE;SACR,QAAQ,CACP,sEAAsE,CACvE;IACH,YAAY,EAAE,CAAC;SACZ,OAAO,EAAE;SACT,QAAQ,EAAE;SACV,OAAO,CAAC,IAAI,CAAC;SACb,QAAQ,CACP,6DAA6D,CAC9D;CACJ,CAAC;AAEF,qDAAqD;AACrD,SAAS,SAAS,CAAC,KAAa;IAC9B,MAAM,OAAO,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC;IAC7B,iDAAiD;IACjD,MAAM,QAAQ,GAAG,OAAO,CAAC,KAAK,CAC5B,yEAAyE,CAC1E,CAAC;IACF,IAAI,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C;AACpG,CAAC;AAED,SAAS,iBAAiB,CACxB,KAAa,EACb,IAAY,EACZ,QAAiC,EACjC,OAAe;IAEf,MAAM,KAAK,GAAG;QACZ,sBAAsB,KAAK,IAAI,IAAI,EAAE;QACrC,EAAE;QACF,sDAAsD;QACtD,kBAAkB,QAAQ,CAAC,MAAM,EAAE;QACnC,iBAAiB,QAAQ,CAAC,MAAM,EAAE;QAClC,EAAE;QACF,iEAAiE;QACjE,GAAG,OAAO,cAAc,KAAK,IAAI,IAAI,EAAE;QACvC,EAAE;QACF,0DAA0D;KAC3D,CAAC;IACF,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC"}
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* zivis_create_diagram — Create a new diagram with nodes, connections, and boundaries
|
|
3
|
+
*
|
|
4
|
+
* Maps to: POST /api/diagrams + optional POST /api/diagrams/:id/link
|
|
5
|
+
*/
|
|
1
6
|
import { z } from "zod";
|
|
2
7
|
import type { ApiClient } from "../api-client.js";
|
|
3
8
|
export declare const CREATE_DIAGRAM_NAME = "zivis_create_diagram";
|