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

Issue with version 0.5.31 #416

Closed
lhgomes opened this issue Mar 21, 2020 · 1 comment · Fixed by #420
Closed

Issue with version 0.5.31 #416

lhgomes opened this issue Mar 21, 2020 · 1 comment · Fixed by #420
Assignees
Labels
bug customer Initiated from, or received feedback about from outside Stelligent
Projects

Comments

@lhgomes
Copy link

lhgomes commented Mar 21, 2020

I'm getting the following error when validating a Cloudfront distribution:

/root/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/cfn-model-0.4.23/lib/cfn-model/validator/cloudformation_validator.rb:21:in `gsub': invalid byte sequence in US-ASCII (ArgumentError)
--
182 | from /root/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/cfn-model-0.4.23/lib/cfn-model/validator/cloudformation_validator.rb:21:in `json_text?'
183 | from /root/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/cfn-model-0.4.23/lib/cfn-model/validator/cloudformation_validator.rb:9:in `validate'
184 | from /root/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/cfn-model-0.4.23/lib/cfn-model/parser/cfn_parser.rb:203:in `pre_validate_model'
185 | from /root/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/cfn-model-0.4.23/lib/cfn-model/parser/cfn_parser.rb:59:in `parse_without_parameters'
186 | from /root/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/cfn-model-0.4.23/lib/cfn-model/parser/cfn_parser.rb:43:in `parse'
187 | from /root/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/cfn-nag-0.5.31/lib/cfn-nag/cfn_nag.rb:86:in `audit'
188 | from /root/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/cfn-nag-0.5.31/lib/cfn-nag/cfn_nag_executor.rb:59:in `scan_file'
189 | from /root/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/cfn-nag-0.5.31/lib/cfn-nag/cfn_nag_executor.rb:38:in `execute_file_or_piped_scan'
190 | from /root/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/cfn-nag-0.5.31/lib/cfn-nag/cfn_nag_executor.rb:29:in `scan'
191 | from /root/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/cfn-nag-0.5.31/bin/cfn_nag:11:in `<top (required)>'
192 | from /root/.rbenv/versions/2.6.5/bin/cfn_nag:23:in `load'
193 | from /root/.rbenv/versions/2.6.5/bin/cfn_nag:23:in `<main>'

Ruby version 2.6
cfn_nag version 0.5.31

@tbuchier
Copy link

Hello,

Had same issue executing in cfn_nag in a CodeBuild (AWS CodeBuild have their default locale set to POSIX)

Fixed it with :
For Amazon Linux images :

pre_build:
  commands:
    - export LC_ALL="en_US.utf8"

For Ubuntu images :

pre_build:
  commands:
    - export LC_ALL="en_US.UTF-8"
    - locale-gen en_US en_US.UTF-8
    - dpkg-reconfigure locales

https://docs.aws.amazon.com/codebuild/latest/userguide/troubleshooting.html#troubleshooting-utf-8

@ghost ghost assigned pshelby Mar 25, 2020
pshelby pushed a commit to pshelby/cfn-model that referenced this issue Mar 25, 2020
@pshelby pshelby added bug customer Initiated from, or received feedback about from outside Stelligent labels Mar 25, 2020
@pshelby pshelby added this to To do in cfn_nag via automation Mar 25, 2020
@pshelby pshelby moved this from To do to In progress in cfn_nag Mar 25, 2020
pshelby pushed a commit to pshelby/cfn-model that referenced this issue Mar 25, 2020
pshelby pushed a commit to pshelby/cfn-model that referenced this issue Mar 25, 2020
…rse, and removing UTF-8 characters from template key names.
pshelby pushed a commit to pshelby/cfn-model that referenced this issue Mar 26, 2020
ghost pushed a commit to stelligent/cfn-model that referenced this issue Mar 26, 2020
…ncodings (#75)

* stelligent/cfn_nag#416 Adding 'ArgumentError' handler when parsing for JSON text in CFN templates.

* stelligent/cfn_nag#416 Relocating rescue statement to cover entire validation method and additional errors.

* stelligent/cfn_nag#416 Changing file read encoding to UTF-8 in cfn_parse, and removing UTF-8 characters from template key names.

* stelligent/cfn_nag#416 Adding handling of NoMethodError in references.rb in case of bad syntax.
ghost pushed a commit to stelligent/cfn-model that referenced this issue Mar 26, 2020
…pec tests (#76)

* stelligent/cfn_nag#416 Adding 'ArgumentError' handler when parsing for JSON text in CFN templates.

* stelligent/cfn_nag#416 Relocating rescue statement to cover entire validation method and additional errors.

* stelligent/cfn_nag#416 Changing file read encoding to UTF-8 in cfn_parse, and removing UTF-8 characters from template key names.

* stelligent/cfn_nag#416 Adding handling of NoMethodError in references.rb in case of bad syntax.

* Explicitly reading template as US-ASCII encoding for certain rspec tests.
pshelby pushed a commit to pshelby/cfn_nag that referenced this issue Mar 26, 2020
…rspec tests for file encodings, and upgrading version of cfn-model with dependencies.
@ghost ghost closed this as completed in #420 Mar 27, 2020
cfn_nag automation moved this from In progress to Done Mar 27, 2020
ghost pushed a commit that referenced this issue Mar 27, 2020
* Lock release-master version down to a SHA hash that contains the publish functionality to avoid issues with the latest master branch.

* #416 Setting UTF-8 encoding for cfn_nag_executor, creating rspec tests for file encodings, and upgrading version of cfn-model with dependencies.

* Adding RuboCop configuration for new Style cops.
ghost pushed a commit that referenced this issue Apr 23, 2020
* Lock release-master version down to a SHA hash that contains the publish functionality to avoid issues with the latest master branch.

* #416 Setting UTF-8 encoding for cfn_nag_executor, creating rspec tests for file encodings, and upgrading version of cfn-model with dependencies.

* Adding RuboCop configuration for new Style cops.

* Initial commit of GitHub Action code housed in the cfn_nag repo.
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug customer Initiated from, or received feedback about from outside Stelligent
Projects
cfn_nag
  
Done
Development

Successfully merging a pull request may close this issue.

3 participants