Skip to content

CFN Guard validate does not work correctly when entire rule file is comments #376

Closed

Description

@azhao98

Describe the bug
When running cfn-guard validate, an error "Parsing error handling rule file" is shown when you run the validate command using a rule file that only contains comments.

To Reproduce
Command: /.guard/bin/cfn-guard validate --rules test.guard --data ./cfn
Output:
Parsing error handling rule file = test.guard, Error = Parser Error when parsing Parsing Error Error parsing file test.guard at line 1 at column 1, when handling , fragment # hello

NOTE: Please be sure that the templates, rules and logs you provide as part of your bug report do not contain any sensitive information.

Expected behavior
The expected behaviour is no error. Should return nothing.

Operating System:
Ubuntu

OS Version
22.04

Additional context
test.guard file contains:
# hello

#hello there

./cfn contains:
Any YAML CFN template

Activity

  1. joshfried-aws commented on Jun 27, 2023

    @joshfried-aws
    Contributor

    Hi @azhao98 thank you for posting this. We will look into this bug and continue to update this ticket in the future.

    Thanks,

  2. joshfried-aws commented on Aug 29, 2023

    @joshfried-aws
    Contributor

    Hi @azhao98 thanks again for bringing this to our attention, as part of #402 we added functionality to not error out when a file contains only comments, or when a file is empty.

    This functionality will be available to anyone building from source, using our nightly ECR release channel or by waiting for our next stable release.

    I am going to go ahead and close out this issue for now, feel free to reopen if need be.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions