@jskit-ai/connectors-catalog 0.1.1
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/README.md +192 -0
- package/docs/ai-upstream-notices.md +51 -0
- package/docs/ai.md +191 -0
- package/docs/airtable.md +130 -0
- package/docs/algolia.md +190 -0
- package/docs/amazon-redshift.md +229 -0
- package/docs/amplitude.md +210 -0
- package/docs/apify.md +162 -0
- package/docs/apollo-io.md +200 -0
- package/docs/asana.md +126 -0
- package/docs/ashby.md +188 -0
- package/docs/atlassian.md +224 -0
- package/docs/attention.md +162 -0
- package/docs/aws-athena.md +150 -0
- package/docs/aws-credentials.md +75 -0
- package/docs/aws-s3.md +193 -0
- package/docs/bigquery.md +146 -0
- package/docs/brevo.md +122 -0
- package/docs/calendly.md +158 -0
- package/docs/canva.md +191 -0
- package/docs/chargebee.md +192 -0
- package/docs/clay.md +194 -0
- package/docs/clickhouse.md +242 -0
- package/docs/confidence-exp.md +74 -0
- package/docs/confidence-flags.md +75 -0
- package/docs/confidence-oauth.md +137 -0
- package/docs/contentful.md +123 -0
- package/docs/databricks.md +180 -0
- package/docs/dbt-semantic-layer.md +175 -0
- package/docs/elevenlabs.md +102 -0
- package/docs/figma.md +132 -0
- package/docs/firebase-cloud-messaging.md +262 -0
- package/docs/firecrawl.md +137 -0
- package/docs/fireflies.md +95 -0
- package/docs/fireworks-ai.md +53 -0
- package/docs/gatewayapi.md +113 -0
- package/docs/gemini-enterprise.md +224 -0
- package/docs/github-api.md +133 -0
- package/docs/gitlab-api.md +138 -0
- package/docs/gmail.md +133 -0
- package/docs/gong.md +205 -0
- package/docs/google-ads.md +156 -0
- package/docs/google-analytics.md +202 -0
- package/docs/google-docs.md +105 -0
- package/docs/google-drive.md +108 -0
- package/docs/google-maps-platform.md +208 -0
- package/docs/google-oauth.md +123 -0
- package/docs/google-search-console.md +124 -0
- package/docs/google-sheets.md +94 -0
- package/docs/google-slides.md +95 -0
- package/docs/granola.md +178 -0
- package/docs/hex.md +161 -0
- package/docs/heygen.md +124 -0
- package/docs/hubspot.md +142 -0
- package/docs/incident-io.md +118 -0
- package/docs/inngest.md +178 -0
- package/docs/klipy.md +149 -0
- package/docs/lexware.md +144 -0
- package/docs/lightspeed.md +193 -0
- package/docs/linear.md +137 -0
- package/docs/linkedin.md +196 -0
- package/docs/logo-dev.md +152 -0
- package/docs/mailgun.md +153 -0
- package/docs/mapbox.md +174 -0
- package/docs/microsoft-excel.md +97 -0
- package/docs/microsoft-fabric.md +249 -0
- package/docs/microsoft-oauth.md +143 -0
- package/docs/microsoft-onedrive.md +76 -0
- package/docs/microsoft-onenote.md +75 -0
- package/docs/microsoft-outlook.md +90 -0
- package/docs/microsoft-powerpoint.md +119 -0
- package/docs/microsoft-sharepoint.md +75 -0
- package/docs/microsoft-teams.md +72 -0
- package/docs/microsoft-word.md +119 -0
- package/docs/miro.md +117 -0
- package/docs/n8n.md +169 -0
- package/docs/notion.md +137 -0
- package/docs/oura.md +161 -0
- package/docs/paddle.md +168 -0
- package/docs/perplexity.md +85 -0
- package/docs/pipedrive.md +120 -0
- package/docs/polar.md +63 -0
- package/docs/posthog.md +227 -0
- package/docs/prestashop.md +151 -0
- package/docs/replicate.md +60 -0
- package/docs/resend.md +153 -0
- package/docs/salesforce.md +234 -0
- package/docs/sanity.md +122 -0
- package/docs/semrush.md +276 -0
- package/docs/sentry.md +112 -0
- package/docs/sevdesk.md +107 -0
- package/docs/shopify.md +206 -0
- package/docs/slack.md +257 -0
- package/docs/snowflake.md +271 -0
- package/docs/storyblok.md +130 -0
- package/docs/stripe.md +77 -0
- package/docs/supabase.md +51 -0
- package/docs/tally.md +105 -0
- package/docs/telegram.md +165 -0
- package/docs/tiktok.md +201 -0
- package/docs/twilio.md +284 -0
- package/docs/twitch.md +428 -0
- package/docs/wave.md +440 -0
- package/docs/wix.md +1249 -0
- package/docs/wiz.md +177 -0
- package/docs/woocommerce.md +400 -0
- package/docs/wordpress-com.md +358 -0
- package/docs/wordpress-self-hosted.md +252 -0
- package/docs/workday.md +292 -0
- package/docs/x-twitter.md +188 -0
- package/docs/xero.md +429 -0
- package/docs/zoho-books.md +214 -0
- package/docs/zoho-crm.md +192 -0
- package/package.json +153 -0
- package/patterns/ai-connections/PATTERN.md +84 -0
- package/patterns/ai-connections/example/ai-model.js +11 -0
- package/patterns/ai-connections/example/perplexity-answer.js +29 -0
- package/patterns/api-key-connection/PATTERN.md +368 -0
- package/patterns/api-key-connection/example/connections.js +18 -0
- package/patterns/api-key-connection/example/integrations.json +19 -0
- package/patterns/assistant-mcp/PATTERN.md +110 -0
- package/patterns/assistant-mcp/example/integrations.json +13 -0
- package/patterns/assistant-mcp-oauth/PATTERN.md +235 -0
- package/patterns/assistant-mcp-oauth/example/integrations.json +102 -0
- package/patterns/aws-storage-queries/PATTERN.md +169 -0
- package/patterns/aws-storage-queries/example/formats/data-formats.js +35 -0
- package/patterns/aws-storage-queries/example/formats/package-lock.json +49 -0
- package/patterns/aws-storage-queries/example/formats/package.json +12 -0
- package/patterns/aws-storage-queries/example/formats/verify-formats.mjs +37 -0
- package/patterns/aws-storage-queries/example/integrations.json +38 -0
- package/patterns/aws-storage-queries/example/s3-transfer.js +34 -0
- package/patterns/event-delivery/PATTERN.md +151 -0
- package/patterns/event-delivery/example/integrations.json +17 -0
- package/patterns/firebase-messaging/PATTERN.md +156 -0
- package/patterns/firebase-messaging/example/server/notifications.js +23 -0
- package/patterns/google-ads-search/PATTERN.md +92 -0
- package/patterns/google-ads-search/example/ads-setup.js +25 -0
- package/patterns/oauth-connection/PATTERN.md +724 -0
- package/patterns/oauth-connection/example/integrations.json +20 -0
- package/patterns/paddle-catalogue/PATTERN.md +78 -0
- package/patterns/paddle-catalogue/example/create-products.js +38 -0
- package/patterns/public-image/PATTERN.md +84 -0
- package/patterns/public-image/example/integrations.json +13 -0
- package/patterns/public-image/example/logo-url.js +16 -0
- package/patterns/redshift-queries/PATTERN.md +150 -0
- package/patterns/redshift-queries/example/integrations.json +33 -0
- package/patterns/source-scanning/PATTERN.md +83 -0
- package/patterns/source-scanning/example/source-scanner.js +13 -0
- package/src/client/firebase-cloud-messaging.js +10 -0
- package/src/client/google-analytics.js +72 -0
- package/src/client/google-maps-platform.js +39 -0
- package/src/client/logo-dev.js +36 -0
- package/src/server/ai.js +46 -0
- package/src/server/airtable.js +67 -0
- package/src/server/algolia.js +63 -0
- package/src/server/amazon-redshift.js +96 -0
- package/src/server/amplitude.js +31 -0
- package/src/server/apify.js +68 -0
- package/src/server/apollo-io.js +85 -0
- package/src/server/asana.js +64 -0
- package/src/server/ashby.js +61 -0
- package/src/server/atlassian.js +32 -0
- package/src/server/attention.js +93 -0
- package/src/server/aws-athena.js +82 -0
- package/src/server/aws-s3.js +49 -0
- package/src/server/awsTransport.js +75 -0
- package/src/server/bigquery.js +97 -0
- package/src/server/brevo.js +97 -0
- package/src/server/calendly.js +77 -0
- package/src/server/canva.js +13 -0
- package/src/server/chargebee.js +88 -0
- package/src/server/clay.js +78 -0
- package/src/server/clickhouse.js +66 -0
- package/src/server/confidence.js +29 -0
- package/src/server/contentful.js +40 -0
- package/src/server/databricks.js +55 -0
- package/src/server/dbt-semantic-layer.js +95 -0
- package/src/server/elevenlabs.js +81 -0
- package/src/server/figma.js +24 -0
- package/src/server/firebase-cloud-messaging.js +111 -0
- package/src/server/firecrawl.js +70 -0
- package/src/server/fireflies.js +31 -0
- package/src/server/fireworks-ai.js +16 -0
- package/src/server/gatewayapi.js +48 -0
- package/src/server/gemini-enterprise.js +47 -0
- package/src/server/github-api.js +90 -0
- package/src/server/gitlab-api.js +67 -0
- package/src/server/gmail.js +60 -0
- package/src/server/gong.js +52 -0
- package/src/server/google-ads-search.js +134 -0
- package/src/server/google-ads.js +80 -0
- package/src/server/google-docs.js +36 -0
- package/src/server/google-drive.js +71 -0
- package/src/server/google-maps-platform.js +90 -0
- package/src/server/google-search-console.js +31 -0
- package/src/server/google-sheets.js +60 -0
- package/src/server/google-slides.js +36 -0
- package/src/server/google.js +61 -0
- package/src/server/granola.js +115 -0
- package/src/server/graphqlOperation.js +15 -0
- package/src/server/hex.js +29 -0
- package/src/server/heygen.js +54 -0
- package/src/server/hubspot.js +85 -0
- package/src/server/incident-io.js +68 -0
- package/src/server/inngest.js +86 -0
- package/src/server/jsonOperation.js +34 -0
- package/src/server/klipy.js +34 -0
- package/src/server/lexware.js +59 -0
- package/src/server/lightspeed.js +82 -0
- package/src/server/linear.js +52 -0
- package/src/server/linkedin.js +74 -0
- package/src/server/mailgun.js +76 -0
- package/src/server/mapbox.js +46 -0
- package/src/server/mcpRegistration.js +41 -0
- package/src/server/mcpTransport.js +60 -0
- package/src/server/microsoft-excel.js +67 -0
- package/src/server/microsoft-fabric.js +81 -0
- package/src/server/microsoft-onedrive.js +58 -0
- package/src/server/microsoft-onenote.js +52 -0
- package/src/server/microsoft-outlook.js +58 -0
- package/src/server/microsoft-powerpoint.js +5 -0
- package/src/server/microsoft-sharepoint.js +46 -0
- package/src/server/microsoft-teams.js +29 -0
- package/src/server/microsoft-word.js +5 -0
- package/src/server/microsoft.js +88 -0
- package/src/server/miro.js +29 -0
- package/src/server/n8n.js +78 -0
- package/src/server/notion.js +76 -0
- package/src/server/oura.js +48 -0
- package/src/server/paddle.js +83 -0
- package/src/server/perplexity.js +15 -0
- package/src/server/pipedrive.js +95 -0
- package/src/server/polar.js +20 -0
- package/src/server/posthog.js +44 -0
- package/src/server/prestashop.js +42 -0
- package/src/server/replicate.js +42 -0
- package/src/server/resend.js +93 -0
- package/src/server/salesforce.js +84 -0
- package/src/server/sanity.js +31 -0
- package/src/server/semrush.js +359 -0
- package/src/server/sentry.js +30 -0
- package/src/server/sevdesk.js +20 -0
- package/src/server/shopify.js +99 -0
- package/src/server/slack.js +143 -0
- package/src/server/snowflake.js +139 -0
- package/src/server/storyblok.js +49 -0
- package/src/server/stripe.js +13 -0
- package/src/server/supabase.js +13 -0
- package/src/server/tally.js +78 -0
- package/src/server/telegram.js +55 -0
- package/src/server/tiktok.js +86 -0
- package/src/server/twilio.js +90 -0
- package/src/server/twitch.js +409 -0
- package/src/server/wave.js +520 -0
- package/src/server/wix.js +1048 -0
- package/src/server/wiz.js +117 -0
- package/src/server/woocommerce.js +412 -0
- package/src/server/wordpress-com.js +236 -0
- package/src/server/wordpress-self-hosted.js +134 -0
- package/src/server/workday.js +136 -0
- package/src/server/x-twitter.js +110 -0
- package/src/server/xero.js +397 -0
- package/src/server/zoho-books.js +90 -0
- package/src/server/zoho-crm.js +89 -0
- package/src/server/zohoOAuth.js +21 -0
- package/src/shared/ai-models.json +8049 -0
- package/src/shared/ai.js +63 -0
- package/src/shared/algolia.js +29 -0
- package/src/shared/amazon-redshift.js +51 -0
- package/src/shared/amplitude.js +28 -0
- package/src/shared/atlassian.js +43 -0
- package/src/shared/aws.js +72 -0
- package/src/shared/canva.js +66 -0
- package/src/shared/chargebee.js +26 -0
- package/src/shared/clickhouse.js +38 -0
- package/src/shared/confidence.js +28 -0
- package/src/shared/databricks.js +33 -0
- package/src/shared/dbt-semantic-layer.js +32 -0
- package/src/shared/definitions.js +140 -0
- package/src/shared/figma.js +21 -0
- package/src/shared/firebase-cloud-messaging.js +45 -0
- package/src/shared/gemini-enterprise.js +33 -0
- package/src/shared/gong.js +33 -0
- package/src/shared/google-ads-search.js +31 -0
- package/src/shared/google-ads.js +28 -0
- package/src/shared/google-maps-platform.js +28 -0
- package/src/shared/google.js +133 -0
- package/src/shared/granola.js +25 -0
- package/src/shared/hex.js +28 -0
- package/src/shared/inngest.js +35 -0
- package/src/shared/lightspeed.js +75 -0
- package/src/shared/linkedin.js +27 -0
- package/src/shared/logo-dev.js +21 -0
- package/src/shared/mapbox.js +38 -0
- package/src/shared/mcp.js +92 -0
- package/src/shared/microsoft-fabric.js +47 -0
- package/src/shared/microsoft.js +231 -0
- package/src/shared/miro.js +27 -0
- package/src/shared/oura.js +23 -0
- package/src/shared/posthog.js +33 -0
- package/src/shared/prestashop.js +23 -0
- package/src/shared/salesforce.js +36 -0
- package/src/shared/semrush.js +24 -0
- package/src/shared/shopify.js +51 -0
- package/src/shared/siteUrl.js +12 -0
- package/src/shared/slack.js +88 -0
- package/src/shared/snowflake.js +55 -0
- package/src/shared/tiktok.js +22 -0
- package/src/shared/tokens.js +747 -0
- package/src/shared/twilio.js +41 -0
- package/src/shared/twitch.js +49 -0
- package/src/shared/wave.js +52 -0
- package/src/shared/wix.js +40 -0
- package/src/shared/wiz.js +41 -0
- package/src/shared/wordpress-com.js +30 -0
- package/src/shared/wordpress.js +69 -0
- package/src/shared/workday.js +50 -0
- package/src/shared/x-twitter.js +19 -0
- package/src/shared/xero.js +46 -0
- package/src/shared/zoho-books.js +39 -0
- package/src/shared/zoho-crm.js +43 -0
- package/src/shared/zoho-regions.js +12 -0
- package/test/ai.test.js +136 -0
- package/test/airtable.test.js +125 -0
- package/test/algolia.test.js +207 -0
- package/test/amazon-redshift.test.js +272 -0
- package/test/amplitude.test.js +239 -0
- package/test/apify.test.js +93 -0
- package/test/apollo-io.test.js +125 -0
- package/test/asana.test.js +99 -0
- package/test/ashby.test.js +97 -0
- package/test/atlassian.test.js +249 -0
- package/test/attention.test.js +79 -0
- package/test/aws.test.js +405 -0
- package/test/brevo.test.js +71 -0
- package/test/calendly.test.js +136 -0
- package/test/canva.test.js +258 -0
- package/test/chargebee.test.js +195 -0
- package/test/clickhouse.test.js +278 -0
- package/test/confidence.test.js +205 -0
- package/test/databricks.test.js +253 -0
- package/test/dbt-semantic-layer.test.js +221 -0
- package/test/designMcp.test.js +336 -0
- package/test/elevenlabs.test.js +52 -0
- package/test/firebase-cloud-messaging.test.js +242 -0
- package/test/firecrawl.test.js +66 -0
- package/test/gemini-enterprise.test.js +218 -0
- package/test/github-api.test.js +167 -0
- package/test/gitlab-api.test.js +160 -0
- package/test/gong.test.js +192 -0
- package/test/google-ads.test.js +350 -0
- package/test/google-maps-platform.test.js +191 -0
- package/test/google.test.js +710 -0
- package/test/granola.test.js +240 -0
- package/test/hex.test.js +253 -0
- package/test/heygen.test.js +121 -0
- package/test/hubspot.test.js +103 -0
- package/test/inngest.test.js +219 -0
- package/test/lightspeed.test.js +250 -0
- package/test/linear.test.js +146 -0
- package/test/linkedin.test.js +243 -0
- package/test/logo-dev.test.js +79 -0
- package/test/mailgun.test.js +107 -0
- package/test/mapbox.test.js +181 -0
- package/test/mcp.test.js +227 -0
- package/test/microsoft-fabric.test.js +258 -0
- package/test/microsoft.test.js +554 -0
- package/test/n8nOAuth.test.js +188 -0
- package/test/notionOAuth.test.js +183 -0
- package/test/oura.test.js +211 -0
- package/test/paddleCatalogue.test.js +51 -0
- package/test/paddlePermissions.test.js +101 -0
- package/test/perplexityComposition.test.js +39 -0
- package/test/pipedriveOAuth.test.js +140 -0
- package/test/posthog.test.js +200 -0
- package/test/prestashop.test.js +207 -0
- package/test/resend.test.js +163 -0
- package/test/salesforce.test.js +276 -0
- package/test/semrush.test.js +479 -0
- package/test/sentry.test.js +35 -0
- package/test/shopify.test.js +247 -0
- package/test/slack.test.js +320 -0
- package/test/snowflake.test.js +391 -0
- package/test/tally.test.js +75 -0
- package/test/telegram.test.js +58 -0
- package/test/tiktok.test.js +243 -0
- package/test/tokens.test.js +1079 -0
- package/test/twilio.test.js +221 -0
- package/test/twitch.test.js +573 -0
- package/test/wave.test.js +678 -0
- package/test/wix.test.js +1099 -0
- package/test/wiz.test.js +185 -0
- package/test/wordpress-com.test.js +469 -0
- package/test/wordpress.test.js +660 -0
- package/test/workday.test.js +314 -0
- package/test/x-twitter.test.js +256 -0
- package/test/xero.test.js +700 -0
- package/test/zoho-books.test.js +253 -0
- package/test/zoho-crm.test.js +223 -0
package/test/wiz.test.js
ADDED
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
import assert from "node:assert/strict";
|
|
2
|
+
import test from "node:test";
|
|
3
|
+
import { mkdtemp, writeFile, readFile, rm, access, mkdir } from "node:fs/promises";
|
|
4
|
+
import { tmpdir } from "node:os";
|
|
5
|
+
import path from "node:path";
|
|
6
|
+
import { setTimeout as delay } from "node:timers/promises";
|
|
7
|
+
import { validateIntegrationConfiguration, parseIntegrationConfiguration } from "../../connectors-core/src/shared/configuration.js";
|
|
8
|
+
import { createWizScanner } from "../src/server/wiz.js";
|
|
9
|
+
import { wizDefinition } from "../src/shared/wiz.js";
|
|
10
|
+
|
|
11
|
+
const context = { applicationId: "project-one", subjectId: "workspace-one" };
|
|
12
|
+
const args = { context, integrationId: "security" };
|
|
13
|
+
const configuration = () => ({ schemaVersion: 1, registrations: {
|
|
14
|
+
wiz: { source: "own", grantType: "client_credentials", clientId: "fixture-client", clientSecretRef: "env:WIZ_SECRET" }
|
|
15
|
+
}, integrations: { security: { provider: "wiz", displayName: "Workspace scan", accountMode: "shared", scopes: [],
|
|
16
|
+
authentication: { method: "oauth2", registrationRef: "wiz" }, settings: {} } } });
|
|
17
|
+
|
|
18
|
+
async function fixture(t, patch = {}) {
|
|
19
|
+
const root = await mkdtemp(path.join(tmpdir(), "wiz-fixture-"));
|
|
20
|
+
t.after(() => rm(root, { recursive: true, force: true }));
|
|
21
|
+
const source = path.join(root, "source with spaces;$literal"); await mkdir(source);
|
|
22
|
+
const executable = path.join(root, "fixture-cli");
|
|
23
|
+
await writeFile(executable, `#!${process.execPath}
|
|
24
|
+
import fs from 'node:fs';
|
|
25
|
+
import path from 'node:path';
|
|
26
|
+
import { spawn } from 'node:child_process';
|
|
27
|
+
const state = JSON.parse(fs.readFileSync(path.join(process.argv[4], 'fixture.json'), 'utf8'));
|
|
28
|
+
const reportPath = process.argv.find(value => value.startsWith('--json-output-file=')).slice('--json-output-file='.length);
|
|
29
|
+
const record = { argv: process.argv.slice(2), cwd: process.cwd(), environment: process.env, pid: process.pid };
|
|
30
|
+
if (state.hang) {
|
|
31
|
+
const child = spawn(process.execPath, ['-e', 'setInterval(() => {}, 1000)'], {stdio: 'ignore'});
|
|
32
|
+
record.childPid = child.pid;
|
|
33
|
+
fs.writeFileSync(path.join(process.argv[4], 'invocation.json'), JSON.stringify(record));
|
|
34
|
+
setInterval(() => {}, 1000);
|
|
35
|
+
} else {
|
|
36
|
+
fs.writeFileSync(path.join(process.argv[4], 'invocation.json'), JSON.stringify(record));
|
|
37
|
+
if (state.mode === 'symlink') fs.symlinkSync(path.join(process.argv[4], 'fixture.json'), reportPath);
|
|
38
|
+
else if (state.mode === 'directory') fs.mkdirSync(reportPath);
|
|
39
|
+
else if (state.mode === 'text') fs.writeFileSync(reportPath, 'private-cli-error: not JSON');
|
|
40
|
+
else if (state.mode !== 'missing') fs.writeFileSync(reportPath, JSON.stringify(state.report));
|
|
41
|
+
console.error('private-stderr-' + process.env.WIZ_CLIENT_SECRET);
|
|
42
|
+
process.exit(state.exitCode || 0);
|
|
43
|
+
}
|
|
44
|
+
`, { mode: 0o700 });
|
|
45
|
+
const state = { exitCode: 0, report: { status: { state: "SUCCESS", verdict: "PASSED_BY_POLICY" }, result: { sast: [] } }, ...patch };
|
|
46
|
+
const saveState = () => writeFile(path.join(source, "fixture.json"), JSON.stringify(state)); await saveState();
|
|
47
|
+
const config = configuration(); const decisions = []; const resolutions = [];
|
|
48
|
+
let secret = "private-secret-one";
|
|
49
|
+
const options = { configuration: config, executable, timeoutMs: 3000,
|
|
50
|
+
authorize: async (owner, request) => { decisions.push(request); return owner?.applicationId === context.applicationId && owner?.subjectId === context.subjectId ? owner : null; },
|
|
51
|
+
resolveScanTarget: async (owner) => { assert.deepEqual(owner, context); resolutions.push("source"); return { directory: source, revision: "revision-one" }; },
|
|
52
|
+
resolveReference: async (ref, owner) => { assert.equal(ref, "env:WIZ_SECRET"); assert.deepEqual(owner, context); resolutions.push("secret"); return secret; }
|
|
53
|
+
};
|
|
54
|
+
return { root, source, state, config, options, decisions, resolutions, saveState,
|
|
55
|
+
scanner: () => createWizScanner(options), invocation: async () => JSON.parse(await readFile(path.join(source, "invocation.json"), "utf8")),
|
|
56
|
+
rotate: () => { secret = "private-secret-two"; } };
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
test("Wiz runs a controlled CLI using authorised source, isolated state and credentials outside argv", async (t) => {
|
|
60
|
+
const f = await fixture(t); const result = await f.scanner().scan(args);
|
|
61
|
+
assert.deepEqual(result, { provider: "wiz", integrationId: "security", revision: "revision-one", policyStatus: "passed", report: f.state.report });
|
|
62
|
+
assert.deepEqual(f.decisions, [{ integrationId: "security", operation: "source.scan", accountMode: "shared" }]);
|
|
63
|
+
const run = await f.invocation(); assert.deepEqual(run.argv.slice(0, 3), ["scan", "dir", f.source]);
|
|
64
|
+
assert.ok(run.argv.includes("--by-policy-hits=BLOCK")); assert.ok(run.argv.includes("--timeout=3s"));
|
|
65
|
+
assert.ok(run.argv.includes("--assist-migration"));
|
|
66
|
+
assert.ok(run.argv.includes("--no-telemetry")); assert.equal(run.argv.some((value) => value.includes("private-secret")), false);
|
|
67
|
+
assert.equal(run.environment.WIZ_CLIENT_ID, "fixture-client"); assert.equal(run.environment.WIZ_CLIENT_SECRET, "private-secret-one");
|
|
68
|
+
assert.equal(run.environment.HOME, run.cwd); assert.equal(run.environment.WIZ_DIR, run.cwd); assert.equal(run.environment.TMPDIR, run.cwd);
|
|
69
|
+
assert.notEqual(run.cwd, f.source);
|
|
70
|
+
assert.deepEqual(Object.keys(run.environment).sort(), ["HOME", "PATH", "TMPDIR", "WIZ_CLIENT_ID", "WIZ_CLIENT_SECRET", "WIZ_DIR"].sort());
|
|
71
|
+
await assert.rejects(access(run.cwd), { code: "ENOENT" });
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
test("Wiz keeps policy blocking distinct from warning and from filtering all findings", async (t) => {
|
|
75
|
+
const f = await fixture(t); f.config.integrations.security.settings = { byPolicyHits: "DISABLED", policies: 'First policy, Second "quoted" policy;literal' };
|
|
76
|
+
f.state.exitCode = 4; f.state.report.status.verdict = "FAILED_BY_POLICY"; await f.saveState();
|
|
77
|
+
assert.equal((await f.scanner().scan(args)).policyStatus, "blocked");
|
|
78
|
+
const run = await f.invocation(); assert.ok(run.argv.includes('--policies=First policy,Second "quoted" policy;literal'));
|
|
79
|
+
assert.ok(run.argv.includes("--by-policy-hits=DISABLED"));
|
|
80
|
+
f.state.exitCode = 0; f.state.report.status.verdict = "WARN_BY_POLICY"; await f.saveState();
|
|
81
|
+
assert.equal((await f.scanner().scan(args)).policyStatus, "warning");
|
|
82
|
+
f.state.report.status.verdict = "FAILED_BY_POLICY"; await f.saveState();
|
|
83
|
+
assert.equal((await f.scanner().scan(args)).policyStatus, "blocked");
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
test("Wiz configuration survives a text round trip and resolves rotated secrets on each scan", async (t) => {
|
|
87
|
+
const f = await fixture(t); const scanner = f.scanner(); await scanner.scan(args); f.rotate(); await scanner.scan(args);
|
|
88
|
+
assert.equal((await f.invocation()).environment.WIZ_CLIENT_SECRET, "private-secret-two");
|
|
89
|
+
const parsed = parseIntegrationConfiguration(JSON.stringify(f.config), { providers: [wizDefinition] });
|
|
90
|
+
assert.deepEqual(parsed.integrations.security.settings, { tokenUrl: "https://auth.app.wiz.io/oauth/token", byPolicyHits: "BLOCK" });
|
|
91
|
+
assert.equal((await createWizScanner({ ...f.options, configuration: parsed }).scan(args)).policyStatus, "passed");
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
test("Wiz denies other owners before resolving source or secrets", async (t) => {
|
|
95
|
+
const f = await fixture(t);
|
|
96
|
+
for (const owner of [null, { ...context, applicationId: "other" }, { ...context, subjectId: "other" }]) {
|
|
97
|
+
await assert.rejects(f.scanner().scan({ ...args, context: owner }), { code: "connector_access_denied" });
|
|
98
|
+
}
|
|
99
|
+
assert.deepEqual(f.resolutions, []);
|
|
100
|
+
await assert.rejects(f.scanner().scan({ ...args, integrationId: "constructor" }), { code: "connector_not_found" });
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
test("Wiz preserves Auth0 configuration but rejects unsupported execution before credentials", async (t) => {
|
|
104
|
+
const f = await fixture(t); f.config.integrations.security.settings.tokenUrl = "https://auth.wiz.io/oauth/token";
|
|
105
|
+
assert.equal(validateIntegrationConfiguration(f.config, { providers: [wizDefinition] }).integrations.security.settings.tokenUrl, "https://auth.wiz.io/oauth/token");
|
|
106
|
+
await assert.rejects(f.scanner().scan(args), { code: "connector_authentication_unsupported" }); assert.deepEqual(f.resolutions, []);
|
|
107
|
+
f.config.registrations.wiz = { source: "managed", serviceUrlRef: "env:GATEWAY", serviceCredentialRef: "env:IDENTITY", assignmentRef: "online-wiz" };
|
|
108
|
+
assert.throws(() => f.scanner(), { code: "integration_configuration_invalid" }); assert.deepEqual(f.resolutions, []);
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
test("Wiz rejects invalid policy settings and credential modes before executing", () => {
|
|
112
|
+
for (const settings of [{ tokenUrl: "https://evil.test/oauth/token" }, { byPolicyHits: "NONE" }, { policies: "one,,two" },
|
|
113
|
+
{ policies: "" }, { policies: "one\ntwo" }, { policies: Array(51).fill("one").join(",") }, { directory: "/" }]) {
|
|
114
|
+
const config = configuration(); config.integrations.security.settings = settings;
|
|
115
|
+
assert.throws(() => validateIntegrationConfiguration(config, { providers: [wizDefinition] }));
|
|
116
|
+
}
|
|
117
|
+
for (const edit of [(c) => { c.integrations.security.accountMode = "per-user"; }, (c) => { c.registrations.wiz.clientId = "bad\0id"; },
|
|
118
|
+
(c) => { c.registrations.wiz.clientSecretRef = "raw-secret"; }, (c) => { c.registrations.wiz.callbackUrlRef = "env:CALLBACK"; }]) {
|
|
119
|
+
const config = configuration(); edit(config); assert.throws(() => validateIntegrationConfiguration(config, { providers: [wizDefinition] }));
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
test("Wiz reports authentication, command and transport failures without private CLI output", async (t) => {
|
|
124
|
+
const f = await fixture(t);
|
|
125
|
+
for (const exitCode of [1, 2, 3, 5]) {
|
|
126
|
+
f.state.exitCode = exitCode; await f.saveState();
|
|
127
|
+
await assert.rejects(f.scanner().scan(args), (error) => {
|
|
128
|
+
assert.equal(error.code, exitCode === 3 ? "connector_authentication_failed" : "connector_scan_failed");
|
|
129
|
+
assert.equal(String(error).includes("private"), false); return true;
|
|
130
|
+
});
|
|
131
|
+
await assert.rejects(access((await f.invocation()).cwd), { code: "ENOENT" });
|
|
132
|
+
}
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
test("Wiz rejects absent, malformed, oversized and inconsistent reports instead of reporting a clean scan", async (t) => {
|
|
136
|
+
const f = await fixture(t);
|
|
137
|
+
for (const patch of [{ mode: "missing" }, { mode: "text" }, { mode: "symlink" }, { mode: "directory" },
|
|
138
|
+
{ mode: "json", report: {} }, { report: { status: { state: "SUCCESS", verdict: "UNKNOWN" }, result: {} } },
|
|
139
|
+
{ report: { status: { state: "RUNNING", verdict: "PASSED_BY_POLICY" }, result: {} } },
|
|
140
|
+
{ report: { status: { state: "SUCCESS", verdict: "PASSED_BY_POLICY" } } },
|
|
141
|
+
{ exitCode: 4, report: { status: { state: "SUCCESS", verdict: "PASSED_BY_POLICY" }, result: {} } }]) {
|
|
142
|
+
Object.assign(f.state, patch); await f.saveState();
|
|
143
|
+
await assert.rejects(f.scanner().scan(args), { code: "connector_response_invalid" });
|
|
144
|
+
await assert.rejects(access((await f.invocation()).cwd), { code: "ENOENT" });
|
|
145
|
+
}
|
|
146
|
+
f.state.exitCode = 0; f.state.report = { status: { state: "SUCCESS", verdict: "PASSED_BY_POLICY" }, result: { large: "x".repeat(1000) } }; await f.saveState();
|
|
147
|
+
await assert.rejects(createWizScanner({ ...f.options, maxReportBytes: 100 }).scan(args), { code: "connector_response_invalid" });
|
|
148
|
+
});
|
|
149
|
+
|
|
150
|
+
test("Wiz validates trusted paths, references and runner options without leaking failures", async (t) => {
|
|
151
|
+
const f = await fixture(t);
|
|
152
|
+
for (const target of [{ directory: "relative", revision: "one" }, { directory: f.source, revision: "" }, { directory: f.options.executable, revision: "one" }]) {
|
|
153
|
+
await assert.rejects(createWizScanner({ ...f.options, resolveScanTarget: async () => target }).scan(args));
|
|
154
|
+
}
|
|
155
|
+
for (const resolveReference of [async () => "", async () => "secret\0", async () => { throw new Error("private-reference-detail"); }]) {
|
|
156
|
+
await assert.rejects(createWizScanner({ ...f.options, resolveReference }).scan(args), { code: "connector_binding_missing" });
|
|
157
|
+
}
|
|
158
|
+
await assert.rejects(createWizScanner({ ...f.options, executable: path.join(f.root, "missing") }).scan(args), { code: "connector_runner_unavailable" });
|
|
159
|
+
for (const patch of [{ executable: "wizcli" }, { timeoutMs: 0 }, { timeoutMs: 3_600_001 }, { maxReportBytes: 0 },
|
|
160
|
+
{ environment: { NODE_OPTIONS: "--inspect" } }, { environment: { WIZ_CLIENT_SECRET: "override" } }]) {
|
|
161
|
+
assert.throws(() => createWizScanner({ ...f.options, ...patch }), TypeError);
|
|
162
|
+
}
|
|
163
|
+
});
|
|
164
|
+
|
|
165
|
+
test("Wiz cancellation and timeout terminate the scan process group and remove its state", async (t) => {
|
|
166
|
+
const f = await fixture(t, { hang: true });
|
|
167
|
+
const controller = new AbortController();
|
|
168
|
+
const pending = f.scanner().scan({ ...args, signal: controller.signal });
|
|
169
|
+
const rejected = assert.rejects(pending, { code: "connector_cancelled" });
|
|
170
|
+
let run;
|
|
171
|
+
for (let i = 0; i < 100; i++) { try { run = await f.invocation(); break; } catch { await delay(20); } }
|
|
172
|
+
assert.ok(run?.childPid); controller.abort(); await rejected;
|
|
173
|
+
await assert.rejects(access(run.cwd), { code: "ENOENT" });
|
|
174
|
+
assert.throws(() => process.kill(run.pid, 0), { code: "ESRCH" });
|
|
175
|
+
// A killed grandchild can briefly remain a zombie until the host reaps it.
|
|
176
|
+
if (process.platform === "linux") {
|
|
177
|
+
const childState = await readFile(`/proc/${run.childPid}/stat`, "utf8").catch(() => "");
|
|
178
|
+
assert.ok(childState === "" || /\) Z /u.test(childState));
|
|
179
|
+
}
|
|
180
|
+
await assert.rejects(createWizScanner({ ...f.options, timeoutMs: 200 }).scan(args), { code: "connector_timeout" });
|
|
181
|
+
const timeoutRun = await f.invocation(); await assert.rejects(access(timeoutRun.cwd), { code: "ENOENT" });
|
|
182
|
+
const aborted = new AbortController(); aborted.abort(); const count = f.resolutions.length;
|
|
183
|
+
await assert.rejects(f.scanner().scan({ ...args, signal: aborted.signal }), { code: "connector_cancelled" });
|
|
184
|
+
assert.equal(f.resolutions.length, count);
|
|
185
|
+
});
|