Skip to content

Commit 11ac5f8

Browse files
authored
Merge pull request #3636 from snyk/feat/add-depth-detection-cfg-cfg-2110
feat: Added support for depth-detection [CFG-2110]
2 parents 9f69ced + 8cf1815 commit 11ac5f8

File tree

5 files changed

+15
-6
lines changed

5 files changed

+15
-6
lines changed

src/cli/commands/test/iac/v2/assert-iac-options.ts

+1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ const keys: (keyof IaCTestFlags)[] = [
2222
'scan',
2323
'experimental',
2424
'var-file',
25+
'detectionDepth',
2526
// PolicyOptions
2627
'ignore-policy',
2728
'policy-path',

src/cli/commands/test/iac/v2/index.ts

+3
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ async function prepareTestConfig(
5454
const projectTags = parseTags(options);
5555
const targetName = getFlag(options, 'target-name');
5656
const remoteRepoUrl = getFlag(options, 'remote-repo-url');
57+
const depthDetection =
58+
parseInt(getFlag(options, 'depth-detection') as string) || undefined;
5759
const attributes = parseAttributes(options);
5860
const policy = await findAndLoadPolicy(process.cwd(), 'iac', options);
5961
const scan = options.scan ?? 'resource-changes';
@@ -73,6 +75,7 @@ async function prepareTestConfig(
7375
remoteRepoUrl,
7476
policy: policy?.toString(),
7577
scan,
78+
depthDetection,
7679
};
7780
}
7881

src/lib/iac/test/v2/local-cache/policy-engine/constants/utils.ts

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import * as os from 'os';
22

3-
const policyEngineChecksums = `2b96e44012ab42e6a181a954c83af374e1bbdcb0f39782504421730615dd8b0d snyk-iac-test_0.25.0_Windows_arm64.exe
4-
6ed11a2f3fed1a382a69e5ad47eed37951490688dc0d0ea31c15b81e6022a98c snyk-iac-test_0.25.0_Linux_arm64
5-
94cf0ffdb75108f826f2df2495f579c48e016f1fc5b63f25205f79a72523930d snyk-iac-test_0.25.0_Windows_x86_64.exe
6-
af7c9d6334cb6bc2af981a950035eeca755c26a366a7142e5b3774341104a80c snyk-iac-test_0.25.0_Darwin_x86_64
7-
e6f8838f419d8639b2358d84b134d0abd2cc6c855730db5ab27464f32911d8c2 snyk-iac-test_0.25.0_Darwin_arm64
8-
e89838a2d41ebc90e4575558c09074044b3e2966494590fa13b31efe9ed3efc6 snyk-iac-test_0.25.0_Linux_x86_64
3+
const policyEngineChecksums = `104f3a8d8d1835f9621007fb7976a837ee8946510f41f7fc50323f728cebb21c snyk-iac-test_0.26.0_Darwin_arm64
4+
61bfc743d4392952eb7de3f3c4cdb6e0dfb4a491d0ca24d67c929fc3656d6c5f snyk-iac-test_0.26.0_Linux_x86_64
5+
73847b5bcc0f42cc8acd918f0dff97ee917a64ce84991785a8e6c46a6c4bc6f2 snyk-iac-test_0.26.0_Linux_arm64
6+
ac9100c8a1314a22fe7db7df8faa7d6be0aa6ba986f2db172f727fe004a0853d snyk-iac-test_0.26.0_Windows_x86_64.exe
7+
ad2983ff583989608e259441de12b6871d9e9dcb994eb81214e9dbb14d3b3dd4 snyk-iac-test_0.26.0_Darwin_x86_64
8+
c7de20ee54fd66c885e2bbe37b8c1d533464a525a5abdbc1d86a6a5c8a76b2b8 snyk-iac-test_0.26.0_Windows_arm64.exe
99
`;
1010

1111
export const policyEngineVersion = getPolicyEngineVersion();

src/lib/iac/test/v2/scan/index.ts

+4
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,10 @@ function processFlags(
113113
flags.push('-project-lifecycle', options.attributes.lifecycle.join(','));
114114
}
115115

116+
if (options.depthDetection) {
117+
flags.push('-depth-detection', `${options.depthDetection}`);
118+
}
119+
116120
if (options.projectTags) {
117121
const stringifiedTags = options.projectTags
118122
.map((tag) => {

src/lib/iac/test/v2/types.ts

+1
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,5 @@ export interface TestConfig {
1717
remoteRepoUrl?: string;
1818
policy?: string;
1919
scan: string;
20+
depthDetection?: number;
2021
}

0 commit comments

Comments
 (0)