vaspera 2.5.0
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/CHANGELOG.md +184 -0
- package/LICENSE +21 -0
- package/README.md +809 -0
- package/dist/__tests__/integration/certification-flow.test.d.ts +5 -0
- package/dist/__tests__/integration/certification-flow.test.d.ts.map +1 -0
- package/dist/__tests__/integration/certification-flow.test.js +245 -0
- package/dist/__tests__/integration/certification-flow.test.js.map +1 -0
- package/dist/__tests__/integration/commands.test.d.ts +5 -0
- package/dist/__tests__/integration/commands.test.d.ts.map +1 -0
- package/dist/__tests__/integration/commands.test.js +93 -0
- package/dist/__tests__/integration/commands.test.js.map +1 -0
- package/dist/action/diff-mode.d.ts +34 -0
- package/dist/action/diff-mode.d.ts.map +1 -0
- package/dist/action/diff-mode.js +201 -0
- package/dist/action/diff-mode.js.map +1 -0
- package/dist/action/diff-mode.test.d.ts +5 -0
- package/dist/action/diff-mode.test.d.ts.map +1 -0
- package/dist/action/diff-mode.test.js +162 -0
- package/dist/action/diff-mode.test.js.map +1 -0
- package/dist/action/index.d.ts +10 -0
- package/dist/action/index.d.ts.map +1 -0
- package/dist/action/index.js +231 -0
- package/dist/action/index.js.map +1 -0
- package/dist/action/pr-comment.d.ts +30 -0
- package/dist/action/pr-comment.d.ts.map +1 -0
- package/dist/action/pr-comment.js +301 -0
- package/dist/action/pr-comment.js.map +1 -0
- package/dist/action/pr-comment.test.d.ts +5 -0
- package/dist/action/pr-comment.test.d.ts.map +1 -0
- package/dist/action/pr-comment.test.js +189 -0
- package/dist/action/pr-comment.test.js.map +1 -0
- package/dist/action/sarif-upload.d.ts +104 -0
- package/dist/action/sarif-upload.d.ts.map +1 -0
- package/dist/action/sarif-upload.js +188 -0
- package/dist/action/sarif-upload.js.map +1 -0
- package/dist/action/sarif-upload.test.d.ts +5 -0
- package/dist/action/sarif-upload.test.d.ts.map +1 -0
- package/dist/action/sarif-upload.test.js +206 -0
- package/dist/action/sarif-upload.test.js.map +1 -0
- package/dist/action/types.d.ts +104 -0
- package/dist/action/types.d.ts.map +1 -0
- package/dist/action/types.js +33 -0
- package/dist/action/types.js.map +1 -0
- package/dist/action/types.test.d.ts +5 -0
- package/dist/action/types.test.d.ts.map +1 -0
- package/dist/action/types.test.js +79 -0
- package/dist/action/types.test.js.map +1 -0
- package/dist/agents/agent-integrity.d.ts +111 -0
- package/dist/agents/agent-integrity.d.ts.map +1 -0
- package/dist/agents/agent-integrity.js +308 -0
- package/dist/agents/agent-integrity.js.map +1 -0
- package/dist/agents/agent-privacy.d.ts +68 -0
- package/dist/agents/agent-privacy.d.ts.map +1 -0
- package/dist/agents/agent-privacy.js +345 -0
- package/dist/agents/agent-privacy.js.map +1 -0
- package/dist/agents/exploit-chain.d.ts +64 -0
- package/dist/agents/exploit-chain.d.ts.map +1 -0
- package/dist/agents/exploit-chain.js +477 -0
- package/dist/agents/exploit-chain.js.map +1 -0
- package/dist/agents/exploit-chain.test.d.ts +5 -0
- package/dist/agents/exploit-chain.test.d.ts.map +1 -0
- package/dist/agents/exploit-chain.test.js +455 -0
- package/dist/agents/exploit-chain.test.js.map +1 -0
- package/dist/agents/index.d.ts +14 -0
- package/dist/agents/index.d.ts.map +1 -0
- package/dist/agents/index.js +19 -0
- package/dist/agents/index.js.map +1 -0
- package/dist/agents/logic-flaw-detector.d.ts +55 -0
- package/dist/agents/logic-flaw-detector.d.ts.map +1 -0
- package/dist/agents/logic-flaw-detector.js +454 -0
- package/dist/agents/logic-flaw-detector.js.map +1 -0
- package/dist/agents/zero-day-hunter.d.ts +69 -0
- package/dist/agents/zero-day-hunter.d.ts.map +1 -0
- package/dist/agents/zero-day-hunter.js +591 -0
- package/dist/agents/zero-day-hunter.js.map +1 -0
- package/dist/certification/artifacts.d.ts +21 -0
- package/dist/certification/artifacts.d.ts.map +1 -0
- package/dist/certification/artifacts.js +275 -0
- package/dist/certification/artifacts.js.map +1 -0
- package/dist/certification/autofix.d.ts +122 -0
- package/dist/certification/autofix.d.ts.map +1 -0
- package/dist/certification/autofix.js +476 -0
- package/dist/certification/autofix.js.map +1 -0
- package/dist/certification/badge.d.ts +56 -0
- package/dist/certification/badge.d.ts.map +1 -0
- package/dist/certification/badge.js +155 -0
- package/dist/certification/badge.js.map +1 -0
- package/dist/certification/cache.d.ts +121 -0
- package/dist/certification/cache.d.ts.map +1 -0
- package/dist/certification/cache.js +275 -0
- package/dist/certification/cache.js.map +1 -0
- package/dist/certification/cache.test.d.ts +5 -0
- package/dist/certification/cache.test.d.ts.map +1 -0
- package/dist/certification/cache.test.js +270 -0
- package/dist/certification/cache.test.js.map +1 -0
- package/dist/certification/consensus.d.ts +105 -0
- package/dist/certification/consensus.d.ts.map +1 -0
- package/dist/certification/consensus.js +353 -0
- package/dist/certification/consensus.js.map +1 -0
- package/dist/certification/consensus.test.d.ts +5 -0
- package/dist/certification/consensus.test.d.ts.map +1 -0
- package/dist/certification/consensus.test.js +342 -0
- package/dist/certification/consensus.test.js.map +1 -0
- package/dist/certification/index.d.ts +14 -0
- package/dist/certification/index.d.ts.map +1 -0
- package/dist/certification/index.js +14 -0
- package/dist/certification/index.js.map +1 -0
- package/dist/certification/rules.d.ts +89 -0
- package/dist/certification/rules.d.ts.map +1 -0
- package/dist/certification/rules.js +317 -0
- package/dist/certification/rules.js.map +1 -0
- package/dist/certification/sarif.d.ts +107 -0
- package/dist/certification/sarif.d.ts.map +1 -0
- package/dist/certification/sarif.js +191 -0
- package/dist/certification/sarif.js.map +1 -0
- package/dist/certification/store.d.ts +255 -0
- package/dist/certification/store.d.ts.map +1 -0
- package/dist/certification/store.js +835 -0
- package/dist/certification/store.js.map +1 -0
- package/dist/certification/store.test.d.ts +5 -0
- package/dist/certification/store.test.d.ts.map +1 -0
- package/dist/certification/store.test.js +468 -0
- package/dist/certification/store.test.js.map +1 -0
- package/dist/certification/summary.d.ts +72 -0
- package/dist/certification/summary.d.ts.map +1 -0
- package/dist/certification/summary.js +296 -0
- package/dist/certification/summary.js.map +1 -0
- package/dist/certification/types.d.ts +138 -0
- package/dist/certification/types.d.ts.map +1 -0
- package/dist/certification/types.js +34 -0
- package/dist/certification/types.js.map +1 -0
- package/dist/commands/audits/api-check.d.ts +3 -0
- package/dist/commands/audits/api-check.d.ts.map +1 -0
- package/dist/commands/audits/api-check.js +71 -0
- package/dist/commands/audits/api-check.js.map +1 -0
- package/dist/commands/audits/deadcode.d.ts +3 -0
- package/dist/commands/audits/deadcode.d.ts.map +1 -0
- package/dist/commands/audits/deadcode.js +63 -0
- package/dist/commands/audits/deadcode.js.map +1 -0
- package/dist/commands/audits/deps.d.ts +3 -0
- package/dist/commands/audits/deps.d.ts.map +1 -0
- package/dist/commands/audits/deps.js +56 -0
- package/dist/commands/audits/deps.js.map +1 -0
- package/dist/commands/audits/errors.d.ts +3 -0
- package/dist/commands/audits/errors.d.ts.map +1 -0
- package/dist/commands/audits/errors.js +65 -0
- package/dist/commands/audits/errors.js.map +1 -0
- package/dist/commands/audits/index.d.ts +3 -0
- package/dist/commands/audits/index.d.ts.map +1 -0
- package/dist/commands/audits/index.js +15 -0
- package/dist/commands/audits/index.js.map +1 -0
- package/dist/commands/audits/perf.d.ts +3 -0
- package/dist/commands/audits/perf.d.ts.map +1 -0
- package/dist/commands/audits/perf.js +85 -0
- package/dist/commands/audits/perf.js.map +1 -0
- package/dist/commands/audits/secrets.d.ts +3 -0
- package/dist/commands/audits/secrets.d.ts.map +1 -0
- package/dist/commands/audits/secrets.js +71 -0
- package/dist/commands/audits/secrets.js.map +1 -0
- package/dist/commands/certification/certify.d.ts +3 -0
- package/dist/commands/certification/certify.d.ts.map +1 -0
- package/dist/commands/certification/certify.js +108 -0
- package/dist/commands/certification/certify.js.map +1 -0
- package/dist/commands/certification/index.d.ts +3 -0
- package/dist/commands/certification/index.d.ts.map +1 -0
- package/dist/commands/certification/index.js +17 -0
- package/dist/commands/certification/index.js.map +1 -0
- package/dist/commands/certification/performance.d.ts +3 -0
- package/dist/commands/certification/performance.d.ts.map +1 -0
- package/dist/commands/certification/performance.js +89 -0
- package/dist/commands/certification/performance.js.map +1 -0
- package/dist/commands/certification/quality.d.ts +3 -0
- package/dist/commands/certification/quality.d.ts.map +1 -0
- package/dist/commands/certification/quality.js +92 -0
- package/dist/commands/certification/quality.js.map +1 -0
- package/dist/commands/certification/redteam.d.ts +3 -0
- package/dist/commands/certification/redteam.d.ts.map +1 -0
- package/dist/commands/certification/redteam.js +114 -0
- package/dist/commands/certification/redteam.js.map +1 -0
- package/dist/commands/certification/reliability.d.ts +3 -0
- package/dist/commands/certification/reliability.d.ts.map +1 -0
- package/dist/commands/certification/reliability.js +93 -0
- package/dist/commands/certification/reliability.js.map +1 -0
- package/dist/commands/certification/security.d.ts +3 -0
- package/dist/commands/certification/security.d.ts.map +1 -0
- package/dist/commands/certification/security.js +90 -0
- package/dist/commands/certification/security.js.map +1 -0
- package/dist/commands/certification/typesafety.d.ts +3 -0
- package/dist/commands/certification/typesafety.d.ts.map +1 -0
- package/dist/commands/certification/typesafety.js +87 -0
- package/dist/commands/certification/typesafety.js.map +1 -0
- package/dist/commands/core/add-tests.d.ts +3 -0
- package/dist/commands/core/add-tests.d.ts.map +1 -0
- package/dist/commands/core/add-tests.js +29 -0
- package/dist/commands/core/add-tests.js.map +1 -0
- package/dist/commands/core/audit.d.ts +3 -0
- package/dist/commands/core/audit.d.ts.map +1 -0
- package/dist/commands/core/audit.js +64 -0
- package/dist/commands/core/audit.js.map +1 -0
- package/dist/commands/core/fix-critical.d.ts +3 -0
- package/dist/commands/core/fix-critical.d.ts.map +1 -0
- package/dist/commands/core/fix-critical.js +22 -0
- package/dist/commands/core/fix-critical.js.map +1 -0
- package/dist/commands/core/fix-high.d.ts +3 -0
- package/dist/commands/core/fix-high.d.ts.map +1 -0
- package/dist/commands/core/fix-high.js +32 -0
- package/dist/commands/core/fix-high.js.map +1 -0
- package/dist/commands/core/fix-medium.d.ts +3 -0
- package/dist/commands/core/fix-medium.d.ts.map +1 -0
- package/dist/commands/core/fix-medium.js +29 -0
- package/dist/commands/core/fix-medium.js.map +1 -0
- package/dist/commands/core/fix-rls.d.ts +3 -0
- package/dist/commands/core/fix-rls.d.ts.map +1 -0
- package/dist/commands/core/fix-rls.js +17 -0
- package/dist/commands/core/fix-rls.js.map +1 -0
- package/dist/commands/core/harden.d.ts +3 -0
- package/dist/commands/core/harden.d.ts.map +1 -0
- package/dist/commands/core/harden.js +19 -0
- package/dist/commands/core/harden.js.map +1 -0
- package/dist/commands/core/index.d.ts +3 -0
- package/dist/commands/core/index.d.ts.map +1 -0
- package/dist/commands/core/index.js +21 -0
- package/dist/commands/core/index.js.map +1 -0
- package/dist/commands/core/preflight.d.ts +3 -0
- package/dist/commands/core/preflight.d.ts.map +1 -0
- package/dist/commands/core/preflight.js +50 -0
- package/dist/commands/core/preflight.js.map +1 -0
- package/dist/commands/core/verify.d.ts +3 -0
- package/dist/commands/core/verify.d.ts.map +1 -0
- package/dist/commands/core/verify.js +32 -0
- package/dist/commands/core/verify.js.map +1 -0
- package/dist/commands/index.d.ts +28 -0
- package/dist/commands/index.d.ts.map +1 -0
- package/dist/commands/index.js +37 -0
- package/dist/commands/index.js.map +1 -0
- package/dist/commands/types.d.ts +9 -0
- package/dist/commands/types.d.ts.map +1 -0
- package/dist/commands/types.js +5 -0
- package/dist/commands/types.js.map +1 -0
- package/dist/compliance/cis.d.ts +29 -0
- package/dist/compliance/cis.d.ts.map +1 -0
- package/dist/compliance/cis.js +316 -0
- package/dist/compliance/cis.js.map +1 -0
- package/dist/compliance/frameworks/eu-ai-act.d.ts +55 -0
- package/dist/compliance/frameworks/eu-ai-act.d.ts.map +1 -0
- package/dist/compliance/frameworks/eu-ai-act.js +621 -0
- package/dist/compliance/frameworks/eu-ai-act.js.map +1 -0
- package/dist/compliance/frameworks/index.d.ts +67 -0
- package/dist/compliance/frameworks/index.d.ts.map +1 -0
- package/dist/compliance/frameworks/index.js +97 -0
- package/dist/compliance/frameworks/index.js.map +1 -0
- package/dist/compliance/frameworks/iso-42001.d.ts +59 -0
- package/dist/compliance/frameworks/iso-42001.d.ts.map +1 -0
- package/dist/compliance/frameworks/iso-42001.js +719 -0
- package/dist/compliance/frameworks/iso-42001.js.map +1 -0
- package/dist/compliance/frameworks/mitre-atlas.d.ts +58 -0
- package/dist/compliance/frameworks/mitre-atlas.d.ts.map +1 -0
- package/dist/compliance/frameworks/mitre-atlas.js +686 -0
- package/dist/compliance/frameworks/mitre-atlas.js.map +1 -0
- package/dist/compliance/frameworks/nist-ai-rmf.d.ts +51 -0
- package/dist/compliance/frameworks/nist-ai-rmf.d.ts.map +1 -0
- package/dist/compliance/frameworks/nist-ai-rmf.js +677 -0
- package/dist/compliance/frameworks/nist-ai-rmf.js.map +1 -0
- package/dist/compliance/frameworks/owasp-llm.d.ts +58 -0
- package/dist/compliance/frameworks/owasp-llm.d.ts.map +1 -0
- package/dist/compliance/frameworks/owasp-llm.js +399 -0
- package/dist/compliance/frameworks/owasp-llm.js.map +1 -0
- package/dist/compliance/gdpr.d.ts +34 -0
- package/dist/compliance/gdpr.d.ts.map +1 -0
- package/dist/compliance/gdpr.js +319 -0
- package/dist/compliance/gdpr.js.map +1 -0
- package/dist/compliance/hipaa.d.ts +29 -0
- package/dist/compliance/hipaa.d.ts.map +1 -0
- package/dist/compliance/hipaa.js +205 -0
- package/dist/compliance/hipaa.js.map +1 -0
- package/dist/compliance/index.d.ts +18 -0
- package/dist/compliance/index.d.ts.map +1 -0
- package/dist/compliance/index.js +26 -0
- package/dist/compliance/index.js.map +1 -0
- package/dist/compliance/iso27001.d.ts +30 -0
- package/dist/compliance/iso27001.d.ts.map +1 -0
- package/dist/compliance/iso27001.js +332 -0
- package/dist/compliance/iso27001.js.map +1 -0
- package/dist/compliance/mapper.d.ts +42 -0
- package/dist/compliance/mapper.d.ts.map +1 -0
- package/dist/compliance/mapper.js +269 -0
- package/dist/compliance/mapper.js.map +1 -0
- package/dist/compliance/mapper.test.d.ts +5 -0
- package/dist/compliance/mapper.test.d.ts.map +1 -0
- package/dist/compliance/mapper.test.js +360 -0
- package/dist/compliance/mapper.test.js.map +1 -0
- package/dist/compliance/pci-dss.d.ts +29 -0
- package/dist/compliance/pci-dss.d.ts.map +1 -0
- package/dist/compliance/pci-dss.js +247 -0
- package/dist/compliance/pci-dss.js.map +1 -0
- package/dist/compliance/report.d.ts +25 -0
- package/dist/compliance/report.d.ts.map +1 -0
- package/dist/compliance/report.js +254 -0
- package/dist/compliance/report.js.map +1 -0
- package/dist/compliance/report.test.d.ts +5 -0
- package/dist/compliance/report.test.d.ts.map +1 -0
- package/dist/compliance/report.test.js +128 -0
- package/dist/compliance/report.test.js.map +1 -0
- package/dist/compliance/soc2.d.ts +30 -0
- package/dist/compliance/soc2.d.ts.map +1 -0
- package/dist/compliance/soc2.js +262 -0
- package/dist/compliance/soc2.js.map +1 -0
- package/dist/compliance/soc2.test.d.ts +5 -0
- package/dist/compliance/soc2.test.d.ts.map +1 -0
- package/dist/compliance/soc2.test.js +86 -0
- package/dist/compliance/soc2.test.js.map +1 -0
- package/dist/compliance/types.d.ts +125 -0
- package/dist/compliance/types.d.ts.map +1 -0
- package/dist/compliance/types.js +10 -0
- package/dist/compliance/types.js.map +1 -0
- package/dist/config/flags.d.ts +456 -0
- package/dist/config/flags.d.ts.map +1 -0
- package/dist/config/flags.js +464 -0
- package/dist/config/flags.js.map +1 -0
- package/dist/config/index.d.ts +10 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/index.js +10 -0
- package/dist/config/index.js.map +1 -0
- package/dist/config/severity-overrides.d.ts +209 -0
- package/dist/config/severity-overrides.d.ts.map +1 -0
- package/dist/config/severity-overrides.js +380 -0
- package/dist/config/severity-overrides.js.map +1 -0
- package/dist/cost/index.d.ts +11 -0
- package/dist/cost/index.d.ts.map +1 -0
- package/dist/cost/index.js +12 -0
- package/dist/cost/index.js.map +1 -0
- package/dist/cost/pricing.d.ts +57 -0
- package/dist/cost/pricing.d.ts.map +1 -0
- package/dist/cost/pricing.js +196 -0
- package/dist/cost/pricing.js.map +1 -0
- package/dist/cost/pricing.test.d.ts +5 -0
- package/dist/cost/pricing.test.d.ts.map +1 -0
- package/dist/cost/pricing.test.js +195 -0
- package/dist/cost/pricing.test.js.map +1 -0
- package/dist/cost/tracker.d.ts +100 -0
- package/dist/cost/tracker.d.ts.map +1 -0
- package/dist/cost/tracker.js +366 -0
- package/dist/cost/tracker.js.map +1 -0
- package/dist/cost/tracker.test.d.ts +5 -0
- package/dist/cost/tracker.test.d.ts.map +1 -0
- package/dist/cost/tracker.test.js +360 -0
- package/dist/cost/tracker.test.js.map +1 -0
- package/dist/cost/types.d.ts +135 -0
- package/dist/cost/types.d.ts.map +1 -0
- package/dist/cost/types.js +9 -0
- package/dist/cost/types.js.map +1 -0
- package/dist/enterprise/auth/oidc.d.ts +231 -0
- package/dist/enterprise/auth/oidc.d.ts.map +1 -0
- package/dist/enterprise/auth/oidc.js +372 -0
- package/dist/enterprise/auth/oidc.js.map +1 -0
- package/dist/enterprise/auth/oidc.test.d.ts +5 -0
- package/dist/enterprise/auth/oidc.test.d.ts.map +1 -0
- package/dist/enterprise/auth/oidc.test.js +435 -0
- package/dist/enterprise/auth/oidc.test.js.map +1 -0
- package/dist/enterprise/index.d.ts +14 -0
- package/dist/enterprise/index.d.ts.map +1 -0
- package/dist/enterprise/index.js +19 -0
- package/dist/enterprise/index.js.map +1 -0
- package/dist/enterprise/integrations/chat.d.ts +205 -0
- package/dist/enterprise/integrations/chat.d.ts.map +1 -0
- package/dist/enterprise/integrations/chat.js +624 -0
- package/dist/enterprise/integrations/chat.js.map +1 -0
- package/dist/enterprise/integrations/chat.test.d.ts +5 -0
- package/dist/enterprise/integrations/chat.test.d.ts.map +1 -0
- package/dist/enterprise/integrations/chat.test.js +557 -0
- package/dist/enterprise/integrations/chat.test.js.map +1 -0
- package/dist/enterprise/integrations/ticketing.d.ts +257 -0
- package/dist/enterprise/integrations/ticketing.d.ts.map +1 -0
- package/dist/enterprise/integrations/ticketing.js +548 -0
- package/dist/enterprise/integrations/ticketing.js.map +1 -0
- package/dist/enterprise/integrations/ticketing.test.d.ts +5 -0
- package/dist/enterprise/integrations/ticketing.test.d.ts.map +1 -0
- package/dist/enterprise/integrations/ticketing.test.js +693 -0
- package/dist/enterprise/integrations/ticketing.test.js.map +1 -0
- package/dist/enterprise/policy/opa.d.ts +194 -0
- package/dist/enterprise/policy/opa.d.ts.map +1 -0
- package/dist/enterprise/policy/opa.js +385 -0
- package/dist/enterprise/policy/opa.js.map +1 -0
- package/dist/enterprise/policy/opa.test.d.ts +5 -0
- package/dist/enterprise/policy/opa.test.d.ts.map +1 -0
- package/dist/enterprise/policy/opa.test.js +702 -0
- package/dist/enterprise/policy/opa.test.js.map +1 -0
- package/dist/enterprise/signing/kms.d.ts +211 -0
- package/dist/enterprise/signing/kms.d.ts.map +1 -0
- package/dist/enterprise/signing/kms.js +480 -0
- package/dist/enterprise/signing/kms.js.map +1 -0
- package/dist/enterprise/signing/kms.test.d.ts +5 -0
- package/dist/enterprise/signing/kms.test.d.ts.map +1 -0
- package/dist/enterprise/signing/kms.test.js +511 -0
- package/dist/enterprise/signing/kms.test.js.map +1 -0
- package/dist/eval/fixtures.d.ts +58 -0
- package/dist/eval/fixtures.d.ts.map +1 -0
- package/dist/eval/fixtures.js +571 -0
- package/dist/eval/fixtures.js.map +1 -0
- package/dist/eval/fixtures.test.d.ts +5 -0
- package/dist/eval/fixtures.test.d.ts.map +1 -0
- package/dist/eval/fixtures.test.js +193 -0
- package/dist/eval/fixtures.test.js.map +1 -0
- package/dist/eval/harness.d.ts +30 -0
- package/dist/eval/harness.d.ts.map +1 -0
- package/dist/eval/harness.js +221 -0
- package/dist/eval/harness.js.map +1 -0
- package/dist/eval/harness.test.d.ts +5 -0
- package/dist/eval/harness.test.d.ts.map +1 -0
- package/dist/eval/harness.test.js +314 -0
- package/dist/eval/harness.test.js.map +1 -0
- package/dist/eval/index.d.ts +15 -0
- package/dist/eval/index.d.ts.map +1 -0
- package/dist/eval/index.js +18 -0
- package/dist/eval/index.js.map +1 -0
- package/dist/eval/metrics.d.ts +56 -0
- package/dist/eval/metrics.d.ts.map +1 -0
- package/dist/eval/metrics.js +298 -0
- package/dist/eval/metrics.js.map +1 -0
- package/dist/eval/metrics.test.d.ts +5 -0
- package/dist/eval/metrics.test.d.ts.map +1 -0
- package/dist/eval/metrics.test.js +426 -0
- package/dist/eval/metrics.test.js.map +1 -0
- package/dist/eval/report.d.ts +30 -0
- package/dist/eval/report.d.ts.map +1 -0
- package/dist/eval/report.js +333 -0
- package/dist/eval/report.js.map +1 -0
- package/dist/eval/report.test.d.ts +5 -0
- package/dist/eval/report.test.d.ts.map +1 -0
- package/dist/eval/report.test.js +275 -0
- package/dist/eval/report.test.js.map +1 -0
- package/dist/eval/types.d.ts +234 -0
- package/dist/eval/types.d.ts.map +1 -0
- package/dist/eval/types.js +27 -0
- package/dist/eval/types.js.map +1 -0
- package/dist/http-server.d.ts +3 -0
- package/dist/http-server.d.ts.map +1 -0
- package/dist/http-server.js +127 -0
- package/dist/http-server.js.map +1 -0
- package/dist/index.d.ts +33 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +4120 -0
- package/dist/index.js.map +1 -0
- package/dist/logger.d.ts +46 -0
- package/dist/logger.d.ts.map +1 -0
- package/dist/logger.js +131 -0
- package/dist/logger.js.map +1 -0
- package/dist/multimodel/consensus.d.ts +49 -0
- package/dist/multimodel/consensus.d.ts.map +1 -0
- package/dist/multimodel/consensus.js +454 -0
- package/dist/multimodel/consensus.js.map +1 -0
- package/dist/multimodel/consensus.test.d.ts +5 -0
- package/dist/multimodel/consensus.test.d.ts.map +1 -0
- package/dist/multimodel/consensus.test.js +415 -0
- package/dist/multimodel/consensus.test.js.map +1 -0
- package/dist/multimodel/index.d.ts +13 -0
- package/dist/multimodel/index.d.ts.map +1 -0
- package/dist/multimodel/index.js +14 -0
- package/dist/multimodel/index.js.map +1 -0
- package/dist/multimodel/runner.d.ts +95 -0
- package/dist/multimodel/runner.d.ts.map +1 -0
- package/dist/multimodel/runner.js +312 -0
- package/dist/multimodel/runner.js.map +1 -0
- package/dist/multimodel/runner.test.d.ts +5 -0
- package/dist/multimodel/runner.test.d.ts.map +1 -0
- package/dist/multimodel/runner.test.js +224 -0
- package/dist/multimodel/runner.test.js.map +1 -0
- package/dist/multimodel/types.d.ts +202 -0
- package/dist/multimodel/types.d.ts.map +1 -0
- package/dist/multimodel/types.js +10 -0
- package/dist/multimodel/types.js.map +1 -0
- package/dist/observability/index.d.ts +9 -0
- package/dist/observability/index.d.ts.map +1 -0
- package/dist/observability/index.js +9 -0
- package/dist/observability/index.js.map +1 -0
- package/dist/observability/otel.d.ts +102 -0
- package/dist/observability/otel.d.ts.map +1 -0
- package/dist/observability/otel.js +284 -0
- package/dist/observability/otel.js.map +1 -0
- package/dist/plugins/index.d.ts +10 -0
- package/dist/plugins/index.d.ts.map +1 -0
- package/dist/plugins/index.js +10 -0
- package/dist/plugins/index.js.map +1 -0
- package/dist/plugins/loader.d.ts +78 -0
- package/dist/plugins/loader.d.ts.map +1 -0
- package/dist/plugins/loader.js +470 -0
- package/dist/plugins/loader.js.map +1 -0
- package/dist/plugins/types.d.ts +304 -0
- package/dist/plugins/types.d.ts.map +1 -0
- package/dist/plugins/types.js +100 -0
- package/dist/plugins/types.js.map +1 -0
- package/dist/sbom/cyclonedx.d.ts +30 -0
- package/dist/sbom/cyclonedx.d.ts.map +1 -0
- package/dist/sbom/cyclonedx.js +392 -0
- package/dist/sbom/cyclonedx.js.map +1 -0
- package/dist/sbom/cyclonedx.test.d.ts +5 -0
- package/dist/sbom/cyclonedx.test.d.ts.map +1 -0
- package/dist/sbom/cyclonedx.test.js +244 -0
- package/dist/sbom/cyclonedx.test.js.map +1 -0
- package/dist/sbom/index.d.ts +13 -0
- package/dist/sbom/index.d.ts.map +1 -0
- package/dist/sbom/index.js +15 -0
- package/dist/sbom/index.js.map +1 -0
- package/dist/sbom/provenance.d.ts +37 -0
- package/dist/sbom/provenance.d.ts.map +1 -0
- package/dist/sbom/provenance.js +268 -0
- package/dist/sbom/provenance.js.map +1 -0
- package/dist/sbom/provenance.test.d.ts +5 -0
- package/dist/sbom/provenance.test.d.ts.map +1 -0
- package/dist/sbom/provenance.test.js +189 -0
- package/dist/sbom/provenance.test.js.map +1 -0
- package/dist/sbom/signing.d.ts +87 -0
- package/dist/sbom/signing.d.ts.map +1 -0
- package/dist/sbom/signing.js +354 -0
- package/dist/sbom/signing.js.map +1 -0
- package/dist/sbom/signing.test.d.ts +5 -0
- package/dist/sbom/signing.test.d.ts.map +1 -0
- package/dist/sbom/signing.test.js +170 -0
- package/dist/sbom/signing.test.js.map +1 -0
- package/dist/sbom/types.d.ts +384 -0
- package/dist/sbom/types.d.ts.map +1 -0
- package/dist/sbom/types.js +17 -0
- package/dist/sbom/types.js.map +1 -0
- package/dist/scanners/agent/credential-scope-audit.d.ts +40 -0
- package/dist/scanners/agent/credential-scope-audit.d.ts.map +1 -0
- package/dist/scanners/agent/credential-scope-audit.js +404 -0
- package/dist/scanners/agent/credential-scope-audit.js.map +1 -0
- package/dist/scanners/agent/exfil-path-graph.d.ts +50 -0
- package/dist/scanners/agent/exfil-path-graph.d.ts.map +1 -0
- package/dist/scanners/agent/exfil-path-graph.js +764 -0
- package/dist/scanners/agent/exfil-path-graph.js.map +1 -0
- package/dist/scanners/agent/index.d.ts +43 -0
- package/dist/scanners/agent/index.d.ts.map +1 -0
- package/dist/scanners/agent/index.js +616 -0
- package/dist/scanners/agent/index.js.map +1 -0
- package/dist/scanners/agent/manifest-audit.d.ts +43 -0
- package/dist/scanners/agent/manifest-audit.d.ts.map +1 -0
- package/dist/scanners/agent/manifest-audit.js +403 -0
- package/dist/scanners/agent/manifest-audit.js.map +1 -0
- package/dist/scanners/agent/payloads/index.d.ts +44 -0
- package/dist/scanners/agent/payloads/index.d.ts.map +1 -0
- package/dist/scanners/agent/payloads/index.js +184 -0
- package/dist/scanners/agent/payloads/index.js.map +1 -0
- package/dist/scanners/agent/permission-minimiser.d.ts +48 -0
- package/dist/scanners/agent/permission-minimiser.d.ts.map +1 -0
- package/dist/scanners/agent/permission-minimiser.js +551 -0
- package/dist/scanners/agent/permission-minimiser.js.map +1 -0
- package/dist/scanners/agent/prompt-injection-fuzzer.d.ts +39 -0
- package/dist/scanners/agent/prompt-injection-fuzzer.d.ts.map +1 -0
- package/dist/scanners/agent/prompt-injection-fuzzer.js +720 -0
- package/dist/scanners/agent/prompt-injection-fuzzer.js.map +1 -0
- package/dist/scanners/agent/sandbox-audit.d.ts +44 -0
- package/dist/scanners/agent/sandbox-audit.d.ts.map +1 -0
- package/dist/scanners/agent/sandbox-audit.js +425 -0
- package/dist/scanners/agent/sandbox-audit.js.map +1 -0
- package/dist/scanners/agent/supply-chain-mcp.d.ts +53 -0
- package/dist/scanners/agent/supply-chain-mcp.d.ts.map +1 -0
- package/dist/scanners/agent/supply-chain-mcp.js +479 -0
- package/dist/scanners/agent/supply-chain-mcp.js.map +1 -0
- package/dist/scanners/agent/tool-description-drift.d.ts +62 -0
- package/dist/scanners/agent/tool-description-drift.d.ts.map +1 -0
- package/dist/scanners/agent/tool-description-drift.js +365 -0
- package/dist/scanners/agent/tool-description-drift.js.map +1 -0
- package/dist/scanners/agent/types.d.ts +840 -0
- package/dist/scanners/agent/types.d.ts.map +1 -0
- package/dist/scanners/agent/types.js +149 -0
- package/dist/scanners/agent/types.js.map +1 -0
- package/dist/scanners/bandit.d.ts +25 -0
- package/dist/scanners/bandit.d.ts.map +1 -0
- package/dist/scanners/bandit.js +129 -0
- package/dist/scanners/bandit.js.map +1 -0
- package/dist/scanners/binary-analysis.d.ts +41 -0
- package/dist/scanners/binary-analysis.d.ts.map +1 -0
- package/dist/scanners/binary-analysis.js +587 -0
- package/dist/scanners/binary-analysis.js.map +1 -0
- package/dist/scanners/binary-analysis.test.d.ts +5 -0
- package/dist/scanners/binary-analysis.test.d.ts.map +1 -0
- package/dist/scanners/binary-analysis.test.js +291 -0
- package/dist/scanners/binary-analysis.test.js.map +1 -0
- package/dist/scanners/brakeman.d.ts +30 -0
- package/dist/scanners/brakeman.d.ts.map +1 -0
- package/dist/scanners/brakeman.js +271 -0
- package/dist/scanners/brakeman.js.map +1 -0
- package/dist/scanners/dependencies.d.ts +22 -0
- package/dist/scanners/dependencies.d.ts.map +1 -0
- package/dist/scanners/dependencies.js +202 -0
- package/dist/scanners/dependencies.js.map +1 -0
- package/dist/scanners/dependencies.test.d.ts +5 -0
- package/dist/scanners/dependencies.test.d.ts.map +1 -0
- package/dist/scanners/dependencies.test.js +185 -0
- package/dist/scanners/dependencies.test.js.map +1 -0
- package/dist/scanners/eslint.d.ts +25 -0
- package/dist/scanners/eslint.d.ts.map +1 -0
- package/dist/scanners/eslint.js +220 -0
- package/dist/scanners/eslint.js.map +1 -0
- package/dist/scanners/gosec.d.ts +25 -0
- package/dist/scanners/gosec.d.ts.map +1 -0
- package/dist/scanners/gosec.js +128 -0
- package/dist/scanners/gosec.js.map +1 -0
- package/dist/scanners/index.d.ts +128 -0
- package/dist/scanners/index.d.ts.map +1 -0
- package/dist/scanners/index.js +811 -0
- package/dist/scanners/index.js.map +1 -0
- package/dist/scanners/index.test.d.ts +5 -0
- package/dist/scanners/index.test.d.ts.map +1 -0
- package/dist/scanners/index.test.js +424 -0
- package/dist/scanners/index.test.js.map +1 -0
- package/dist/scanners/memory-safety.d.ts +44 -0
- package/dist/scanners/memory-safety.d.ts.map +1 -0
- package/dist/scanners/memory-safety.js +571 -0
- package/dist/scanners/memory-safety.js.map +1 -0
- package/dist/scanners/memory-safety.test.d.ts +5 -0
- package/dist/scanners/memory-safety.test.d.ts.map +1 -0
- package/dist/scanners/memory-safety.test.js +321 -0
- package/dist/scanners/memory-safety.test.js.map +1 -0
- package/dist/scanners/race-condition.d.ts +25 -0
- package/dist/scanners/race-condition.d.ts.map +1 -0
- package/dist/scanners/race-condition.js +443 -0
- package/dist/scanners/race-condition.js.map +1 -0
- package/dist/scanners/race-condition.test.d.ts +5 -0
- package/dist/scanners/race-condition.test.d.ts.map +1 -0
- package/dist/scanners/race-condition.test.js +428 -0
- package/dist/scanners/race-condition.test.js.map +1 -0
- package/dist/scanners/secrets.d.ts +25 -0
- package/dist/scanners/secrets.d.ts.map +1 -0
- package/dist/scanners/secrets.js +367 -0
- package/dist/scanners/secrets.js.map +1 -0
- package/dist/scanners/secrets.test.d.ts +5 -0
- package/dist/scanners/secrets.test.d.ts.map +1 -0
- package/dist/scanners/secrets.test.js +160 -0
- package/dist/scanners/secrets.test.js.map +1 -0
- package/dist/scanners/semgrep.d.ts +33 -0
- package/dist/scanners/semgrep.d.ts.map +1 -0
- package/dist/scanners/semgrep.js +350 -0
- package/dist/scanners/semgrep.js.map +1 -0
- package/dist/scanners/semgrep.test.d.ts +8 -0
- package/dist/scanners/semgrep.test.d.ts.map +1 -0
- package/dist/scanners/semgrep.test.js +254 -0
- package/dist/scanners/semgrep.test.js.map +1 -0
- package/dist/scanners/trivy.d.ts +26 -0
- package/dist/scanners/trivy.d.ts.map +1 -0
- package/dist/scanners/trivy.js +187 -0
- package/dist/scanners/trivy.js.map +1 -0
- package/dist/scanners/types.d.ts +210 -0
- package/dist/scanners/types.d.ts.map +1 -0
- package/dist/scanners/types.js +106 -0
- package/dist/scanners/types.js.map +1 -0
- package/dist/scanners/types.test.d.ts +5 -0
- package/dist/scanners/types.test.d.ts.map +1 -0
- package/dist/scanners/types.test.js +103 -0
- package/dist/scanners/types.test.js.map +1 -0
- package/dist/scanners/typescript.d.ts +32 -0
- package/dist/scanners/typescript.d.ts.map +1 -0
- package/dist/scanners/typescript.js +300 -0
- package/dist/scanners/typescript.js.map +1 -0
- package/dist/scanners/typescript.test.d.ts +5 -0
- package/dist/scanners/typescript.test.d.ts.map +1 -0
- package/dist/scanners/typescript.test.js +296 -0
- package/dist/scanners/typescript.test.js.map +1 -0
- package/dist/transcripts/index.d.ts +13 -0
- package/dist/transcripts/index.d.ts.map +1 -0
- package/dist/transcripts/index.js +17 -0
- package/dist/transcripts/index.js.map +1 -0
- package/dist/transcripts/logger.d.ts +190 -0
- package/dist/transcripts/logger.d.ts.map +1 -0
- package/dist/transcripts/logger.js +385 -0
- package/dist/transcripts/logger.js.map +1 -0
- package/dist/transcripts/logger.test.d.ts +5 -0
- package/dist/transcripts/logger.test.d.ts.map +1 -0
- package/dist/transcripts/logger.test.js +227 -0
- package/dist/transcripts/logger.test.js.map +1 -0
- package/dist/transcripts/redaction.d.ts +125 -0
- package/dist/transcripts/redaction.d.ts.map +1 -0
- package/dist/transcripts/redaction.js +416 -0
- package/dist/transcripts/redaction.js.map +1 -0
- package/dist/transcripts/redaction.test.d.ts +5 -0
- package/dist/transcripts/redaction.test.d.ts.map +1 -0
- package/dist/transcripts/redaction.test.js +267 -0
- package/dist/transcripts/redaction.test.js.map +1 -0
- package/dist/transcripts/signing.d.ts +108 -0
- package/dist/transcripts/signing.d.ts.map +1 -0
- package/dist/transcripts/signing.js +173 -0
- package/dist/transcripts/signing.js.map +1 -0
- package/dist/transcripts/verifier.d.ts +133 -0
- package/dist/transcripts/verifier.d.ts.map +1 -0
- package/dist/transcripts/verifier.js +489 -0
- package/dist/transcripts/verifier.js.map +1 -0
- package/dist/transcripts/verifier.test.d.ts +5 -0
- package/dist/transcripts/verifier.test.d.ts.map +1 -0
- package/dist/transcripts/verifier.test.js +330 -0
- package/dist/transcripts/verifier.test.js.map +1 -0
- package/dist/util/concurrency.d.ts +221 -0
- package/dist/util/concurrency.d.ts.map +1 -0
- package/dist/util/concurrency.js +339 -0
- package/dist/util/concurrency.js.map +1 -0
- package/dist/util/index.d.ts +12 -0
- package/dist/util/index.d.ts.map +1 -0
- package/dist/util/index.js +12 -0
- package/dist/util/index.js.map +1 -0
- package/dist/util/json.d.ts +63 -0
- package/dist/util/json.d.ts.map +1 -0
- package/dist/util/json.js +134 -0
- package/dist/util/json.js.map +1 -0
- package/dist/util/paths.d.ts +56 -0
- package/dist/util/paths.d.ts.map +1 -0
- package/dist/util/paths.js +128 -0
- package/dist/util/paths.js.map +1 -0
- package/dist/util/retry.d.ts +185 -0
- package/dist/util/retry.d.ts.map +1 -0
- package/dist/util/retry.js +338 -0
- package/dist/util/retry.js.map +1 -0
- package/package.json +79 -0
|
@@ -0,0 +1,764 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Exfiltration Path Graph Scanner
|
|
3
|
+
*
|
|
4
|
+
* Builds a directed graph of MCP tools based on their capabilities,
|
|
5
|
+
* then finds potential data exfiltration paths from secret sources
|
|
6
|
+
* (tools that read sensitive data) to network sinks (tools that can
|
|
7
|
+
* send data externally).
|
|
8
|
+
*
|
|
9
|
+
* Key features:
|
|
10
|
+
* - Tool capability classification (reads_secrets, network_access, etc.)
|
|
11
|
+
* - Path finding from sources to sinks
|
|
12
|
+
* - Minimal cut-set computation (tools to sandbox)
|
|
13
|
+
* - Mermaid diagram generation for visualization
|
|
14
|
+
*
|
|
15
|
+
* @module scanners/agent/exfil-path-graph
|
|
16
|
+
*/
|
|
17
|
+
import { createHash } from "crypto";
|
|
18
|
+
// ============================================================================
|
|
19
|
+
// Tool Classification Patterns
|
|
20
|
+
// ============================================================================
|
|
21
|
+
/**
|
|
22
|
+
* Patterns indicating a tool reads secrets/credentials
|
|
23
|
+
*/
|
|
24
|
+
const READS_SECRETS_PATTERNS = [
|
|
25
|
+
/secret/i,
|
|
26
|
+
/credential/i,
|
|
27
|
+
/password/i,
|
|
28
|
+
/api[_\s-]?key/i,
|
|
29
|
+
/token/i,
|
|
30
|
+
/auth/i,
|
|
31
|
+
/private[_\s-]?key/i,
|
|
32
|
+
/access[_\s-]?key/i,
|
|
33
|
+
/env(ironment)?/i,
|
|
34
|
+
/config(uration)?/i,
|
|
35
|
+
/\.env/i,
|
|
36
|
+
/keychain/i,
|
|
37
|
+
/vault/i,
|
|
38
|
+
/1password/i,
|
|
39
|
+
/lastpass/i,
|
|
40
|
+
/bitwarden/i,
|
|
41
|
+
];
|
|
42
|
+
/**
|
|
43
|
+
* Patterns indicating a tool reads files
|
|
44
|
+
*/
|
|
45
|
+
const READS_FILES_PATTERNS = [
|
|
46
|
+
/read[_\s-]?file/i,
|
|
47
|
+
/get[_\s-]?file/i,
|
|
48
|
+
/load[_\s-]?file/i,
|
|
49
|
+
/open[_\s-]?file/i,
|
|
50
|
+
/file[_\s-]?content/i,
|
|
51
|
+
/cat\s/i,
|
|
52
|
+
/less\s/i,
|
|
53
|
+
/head\s/i,
|
|
54
|
+
/tail\s/i,
|
|
55
|
+
/grep/i,
|
|
56
|
+
/search[_\s-]?file/i,
|
|
57
|
+
/glob/i,
|
|
58
|
+
/directory/i,
|
|
59
|
+
/folder/i,
|
|
60
|
+
/path/i,
|
|
61
|
+
/fs\./i,
|
|
62
|
+
/filesystem/i,
|
|
63
|
+
];
|
|
64
|
+
/**
|
|
65
|
+
* Patterns indicating a tool reads environment variables
|
|
66
|
+
*/
|
|
67
|
+
const READS_ENV_PATTERNS = [
|
|
68
|
+
/env(ironment)?/i,
|
|
69
|
+
/process\.env/i,
|
|
70
|
+
/getenv/i,
|
|
71
|
+
/environ/i,
|
|
72
|
+
/variable/i,
|
|
73
|
+
/dotenv/i,
|
|
74
|
+
];
|
|
75
|
+
/**
|
|
76
|
+
* Patterns indicating a tool reads from database
|
|
77
|
+
*/
|
|
78
|
+
const READS_DATABASE_PATTERNS = [
|
|
79
|
+
/database/i,
|
|
80
|
+
/db/i,
|
|
81
|
+
/sql/i,
|
|
82
|
+
/query/i,
|
|
83
|
+
/select/i,
|
|
84
|
+
/table/i,
|
|
85
|
+
/postgres/i,
|
|
86
|
+
/mysql/i,
|
|
87
|
+
/mongo/i,
|
|
88
|
+
/redis/i,
|
|
89
|
+
/supabase/i,
|
|
90
|
+
/prisma/i,
|
|
91
|
+
/drizzle/i,
|
|
92
|
+
];
|
|
93
|
+
/**
|
|
94
|
+
* Patterns indicating a tool has network access
|
|
95
|
+
*/
|
|
96
|
+
const NETWORK_ACCESS_PATTERNS = [
|
|
97
|
+
/http/i,
|
|
98
|
+
/https/i,
|
|
99
|
+
/url/i,
|
|
100
|
+
/fetch/i,
|
|
101
|
+
/request/i,
|
|
102
|
+
/api/i,
|
|
103
|
+
/webhook/i,
|
|
104
|
+
/socket/i,
|
|
105
|
+
/connect/i,
|
|
106
|
+
/download/i,
|
|
107
|
+
/upload/i,
|
|
108
|
+
/stream/i,
|
|
109
|
+
/remote/i,
|
|
110
|
+
/external/i,
|
|
111
|
+
/endpoint/i,
|
|
112
|
+
/curl/i,
|
|
113
|
+
/axios/i,
|
|
114
|
+
/got\s/i,
|
|
115
|
+
/node-fetch/i,
|
|
116
|
+
];
|
|
117
|
+
/**
|
|
118
|
+
* Patterns indicating a tool sends email
|
|
119
|
+
*/
|
|
120
|
+
const SENDS_EMAIL_PATTERNS = [
|
|
121
|
+
/email/i,
|
|
122
|
+
/mail/i,
|
|
123
|
+
/smtp/i,
|
|
124
|
+
/sendgrid/i,
|
|
125
|
+
/mailgun/i,
|
|
126
|
+
/postmark/i,
|
|
127
|
+
/ses\s/i,
|
|
128
|
+
/newsletter/i,
|
|
129
|
+
];
|
|
130
|
+
/**
|
|
131
|
+
* Patterns indicating a tool sends to webhooks
|
|
132
|
+
*/
|
|
133
|
+
const SENDS_WEBHOOK_PATTERNS = [
|
|
134
|
+
/webhook/i,
|
|
135
|
+
/callback/i,
|
|
136
|
+
/notify/i,
|
|
137
|
+
/slack/i,
|
|
138
|
+
/discord/i,
|
|
139
|
+
/teams/i,
|
|
140
|
+
/trigger/i,
|
|
141
|
+
/zapier/i,
|
|
142
|
+
/ifttt/i,
|
|
143
|
+
];
|
|
144
|
+
/**
|
|
145
|
+
* Patterns indicating a tool executes code
|
|
146
|
+
*/
|
|
147
|
+
const EXECUTES_CODE_PATTERNS = [
|
|
148
|
+
/exec/i,
|
|
149
|
+
/execute/i,
|
|
150
|
+
/run/i,
|
|
151
|
+
/eval/i,
|
|
152
|
+
/shell/i,
|
|
153
|
+
/bash/i,
|
|
154
|
+
/command/i,
|
|
155
|
+
/script/i,
|
|
156
|
+
/spawn/i,
|
|
157
|
+
/process/i,
|
|
158
|
+
/terminal/i,
|
|
159
|
+
/repl/i,
|
|
160
|
+
/interpret/i,
|
|
161
|
+
/compile/i,
|
|
162
|
+
];
|
|
163
|
+
/**
|
|
164
|
+
* Patterns indicating a tool writes files
|
|
165
|
+
*/
|
|
166
|
+
const WRITES_FILES_PATTERNS = [
|
|
167
|
+
/write[_\s-]?file/i,
|
|
168
|
+
/save[_\s-]?file/i,
|
|
169
|
+
/create[_\s-]?file/i,
|
|
170
|
+
/update[_\s-]?file/i,
|
|
171
|
+
/edit[_\s-]?file/i,
|
|
172
|
+
/modify[_\s-]?file/i,
|
|
173
|
+
/append/i,
|
|
174
|
+
/overwrite/i,
|
|
175
|
+
/delete[_\s-]?file/i,
|
|
176
|
+
/remove[_\s-]?file/i,
|
|
177
|
+
];
|
|
178
|
+
/**
|
|
179
|
+
* Patterns indicating a tool writes to database
|
|
180
|
+
*/
|
|
181
|
+
const WRITES_DATABASE_PATTERNS = [
|
|
182
|
+
/insert/i,
|
|
183
|
+
/update/i,
|
|
184
|
+
/delete/i,
|
|
185
|
+
/upsert/i,
|
|
186
|
+
/create.*record/i,
|
|
187
|
+
/modify.*record/i,
|
|
188
|
+
/write.*db/i,
|
|
189
|
+
/write.*database/i,
|
|
190
|
+
];
|
|
191
|
+
// ============================================================================
|
|
192
|
+
// Tool Classification Functions
|
|
193
|
+
// ============================================================================
|
|
194
|
+
/**
|
|
195
|
+
* Classify a tool's capabilities based on name and description
|
|
196
|
+
*/
|
|
197
|
+
function classifyTool(tool) {
|
|
198
|
+
const capabilities = [];
|
|
199
|
+
const text = `${tool.name} ${tool.description || ""}`.toLowerCase();
|
|
200
|
+
// Check each capability type
|
|
201
|
+
if (READS_SECRETS_PATTERNS.some((p) => p.test(text))) {
|
|
202
|
+
capabilities.push("reads_secrets");
|
|
203
|
+
}
|
|
204
|
+
if (READS_FILES_PATTERNS.some((p) => p.test(text))) {
|
|
205
|
+
capabilities.push("reads_files");
|
|
206
|
+
}
|
|
207
|
+
if (READS_ENV_PATTERNS.some((p) => p.test(text))) {
|
|
208
|
+
capabilities.push("reads_env");
|
|
209
|
+
}
|
|
210
|
+
if (READS_DATABASE_PATTERNS.some((p) => p.test(text))) {
|
|
211
|
+
capabilities.push("reads_database");
|
|
212
|
+
}
|
|
213
|
+
if (WRITES_FILES_PATTERNS.some((p) => p.test(text))) {
|
|
214
|
+
capabilities.push("writes_files");
|
|
215
|
+
}
|
|
216
|
+
if (WRITES_DATABASE_PATTERNS.some((p) => p.test(text))) {
|
|
217
|
+
capabilities.push("writes_database");
|
|
218
|
+
}
|
|
219
|
+
if (NETWORK_ACCESS_PATTERNS.some((p) => p.test(text)) || tool.networkAccess) {
|
|
220
|
+
capabilities.push("network_access");
|
|
221
|
+
}
|
|
222
|
+
if (EXECUTES_CODE_PATTERNS.some((p) => p.test(text)) || tool.codeExecution) {
|
|
223
|
+
capabilities.push("executes_code");
|
|
224
|
+
}
|
|
225
|
+
if (tool.destructiveHint) {
|
|
226
|
+
capabilities.push("modifies_state");
|
|
227
|
+
}
|
|
228
|
+
if (SENDS_EMAIL_PATTERNS.some((p) => p.test(text))) {
|
|
229
|
+
capabilities.push("sends_email");
|
|
230
|
+
}
|
|
231
|
+
if (SENDS_WEBHOOK_PATTERNS.some((p) => p.test(text))) {
|
|
232
|
+
capabilities.push("sends_webhook");
|
|
233
|
+
}
|
|
234
|
+
if (NETWORK_ACCESS_PATTERNS.some((p) => p.test(text)) && !capabilities.includes("network_access")) {
|
|
235
|
+
capabilities.push("accesses_external_api");
|
|
236
|
+
}
|
|
237
|
+
return capabilities;
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* Calculate risk score for a tool based on capabilities
|
|
241
|
+
*/
|
|
242
|
+
function calculateToolRiskScore(capabilities) {
|
|
243
|
+
const riskWeights = {
|
|
244
|
+
reads_secrets: 30,
|
|
245
|
+
reads_files: 15,
|
|
246
|
+
reads_env: 25,
|
|
247
|
+
reads_database: 20,
|
|
248
|
+
writes_files: 20,
|
|
249
|
+
writes_database: 25,
|
|
250
|
+
network_access: 35,
|
|
251
|
+
executes_code: 40,
|
|
252
|
+
modifies_state: 15,
|
|
253
|
+
sends_email: 25,
|
|
254
|
+
sends_webhook: 30,
|
|
255
|
+
accesses_external_api: 25,
|
|
256
|
+
};
|
|
257
|
+
let score = 0;
|
|
258
|
+
for (const cap of capabilities) {
|
|
259
|
+
score += riskWeights[cap] || 0;
|
|
260
|
+
}
|
|
261
|
+
return Math.min(100, score);
|
|
262
|
+
}
|
|
263
|
+
/**
|
|
264
|
+
* Check if a tool is a potential secret source
|
|
265
|
+
*/
|
|
266
|
+
function isSecretSource(capabilities) {
|
|
267
|
+
const secretSourceCaps = [
|
|
268
|
+
"reads_secrets",
|
|
269
|
+
"reads_env",
|
|
270
|
+
"reads_files",
|
|
271
|
+
"reads_database",
|
|
272
|
+
"executes_code", // Can access anything
|
|
273
|
+
];
|
|
274
|
+
return capabilities.some((c) => secretSourceCaps.includes(c));
|
|
275
|
+
}
|
|
276
|
+
/**
|
|
277
|
+
* Check if a tool is a potential network sink
|
|
278
|
+
*/
|
|
279
|
+
function isNetworkSink(capabilities) {
|
|
280
|
+
const networkCaps = [
|
|
281
|
+
"network_access",
|
|
282
|
+
"sends_email",
|
|
283
|
+
"sends_webhook",
|
|
284
|
+
"accesses_external_api",
|
|
285
|
+
"executes_code", // Can make network calls
|
|
286
|
+
];
|
|
287
|
+
return capabilities.some((c) => networkCaps.includes(c));
|
|
288
|
+
}
|
|
289
|
+
// ============================================================================
|
|
290
|
+
// Graph Building
|
|
291
|
+
// ============================================================================
|
|
292
|
+
/**
|
|
293
|
+
* Build tool nodes from manifest
|
|
294
|
+
*/
|
|
295
|
+
function buildNodes(manifest) {
|
|
296
|
+
const nodes = new Map();
|
|
297
|
+
for (const tool of manifest.tools) {
|
|
298
|
+
const capabilities = classifyTool(tool);
|
|
299
|
+
const riskScore = calculateToolRiskScore(capabilities);
|
|
300
|
+
nodes.set(tool.name, {
|
|
301
|
+
name: tool.name,
|
|
302
|
+
description: tool.description,
|
|
303
|
+
capabilities,
|
|
304
|
+
riskScore,
|
|
305
|
+
isSecretSource: isSecretSource(capabilities),
|
|
306
|
+
isNetworkSink: isNetworkSink(capabilities),
|
|
307
|
+
});
|
|
308
|
+
}
|
|
309
|
+
return nodes;
|
|
310
|
+
}
|
|
311
|
+
/**
|
|
312
|
+
* Build edges representing potential data flows
|
|
313
|
+
*
|
|
314
|
+
* In MCP, tools can be chained by the AI agent, so we model
|
|
315
|
+
* potential data flows between any source and any sink.
|
|
316
|
+
*/
|
|
317
|
+
function buildEdges(nodes) {
|
|
318
|
+
const edges = [];
|
|
319
|
+
const nodeArray = Array.from(nodes.values());
|
|
320
|
+
// Create implicit edges from sources to sinks
|
|
321
|
+
// (data can flow through AI orchestration)
|
|
322
|
+
for (const source of nodeArray) {
|
|
323
|
+
if (!source.isSecretSource)
|
|
324
|
+
continue;
|
|
325
|
+
for (const target of nodeArray) {
|
|
326
|
+
if (source.name === target.name)
|
|
327
|
+
continue;
|
|
328
|
+
if (!target.isNetworkSink)
|
|
329
|
+
continue;
|
|
330
|
+
edges.push({
|
|
331
|
+
source: source.name,
|
|
332
|
+
target: target.name,
|
|
333
|
+
dataFlow: "implicit",
|
|
334
|
+
description: `Data can flow from ${source.name} to ${target.name} via AI orchestration`,
|
|
335
|
+
});
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
// Add chained edges for code execution tools
|
|
339
|
+
// (they can invoke any other tool)
|
|
340
|
+
for (const tool of nodeArray) {
|
|
341
|
+
if (tool.capabilities.includes("executes_code")) {
|
|
342
|
+
for (const other of nodeArray) {
|
|
343
|
+
if (tool.name === other.name)
|
|
344
|
+
continue;
|
|
345
|
+
// Execution tools can read from anything
|
|
346
|
+
if (other.isSecretSource && !tool.isSecretSource) {
|
|
347
|
+
edges.push({
|
|
348
|
+
source: other.name,
|
|
349
|
+
target: tool.name,
|
|
350
|
+
dataFlow: "chained",
|
|
351
|
+
description: `${tool.name} can execute code that reads from ${other.name}`,
|
|
352
|
+
});
|
|
353
|
+
}
|
|
354
|
+
// Execution tools can write to anything
|
|
355
|
+
if (other.isNetworkSink && !tool.isNetworkSink) {
|
|
356
|
+
edges.push({
|
|
357
|
+
source: tool.name,
|
|
358
|
+
target: other.name,
|
|
359
|
+
dataFlow: "chained",
|
|
360
|
+
description: `${tool.name} can execute code that sends data via ${other.name}`,
|
|
361
|
+
});
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
return edges;
|
|
367
|
+
}
|
|
368
|
+
// ============================================================================
|
|
369
|
+
// Path Finding
|
|
370
|
+
// ============================================================================
|
|
371
|
+
/**
|
|
372
|
+
* Find all exfiltration paths from sources to sinks
|
|
373
|
+
*/
|
|
374
|
+
function findExfilPaths(nodes, edges) {
|
|
375
|
+
const paths = [];
|
|
376
|
+
// Build adjacency list
|
|
377
|
+
const adjacency = new Map();
|
|
378
|
+
for (const edge of edges) {
|
|
379
|
+
if (!adjacency.has(edge.source)) {
|
|
380
|
+
adjacency.set(edge.source, []);
|
|
381
|
+
}
|
|
382
|
+
adjacency.get(edge.source).push(edge.target);
|
|
383
|
+
}
|
|
384
|
+
// Find all sources and sinks
|
|
385
|
+
const sources = Array.from(nodes.values()).filter((n) => n.isSecretSource);
|
|
386
|
+
const sinks = Array.from(nodes.values()).filter((n) => n.isNetworkSink);
|
|
387
|
+
// BFS to find paths from each source to each sink
|
|
388
|
+
for (const source of sources) {
|
|
389
|
+
for (const sink of sinks) {
|
|
390
|
+
if (source.name === sink.name) {
|
|
391
|
+
// Direct exfil - tool both reads secrets AND has network access
|
|
392
|
+
paths.push({
|
|
393
|
+
source: source.name,
|
|
394
|
+
sink: sink.name,
|
|
395
|
+
path: [],
|
|
396
|
+
fullPath: [source.name],
|
|
397
|
+
riskLevel: "critical",
|
|
398
|
+
description: `Tool "${source.name}" can both read sensitive data and send it externally`,
|
|
399
|
+
mitigations: [
|
|
400
|
+
"Split into separate tools for reading and sending",
|
|
401
|
+
"Add explicit approval step before network operations",
|
|
402
|
+
"Implement data loss prevention (DLP) checks",
|
|
403
|
+
],
|
|
404
|
+
});
|
|
405
|
+
continue;
|
|
406
|
+
}
|
|
407
|
+
// Find path using BFS
|
|
408
|
+
const pathFound = bfsPath(source.name, sink.name, adjacency);
|
|
409
|
+
if (pathFound) {
|
|
410
|
+
const riskLevel = calculatePathRisk(pathFound, nodes);
|
|
411
|
+
paths.push({
|
|
412
|
+
source: source.name,
|
|
413
|
+
sink: sink.name,
|
|
414
|
+
path: pathFound.slice(1, -1),
|
|
415
|
+
fullPath: pathFound,
|
|
416
|
+
riskLevel,
|
|
417
|
+
description: `Data can flow from "${source.name}" to "${sink.name}" via ${pathFound.length === 2 ? "direct connection" : `${pathFound.length - 2} intermediate tool(s)`}`,
|
|
418
|
+
mitigations: getMitigations(pathFound, nodes),
|
|
419
|
+
});
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
return paths;
|
|
424
|
+
}
|
|
425
|
+
/**
|
|
426
|
+
* BFS to find shortest path between two nodes
|
|
427
|
+
*/
|
|
428
|
+
function bfsPath(start, end, adjacency) {
|
|
429
|
+
const visited = new Set();
|
|
430
|
+
const queue = [
|
|
431
|
+
{ node: start, path: [start] },
|
|
432
|
+
];
|
|
433
|
+
while (queue.length > 0) {
|
|
434
|
+
const { node, path } = queue.shift();
|
|
435
|
+
if (node === end) {
|
|
436
|
+
return path;
|
|
437
|
+
}
|
|
438
|
+
if (visited.has(node))
|
|
439
|
+
continue;
|
|
440
|
+
visited.add(node);
|
|
441
|
+
const neighbors = adjacency.get(node) || [];
|
|
442
|
+
for (const neighbor of neighbors) {
|
|
443
|
+
if (!visited.has(neighbor)) {
|
|
444
|
+
queue.push({ node: neighbor, path: [...path, neighbor] });
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
return null;
|
|
449
|
+
}
|
|
450
|
+
/**
|
|
451
|
+
* Calculate risk level for a path
|
|
452
|
+
*/
|
|
453
|
+
function calculatePathRisk(path, nodes) {
|
|
454
|
+
if (path.length === 1) {
|
|
455
|
+
return "critical"; // Single tool with both capabilities
|
|
456
|
+
}
|
|
457
|
+
let maxRisk = 0;
|
|
458
|
+
for (const nodeName of path) {
|
|
459
|
+
const node = nodes.get(nodeName);
|
|
460
|
+
if (node) {
|
|
461
|
+
maxRisk = Math.max(maxRisk, node.riskScore);
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
if (maxRisk >= 60)
|
|
465
|
+
return "critical";
|
|
466
|
+
if (maxRisk >= 40)
|
|
467
|
+
return "high";
|
|
468
|
+
if (maxRisk >= 20)
|
|
469
|
+
return "medium";
|
|
470
|
+
return "low";
|
|
471
|
+
}
|
|
472
|
+
/**
|
|
473
|
+
* Generate mitigations for a path
|
|
474
|
+
*/
|
|
475
|
+
function getMitigations(path, nodes) {
|
|
476
|
+
const mitigations = [];
|
|
477
|
+
if (path.length === 2) {
|
|
478
|
+
mitigations.push("Add intermediate approval step before network operations");
|
|
479
|
+
mitigations.push("Implement rate limiting on data transfer");
|
|
480
|
+
}
|
|
481
|
+
for (const nodeName of path) {
|
|
482
|
+
const node = nodes.get(nodeName);
|
|
483
|
+
if (node?.capabilities.includes("executes_code")) {
|
|
484
|
+
mitigations.push(`Sandbox code execution in "${nodeName}" with restricted network access`);
|
|
485
|
+
}
|
|
486
|
+
if (node?.capabilities.includes("reads_secrets")) {
|
|
487
|
+
mitigations.push(`Restrict "${nodeName}" to only necessary secrets using RBAC`);
|
|
488
|
+
}
|
|
489
|
+
if (node?.capabilities.includes("network_access")) {
|
|
490
|
+
mitigations.push(`Add allowlist for "${nodeName}" network destinations`);
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
// Add generic mitigations
|
|
494
|
+
mitigations.push("Enable comprehensive audit logging");
|
|
495
|
+
mitigations.push("Implement data classification and DLP policies");
|
|
496
|
+
// Deduplicate
|
|
497
|
+
return [...new Set(mitigations)];
|
|
498
|
+
}
|
|
499
|
+
// ============================================================================
|
|
500
|
+
// Cut Set Computation
|
|
501
|
+
// ============================================================================
|
|
502
|
+
/**
|
|
503
|
+
* Find minimal cut set to break all exfiltration paths
|
|
504
|
+
*
|
|
505
|
+
* Uses a greedy approximation: repeatedly select the node that
|
|
506
|
+
* appears in the most paths until all paths are cut.
|
|
507
|
+
*/
|
|
508
|
+
function findMinimalCutSet(paths, nodes) {
|
|
509
|
+
if (paths.length === 0)
|
|
510
|
+
return [];
|
|
511
|
+
const cutSet = [];
|
|
512
|
+
const remainingPaths = [...paths];
|
|
513
|
+
while (remainingPaths.length > 0) {
|
|
514
|
+
// Count node occurrences across all remaining paths
|
|
515
|
+
const nodeCounts = new Map();
|
|
516
|
+
for (const path of remainingPaths) {
|
|
517
|
+
for (const node of path.fullPath) {
|
|
518
|
+
nodeCounts.set(node, (nodeCounts.get(node) || 0) + 1);
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
// Find node with highest count
|
|
522
|
+
let maxNode = "";
|
|
523
|
+
let maxCount = 0;
|
|
524
|
+
for (const [node, count] of nodeCounts) {
|
|
525
|
+
// Weight by risk score for tie-breaking
|
|
526
|
+
const nodeData = nodes.get(node);
|
|
527
|
+
const weightedCount = count + (nodeData ? nodeData.riskScore / 100 : 0);
|
|
528
|
+
if (weightedCount > maxCount) {
|
|
529
|
+
maxCount = weightedCount;
|
|
530
|
+
maxNode = node;
|
|
531
|
+
}
|
|
532
|
+
}
|
|
533
|
+
if (!maxNode)
|
|
534
|
+
break;
|
|
535
|
+
// Add to cut set
|
|
536
|
+
cutSet.push(maxNode);
|
|
537
|
+
// Remove paths containing this node
|
|
538
|
+
for (let i = remainingPaths.length - 1; i >= 0; i--) {
|
|
539
|
+
if (remainingPaths[i].fullPath.includes(maxNode)) {
|
|
540
|
+
remainingPaths.splice(i, 1);
|
|
541
|
+
}
|
|
542
|
+
}
|
|
543
|
+
}
|
|
544
|
+
return cutSet;
|
|
545
|
+
}
|
|
546
|
+
// ============================================================================
|
|
547
|
+
// Mermaid Diagram Generation
|
|
548
|
+
// ============================================================================
|
|
549
|
+
/**
|
|
550
|
+
* Generate Mermaid diagram of the tool graph
|
|
551
|
+
*/
|
|
552
|
+
function generateMermaidDiagram(graph) {
|
|
553
|
+
const lines = ["graph LR"];
|
|
554
|
+
// Add styling
|
|
555
|
+
lines.push(" classDef source fill:#ff6b6b,stroke:#333,color:#fff");
|
|
556
|
+
lines.push(" classDef sink fill:#4ecdc4,stroke:#333,color:#fff");
|
|
557
|
+
lines.push(" classDef both fill:#ffe66d,stroke:#333,color:#000");
|
|
558
|
+
lines.push(" classDef normal fill:#95e1d3,stroke:#333");
|
|
559
|
+
lines.push(" classDef cutset fill:#ff9999,stroke:#f00,stroke-width:3px");
|
|
560
|
+
// Add nodes
|
|
561
|
+
for (const [name, node] of graph.nodes) {
|
|
562
|
+
const sanitized = name.replace(/[^a-zA-Z0-9]/g, "_");
|
|
563
|
+
const label = name.length > 20 ? name.slice(0, 17) + "..." : name;
|
|
564
|
+
if (node.isSecretSource && node.isNetworkSink) {
|
|
565
|
+
lines.push(` ${sanitized}["${label}"]:::both`);
|
|
566
|
+
}
|
|
567
|
+
else if (node.isSecretSource) {
|
|
568
|
+
lines.push(` ${sanitized}["${label}"]:::source`);
|
|
569
|
+
}
|
|
570
|
+
else if (node.isNetworkSink) {
|
|
571
|
+
lines.push(` ${sanitized}["${label}"]:::sink`);
|
|
572
|
+
}
|
|
573
|
+
else {
|
|
574
|
+
lines.push(` ${sanitized}["${label}"]:::normal`);
|
|
575
|
+
}
|
|
576
|
+
}
|
|
577
|
+
// Add edges for exfil paths only (to avoid clutter)
|
|
578
|
+
const addedEdges = new Set();
|
|
579
|
+
for (const path of graph.exfilPaths) {
|
|
580
|
+
for (let i = 0; i < path.fullPath.length - 1; i++) {
|
|
581
|
+
const from = path.fullPath[i].replace(/[^a-zA-Z0-9]/g, "_");
|
|
582
|
+
const to = path.fullPath[i + 1].replace(/[^a-zA-Z0-9]/g, "_");
|
|
583
|
+
const edgeKey = `${from}-${to}`;
|
|
584
|
+
if (!addedEdges.has(edgeKey)) {
|
|
585
|
+
addedEdges.add(edgeKey);
|
|
586
|
+
const style = path.riskLevel === "critical" ? "==>" : "-->";
|
|
587
|
+
lines.push(` ${from} ${style} ${to}`);
|
|
588
|
+
}
|
|
589
|
+
}
|
|
590
|
+
}
|
|
591
|
+
// Mark cut set nodes
|
|
592
|
+
for (const node of graph.cutSet) {
|
|
593
|
+
const sanitized = node.replace(/[^a-zA-Z0-9]/g, "_");
|
|
594
|
+
lines.push(` ${sanitized}:::cutset`);
|
|
595
|
+
}
|
|
596
|
+
// Add legend
|
|
597
|
+
lines.push("");
|
|
598
|
+
lines.push(" subgraph Legend");
|
|
599
|
+
lines.push(" source_leg[Secret Source]:::source");
|
|
600
|
+
lines.push(" sink_leg[Network Sink]:::sink");
|
|
601
|
+
lines.push(" both_leg[Source + Sink]:::both");
|
|
602
|
+
lines.push(" cut_leg[Cut Set]:::cutset");
|
|
603
|
+
lines.push(" end");
|
|
604
|
+
return lines.join("\n");
|
|
605
|
+
}
|
|
606
|
+
// ============================================================================
|
|
607
|
+
// Main Scanner Function
|
|
608
|
+
// ============================================================================
|
|
609
|
+
/**
|
|
610
|
+
* Run exfiltration path graph scanner
|
|
611
|
+
*/
|
|
612
|
+
export async function runExfilPathScanner(manifest, _options) {
|
|
613
|
+
const startTime = Date.now();
|
|
614
|
+
// Build graph
|
|
615
|
+
const nodes = buildNodes(manifest);
|
|
616
|
+
const edges = buildEdges(nodes);
|
|
617
|
+
const exfilPaths = findExfilPaths(nodes, edges);
|
|
618
|
+
const cutSet = findMinimalCutSet(exfilPaths, nodes);
|
|
619
|
+
const graph = {
|
|
620
|
+
nodes,
|
|
621
|
+
edges,
|
|
622
|
+
exfilPaths,
|
|
623
|
+
cutSet,
|
|
624
|
+
mermaidDiagram: "",
|
|
625
|
+
};
|
|
626
|
+
// Generate diagram
|
|
627
|
+
graph.mermaidDiagram = generateMermaidDiagram(graph);
|
|
628
|
+
// Convert to findings
|
|
629
|
+
const findings = [];
|
|
630
|
+
// Add finding for each critical/high path
|
|
631
|
+
for (const path of exfilPaths) {
|
|
632
|
+
if (path.riskLevel === "critical" || path.riskLevel === "high") {
|
|
633
|
+
findings.push({
|
|
634
|
+
scanner: "semgrep",
|
|
635
|
+
ruleId: `exfil-path:${path.riskLevel}`,
|
|
636
|
+
file: "mcp-manifest",
|
|
637
|
+
line: 0,
|
|
638
|
+
message: path.description,
|
|
639
|
+
severity: path.riskLevel,
|
|
640
|
+
confidence: 100,
|
|
641
|
+
evidence: [
|
|
642
|
+
`Path: ${path.fullPath.join(" → ")}`,
|
|
643
|
+
`Mitigations:`,
|
|
644
|
+
...path.mitigations.map((m) => ` - ${m}`),
|
|
645
|
+
].join("\n"),
|
|
646
|
+
metadata: {
|
|
647
|
+
agentScanner: "exfil-path-graph",
|
|
648
|
+
source: path.source,
|
|
649
|
+
sink: path.sink,
|
|
650
|
+
pathLength: path.fullPath.length,
|
|
651
|
+
mitigations: path.mitigations,
|
|
652
|
+
},
|
|
653
|
+
});
|
|
654
|
+
}
|
|
655
|
+
}
|
|
656
|
+
// Add summary finding
|
|
657
|
+
if (exfilPaths.length > 0) {
|
|
658
|
+
const criticalPaths = exfilPaths.filter((p) => p.riskLevel === "critical");
|
|
659
|
+
const highPaths = exfilPaths.filter((p) => p.riskLevel === "high");
|
|
660
|
+
findings.push({
|
|
661
|
+
scanner: "semgrep",
|
|
662
|
+
ruleId: "exfil-path:summary",
|
|
663
|
+
file: "mcp-manifest",
|
|
664
|
+
line: 0,
|
|
665
|
+
message: `Found ${exfilPaths.length} potential exfiltration path(s): ${criticalPaths.length} critical, ${highPaths.length} high`,
|
|
666
|
+
severity: criticalPaths.length > 0 ? "critical" : highPaths.length > 0 ? "high" : "medium",
|
|
667
|
+
confidence: 100,
|
|
668
|
+
evidence: [
|
|
669
|
+
`Total paths: ${exfilPaths.length}`,
|
|
670
|
+
`Secret sources: ${Array.from(nodes.values()).filter((n) => n.isSecretSource).length}`,
|
|
671
|
+
`Network sinks: ${Array.from(nodes.values()).filter((n) => n.isNetworkSink).length}`,
|
|
672
|
+
`Recommended cut set: ${cutSet.join(", ") || "None needed"}`,
|
|
673
|
+
"",
|
|
674
|
+
"Mermaid diagram:",
|
|
675
|
+
"```mermaid",
|
|
676
|
+
graph.mermaidDiagram,
|
|
677
|
+
"```",
|
|
678
|
+
].join("\n"),
|
|
679
|
+
metadata: {
|
|
680
|
+
agentScanner: "exfil-path-graph",
|
|
681
|
+
totalPaths: exfilPaths.length,
|
|
682
|
+
criticalPaths: criticalPaths.length,
|
|
683
|
+
highPaths: highPaths.length,
|
|
684
|
+
cutSet,
|
|
685
|
+
sources: Array.from(nodes.values())
|
|
686
|
+
.filter((n) => n.isSecretSource)
|
|
687
|
+
.map((n) => n.name),
|
|
688
|
+
sinks: Array.from(nodes.values())
|
|
689
|
+
.filter((n) => n.isNetworkSink)
|
|
690
|
+
.map((n) => n.name),
|
|
691
|
+
},
|
|
692
|
+
});
|
|
693
|
+
}
|
|
694
|
+
// Calculate manifest hash
|
|
695
|
+
const manifestHash = createHash("sha256")
|
|
696
|
+
.update(JSON.stringify(manifest))
|
|
697
|
+
.digest("hex");
|
|
698
|
+
return {
|
|
699
|
+
scanner: "exfil-path-graph",
|
|
700
|
+
findings,
|
|
701
|
+
duration: Date.now() - startTime,
|
|
702
|
+
success: true,
|
|
703
|
+
mcpServerName: manifest.name,
|
|
704
|
+
mcpServerVersion: manifest.version,
|
|
705
|
+
manifestHash,
|
|
706
|
+
version: "1.0.0",
|
|
707
|
+
rulesUsed: ["path-analysis"],
|
|
708
|
+
};
|
|
709
|
+
}
|
|
710
|
+
/**
|
|
711
|
+
* Check if exfil path scanner is available (always true - no external deps)
|
|
712
|
+
*/
|
|
713
|
+
export async function checkExfilPathAvailable() {
|
|
714
|
+
return {
|
|
715
|
+
scanner: "exfil-path-graph",
|
|
716
|
+
available: true,
|
|
717
|
+
version: "1.0.0",
|
|
718
|
+
};
|
|
719
|
+
}
|
|
720
|
+
/**
|
|
721
|
+
* Get exfil graph from scanner result
|
|
722
|
+
*/
|
|
723
|
+
export function getExfilGraph(result) {
|
|
724
|
+
const summaryFinding = result.findings.find((f) => f.ruleId === "exfil-path:summary");
|
|
725
|
+
if (!summaryFinding?.metadata) {
|
|
726
|
+
return null;
|
|
727
|
+
}
|
|
728
|
+
const meta = summaryFinding.metadata;
|
|
729
|
+
// Return partial graph info from metadata
|
|
730
|
+
// (full graph requires re-running scanner)
|
|
731
|
+
return {
|
|
732
|
+
nodes: new Map(),
|
|
733
|
+
edges: [],
|
|
734
|
+
exfilPaths: [],
|
|
735
|
+
cutSet: meta.cutSet || [],
|
|
736
|
+
mermaidDiagram: extractMermaidDiagram(summaryFinding.evidence || ""),
|
|
737
|
+
};
|
|
738
|
+
}
|
|
739
|
+
/**
|
|
740
|
+
* Extract Mermaid diagram from evidence
|
|
741
|
+
*/
|
|
742
|
+
function extractMermaidDiagram(evidence) {
|
|
743
|
+
const match = evidence.match(/```mermaid\n([\s\S]*?)\n```/);
|
|
744
|
+
return match ? match[1] : "";
|
|
745
|
+
}
|
|
746
|
+
/**
|
|
747
|
+
* Get exfil path summary
|
|
748
|
+
*/
|
|
749
|
+
export function getExfilSummary(result) {
|
|
750
|
+
const summaryFinding = result.findings.find((f) => f.ruleId === "exfil-path:summary");
|
|
751
|
+
if (!summaryFinding?.metadata) {
|
|
752
|
+
return null;
|
|
753
|
+
}
|
|
754
|
+
const meta = summaryFinding.metadata;
|
|
755
|
+
return {
|
|
756
|
+
totalPaths: meta.totalPaths || 0,
|
|
757
|
+
criticalPaths: meta.criticalPaths || 0,
|
|
758
|
+
highPaths: meta.highPaths || 0,
|
|
759
|
+
sources: meta.sources || [],
|
|
760
|
+
sinks: meta.sinks || [],
|
|
761
|
+
cutSet: meta.cutSet || [],
|
|
762
|
+
};
|
|
763
|
+
}
|
|
764
|
+
//# sourceMappingURL=exfil-path-graph.js.map
|