I get a bunch of error when running this tool to scan a CDK project (v 2.95.1) with typescript. Is this tool even working for anyone with real project ?
starting to investigate ...
found 2 files to scan. Starting scans ...
begin cdk-nag result for stack.d.ts >>>>>>
(node:38) YAMLWarning: Keys with collection values will be stringified as YAML due to JS Object restrictions. Use mapAsMap: true to avoid this.
(Use node --trace-warnings ... to show where the warning was created)
(node:38) YAMLWarning: Keys with collection values will be stringified as YAML due to JS Object restrictions. Use mapAsMap: true to avoid this.
jsii.errors.JavaScriptError:
YAMLSyntaxError: All collection items must start at the same column
at Collection.parse (/tmp/jsii-kernel-1xSXT3/node_modules/aws-cdk-lib/node_modules/yaml/dist/parse-cst.js:331:24)
at /tmp/jsii-kernel-1xSXT3/node_modules/aws-cdk-lib/node_modules/yaml/dist/parse-cst.js:1605:29
at Document.parseContents (/tmp/jsii-kernel-1xSXT3/node_modules/aws-cdk-lib/node_modules/yaml/dist/parse-cst.js:622:26)
at Document.parse (/tmp/jsii-kernel-1xSXT3/node_modules/aws-cdk-lib/node_modules/yaml/dist/parse-cst.js:685:19)
at Object.parse (/tmp/jsii-kernel-1xSXT3/node_modules/aws-cdk-lib/node_modules/yaml/dist/parse-cst.js:1729:18)
at parseDocument (/tmp/jsii-kernel-1xSXT3/node_modules/aws-cdk-lib/node_modules/yaml/dist/index.js:43:24)
at Object.parse (/tmp/jsii-kernel-1xSXT3/node_modules/aws-cdk-lib/node_modules/yaml/dist/index.js:55:15)
at parseYamlStrWithCfnTags (/tmp/jsii-kernel-1xSXT3/node_modules/aws-cdk-lib/cloudformation-include/lib/private/yaml-cfn.js:1:1161)
at Object.deserialize (/tmp/jsii-kernel-1xSXT3/node_modules/aws-cdk-lib/cloudformation-include/lib/private/yaml-cfn.js:1:454)
at Object.readYamlSync (/tmp/jsii-kernel-1xSXT3/node_modules/aws-cdk-lib/cloudformation-include/lib/file-utils.js:1:427)
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/utils/cfn-to-cdk/app.py", line 11, in
CfnToCdkStack(app, "cfn-to-cdk")
File "/usr/local/lib/python3.9/dist-packages/jsii/_runtime.py", line 118, in call
inst = super(JSIIMeta, cast(JSIIMeta, cls)).call(*args, *kwargs)
File "/utils/cfn-to-cdk/cfn_to_cdk/cfn_to_cdk_stack.py", line 12, in init
template0 = cfn_inc.CfnInclude(self, "/app/node_modules/aws-cdk-lib/core/lib/stack.d.ts",
File "/usr/local/lib/python3.9/dist-packages/jsii/_runtime.py", line 118, in call
inst = super(JSIIMeta, cast(JSIIMeta, cls)).call(args, **kwargs)
File "/usr/local/lib/python3.9/dist-packages/aws_cdk/cloudformation_include/init.py", line 549, in init
jsii.create(self.class, self, [scope, id, props])
File "/usr/local/lib/python3.9/dist-packages/jsii/_kernel/init.py", line 334, in create
response = self.provider.create(
File "/usr/local/lib/python3.9/dist-packages/jsii/_kernel/providers/process.py", line 365, in create
return self._process.send(request, CreateResponse)
File "/usr/local/lib/python3.9/dist-packages/jsii/_kernel/providers/process.py", line 342, in send
raise RuntimeError(resp.error) from JavaScriptError(resp.stack)
RuntimeError: All collection items must start at the same column
Subprocess exited with error 1
<<<<<< end cdk-nag result for stack.d.ts <<<<<<
begin cdk-nag result for stack.js >>>>>>
jsii.errors.JavaScriptError:
YAMLSyntaxError: Document contains trailing content not separated by a ... or --- line
at parseContents (/tmp/jsii-kernel-4x7XwG/node_modules/aws-cdk-lib/node_modules/yaml/dist/Document-9b4560a1.js:353:25)
at Document.parse (/tmp/jsii-kernel-4x7XwG/node_modules/aws-cdk-lib/node_modules/yaml/dist/Document-9b4560a1.js:615:5)
at parseDocument (/tmp/jsii-kernel-4x7XwG/node_modules/aws-cdk-lib/node_modules/yaml/dist/index.js:44:37)
at Object.parse (/tmp/jsii-kernel-4x7XwG/node_modules/aws-cdk-lib/node_modules/yaml/dist/index.js:55:15)
at parseYamlStrWithCfnTags (/tmp/jsii-kernel-4x7XwG/node_modules/aws-cdk-lib/cloudformation-include/lib/private/yaml-cfn.js:1:1161)
at Object.deserialize (/tmp/jsii-kernel-4x7XwG/node_modules/aws-cdk-lib/cloudformation-include/lib/private/yaml-cfn.js:1:454)
at Object.readYamlSync (/tmp/jsii-kernel-4x7XwG/node_modules/aws-cdk-lib/cloudformation-include/lib/file-utils.js:1:427)
at new CfnInclude (/tmp/jsii-kernel-4x7XwG/node_modules/aws-cdk-lib/cloudformation-include/lib/cfn-include.js:1:1023)
at Kernel._Kernel_create (/tmp/tmpxlbmlmew/lib/program.js:10104:25)
at Kernel.create (/tmp/tmpxlbmlmew/lib/program.js:9775:93)
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/utils/cfn-to-cdk/app.py", line 11, in
CfnToCdkStack(app, "cfn-to-cdk")
File "/usr/local/lib/python3.9/dist-packages/jsii/_runtime.py", line 118, in call
inst = super(JSIIMeta, cast(JSIIMeta, cls)).call(*args, *kwargs)
File "/utils/cfn-to-cdk/cfn_to_cdk/cfn_to_cdk_stack.py", line 12, in init
template0 = cfn_inc.CfnInclude(self, "/app/node_modules/aws-cdk-lib/core/lib/stack.js",
File "/usr/local/lib/python3.9/dist-packages/jsii/_runtime.py", line 118, in call
inst = super(JSIIMeta, cast(JSIIMeta, cls)).call(args, **kwargs)
File "/usr/local/lib/python3.9/dist-packages/aws_cdk/cloudformation_include/init.py", line 549, in init
jsii.create(self.class, self, [scope, id, props])
File "/usr/local/lib/python3.9/dist-packages/jsii/_kernel/init.py", line 334, in create
response = self.provider.create(
File "/usr/local/lib/python3.9/dist-packages/jsii/_kernel/providers/process.py", line 365, in create
return self._process.send(request, CreateResponse)
File "/usr/local/lib/python3.9/dist-packages/jsii/_kernel/providers/process.py", line 342, in send
raise RuntimeError(resp.error) from JavaScriptError(resp.stack)
RuntimeError: Document contains trailing content not separated by a ... or --- line
Subprocess exited with error 1
<<<<<< end cdk-nag result for stack.js <<<<<<
Thank you @tuladp , ASH currently does not support CDK projects (it does uses CDK-nag to scan Cloudformation projects)
We will work on CDK support in the future, as for now I recommend checking cdk-nag
I get a bunch of error when running this tool to scan a CDK project (v 2.95.1) with typescript. Is this tool even working for anyone with real project ?
starting to investigate ... found 2 files to scan. Starting scans ...
The above exception was the direct cause of the following exception:
Traceback (most recent call last): File "/utils/cfn-to-cdk/app.py", line 11, in
CfnToCdkStack(app, "cfn-to-cdk")
File "/usr/local/lib/python3.9/dist-packages/jsii/_runtime.py", line 118, in call
inst = super(JSIIMeta, cast(JSIIMeta, cls)).call(*args, *kwargs)
File "/utils/cfn-to-cdk/cfn_to_cdk/cfn_to_cdk_stack.py", line 12, in init
template0 = cfn_inc.CfnInclude(self, "/app/node_modules/aws-cdk-lib/core/lib/stack.d.ts",
File "/usr/local/lib/python3.9/dist-packages/jsii/_runtime.py", line 118, in call
inst = super(JSIIMeta, cast(JSIIMeta, cls)).call(args, **kwargs)
File "/usr/local/lib/python3.9/dist-packages/aws_cdk/cloudformation_include/init.py", line 549, in init
jsii.create(self.class, self, [scope, id, props])
File "/usr/local/lib/python3.9/dist-packages/jsii/_kernel/init.py", line 334, in create
response = self.provider.create(
File "/usr/local/lib/python3.9/dist-packages/jsii/_kernel/providers/process.py", line 365, in create
return self._process.send(request, CreateResponse)
File "/usr/local/lib/python3.9/dist-packages/jsii/_kernel/providers/process.py", line 342, in send
raise RuntimeError(resp.error) from JavaScriptError(resp.stack)
RuntimeError: All collection items must start at the same column
Subprocess exited with error 1 <<<<<< end cdk-nag result for stack.d.ts <<<<<<
The above exception was the direct cause of the following exception:
Traceback (most recent call last): File "/utils/cfn-to-cdk/app.py", line 11, in
CfnToCdkStack(app, "cfn-to-cdk")
File "/usr/local/lib/python3.9/dist-packages/jsii/_runtime.py", line 118, in call
inst = super(JSIIMeta, cast(JSIIMeta, cls)).call(*args, *kwargs)
File "/utils/cfn-to-cdk/cfn_to_cdk/cfn_to_cdk_stack.py", line 12, in init
template0 = cfn_inc.CfnInclude(self, "/app/node_modules/aws-cdk-lib/core/lib/stack.js",
File "/usr/local/lib/python3.9/dist-packages/jsii/_runtime.py", line 118, in call
inst = super(JSIIMeta, cast(JSIIMeta, cls)).call(args, **kwargs)
File "/usr/local/lib/python3.9/dist-packages/aws_cdk/cloudformation_include/init.py", line 549, in init
jsii.create(self.class, self, [scope, id, props])
File "/usr/local/lib/python3.9/dist-packages/jsii/_kernel/init.py", line 334, in create
response = self.provider.create(
File "/usr/local/lib/python3.9/dist-packages/jsii/_kernel/providers/process.py", line 365, in create
return self._process.send(request, CreateResponse)
File "/usr/local/lib/python3.9/dist-packages/jsii/_kernel/providers/process.py", line 342, in send
raise RuntimeError(resp.error) from JavaScriptError(resp.stack)
RuntimeError: Document contains trailing content not separated by a ... or --- line
Subprocess exited with error 1 <<<<<< end cdk-nag result for stack.js <<<<<<