Skip to content

Commit

Permalink
feat: Added support for depth-detection
Browse files Browse the repository at this point in the history
  • Loading branch information
ofekatr committed Aug 31, 2022
1 parent d7ad7f4 commit 8cf1815
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/cli/commands/test/iac/v2/assert-iac-options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ const keys: (keyof IaCTestFlags)[] = [
'scan',
'experimental',
'var-file',
'detectionDepth',
// PolicyOptions
'ignore-policy',
'policy-path',
Expand Down
3 changes: 3 additions & 0 deletions src/cli/commands/test/iac/v2/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ async function prepareTestConfig(
const projectTags = parseTags(options);
const targetName = getFlag(options, 'target-name');
const remoteRepoUrl = getFlag(options, 'remote-repo-url');
const depthDetection =
parseInt(getFlag(options, 'depth-detection') as string) || undefined;
const attributes = parseAttributes(options);
const policy = await findAndLoadPolicy(process.cwd(), 'iac', options);
const scan = options.scan ?? 'resource-changes';
Expand All @@ -73,6 +75,7 @@ async function prepareTestConfig(
remoteRepoUrl,
policy: policy?.toString(),
scan,
depthDetection,
};
}

Expand Down
4 changes: 4 additions & 0 deletions src/lib/iac/test/v2/scan/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,10 @@ function processFlags(
flags.push('-project-lifecycle', options.attributes.lifecycle.join(','));
}

if (options.depthDetection) {
flags.push('-depth-detection', `${options.depthDetection}`);
}

if (options.projectTags) {
const stringifiedTags = options.projectTags
.map((tag) => {
Expand Down
1 change: 1 addition & 0 deletions src/lib/iac/test/v2/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,5 @@ export interface TestConfig {
remoteRepoUrl?: string;
policy?: string;
scan: string;
depthDetection?: number;
}

0 comments on commit 8cf1815

Please sign in to comment.