Open sj-versent opened 3 weeks ago
Hi @sj-versent this is not a bub, cfn-guard does not currently support aliases or anchors https://github.com/aws-cloudformation/cloudformation-guard/blob/main/guard/src/rules/libyaml/loader.rs#L54
Thanks for responding, @joshfried-aws ; it would be awesome to include that in the README if possible as I did go looking. I am happy to propose a PR if you would like.
Also note that the error code that is fired back to the user doesn't indicate that.
I'll come up with a possible workaround to strip out the aliases or anchors prior to processing. Thanks! Love the tool BTW 👍
Hey @sj-versent thats a good idea, I thought it was in there somewhere. As for the error message this is actually because all errors that result from parsing of the yaml/json are converted into a generic ParseError
https://github.com/aws-cloudformation/cloudformation-guard/blob/main/guard/src/commands/validate.rs#L769
Appreciate the love for the tool!
Describe the bug
When validating a source file of type YAML, if yaml anchors are in use then cfn-guard fails to parse the file and errors with
Error occurred Parser Error
To Reproduce
-v
log level if it's not related to cfn-guard-lambda, or the relevant CloudWatch log messages if it is related to the cfn-guard-lambdaExpected behavior
File is parsed correctly and rules triggered if appropraite
Operating System:
MacOS
OS Version
15.0.1 - Sequoia
Additional context
Commenting out the YAML anchor in the source file enables cfn-guard to process the file.