diff --git a/src/lib/ecosystems/monitor.ts b/src/lib/ecosystems/monitor.ts index b4a784d579..7d94b4b306 100644 --- a/src/lib/ecosystems/monitor.ts +++ b/src/lib/ecosystems/monitor.ts @@ -80,6 +80,8 @@ async function monitorDependencies( options, ); + const configOrg = config.org ? decodeURIComponent(config.org) : undefined; + const payload = { method: 'PUT', url: `${config.API}/monitor-dependencies`, @@ -89,6 +91,9 @@ async function monitorDependencies( authorization: 'token ' + snyk.api, }, body: monitorDependenciesRequest, + qs: { + org: options.org || configOrg, + }, }; try { const response = await makeRequest( diff --git a/test/acceptance/cli-monitor/cli-monitor.acceptance.test.ts b/test/acceptance/cli-monitor/cli-monitor.acceptance.test.ts index 1fb76674e3..ec26f7904d 100644 --- a/test/acceptance/cli-monitor/cli-monitor.acceptance.test.ts +++ b/test/acceptance/cli-monitor/cli-monitor.acceptance.test.ts @@ -1825,6 +1825,38 @@ if (!isWindows) { ); }); + test('`monitor foo:latest --docker --org=fake-org`', async (t) => { + stubDockerPluginResponse( + { + scanResults: [ + { + identity: { + type: 'rpm', + }, + target: { + image: 'docker-image|foo', + }, + facts: [{ type: 'depGraph', data: {} }], + }, + ], + }, + t, + ); + + await cli.monitor('foo:latest', { + docker: true, + org: 'fake-org', + }); + const req = server.popRequest(); + t.deepEqual( + req.query, + { + org: 'fake-org', + }, + 'sends correct payload', + ); + }); + test('monitor --json multiple folders', async (t) => { chdirWorkspaces('fail-on');