Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parsing of heredocs does not allow arbitrary strings #141

Open
edmundcraske-bjss opened this issue Jul 20, 2023 · 1 comment
Open

Parsing of heredocs does not allow arbitrary strings #141

edmundcraske-bjss opened this issue Jul 20, 2023 · 1 comment

Comments

@edmundcraske-bjss
Copy link

edmundcraske-bjss commented Jul 20, 2023

I am hitting an issue with https://github.com/bridgecrewio/checkov/ throwing a parsing error where a .tf file containing an aws_codebuild_project resource has a buildspec attribute defined using a heredoc that contains a shell script, and some of the lines in the shell script are long, and split using the \ as continuation character. In some cases there is a " opened and not closed until another line, and I am getting an unhandled exception (seen when setting LOG_LEVEL=DEBUG):

  File "/opt/homebrew/Cellar/checkov/2.3.330/libexec/lib/python3.11/site-packages/checkov/terraform/modules/module_utils.py", line 74, in load_or_die_quietly
    raw_data = hcl2.load(f)
               ^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/checkov/2.3.330/libexec/lib/python3.11/site-packages/hcl2/api.py", line 15, in load
    return loads(file.read())
           ^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/checkov/2.3.330/libexec/lib/python3.11/site-packages/hcl2/api.py", line 82, in loads
    raise ValueError(f"Line has unclosed quote marks: {line}")

But I'm not sure that the parser should even be parsing the heredoc, let alone having an issue with quotes in a bash script contained within a perfectly valid string where the Terraform code definitely works... Any suggestions?

@kapilt
Copy link

kapilt commented Aug 16, 2023

bridge crew uses a fork, not this repo fwiw.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants