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

cfn_nag support for lastest Ruby version: Psych::DisallowedClass error #617

Open
puzzler7 opened this issue Mar 14, 2023 · 0 comments
Open

Comments

@puzzler7
Copy link

It seems that cfn_nag doesn't support Ruby 3.x - when trying to run cfn_nag_scan --input-path . with Ruby 3.2.0, I get the stack trace below, but it runs with Ruby 2.7.2. It looks like the Psych library updated the yaml loader to be more secure, and it now errors on trying to parse a date, as it's not one of the whitelisted classes.

Are there plans to update cfn_nag to support this?

$ ~/.gem/bin/cfn_nag_scan --input-path .
/snap/ruby/299/lib/ruby/3.2.0/psych/class_loader.rb:99:in `find': Tried to load unspecified class: Date (Psych::DisallowedClass)
        from /snap/ruby/299/lib/ruby/3.2.0/psych/class_loader.rb:28:in `load'
        from (eval):2:in `date'
        from /snap/ruby/299/lib/ruby/3.2.0/psych/scalar_scanner.rb:66:in `tokenize'
        from /snap/ruby/299/lib/ruby/3.2.0/psych/visitors/to_ruby.rb:65:in `deserialize'
        from /snap/ruby/299/lib/ruby/3.2.0/psych/visitors/to_ruby.rb:130:in `visit_Psych_Nodes_Scalar'
        from /snap/ruby/299/lib/ruby/3.2.0/psych/visitors/visitor.rb:30:in `visit'
        from /snap/ruby/299/lib/ruby/3.2.0/psych/visitors/visitor.rb:6:in `accept'
        from /snap/ruby/299/lib/ruby/3.2.0/psych/visitors/to_ruby.rb:35:in `accept'
        from /snap/ruby/299/lib/ruby/3.2.0/psych/visitors/to_ruby.rb:347:in `block in revive_hash'
        from /snap/ruby/299/lib/ruby/3.2.0/psych/visitors/to_ruby.rb:345:in `each'
        from /snap/ruby/299/lib/ruby/3.2.0/psych/visitors/to_ruby.rb:345:in `each_slice'
        from /snap/ruby/299/lib/ruby/3.2.0/psych/visitors/to_ruby.rb:345:in `revive_hash'
        from /snap/ruby/299/lib/ruby/3.2.0/psych/visitors/to_ruby.rb:169:in `visit_Psych_Nodes_Mapping'
        from /snap/ruby/299/lib/ruby/3.2.0/psych/visitors/visitor.rb:30:in `visit'
        from /snap/ruby/299/lib/ruby/3.2.0/psych/visitors/visitor.rb:6:in `accept'
        from /snap/ruby/299/lib/ruby/3.2.0/psych/visitors/to_ruby.rb:35:in `accept'
        from /snap/ruby/299/lib/ruby/3.2.0/psych/visitors/to_ruby.rb:320:in `visit_Psych_Nodes_Document'
        from /snap/ruby/299/lib/ruby/3.2.0/psych/visitors/visitor.rb:30:in `visit'
        from /snap/ruby/299/lib/ruby/3.2.0/psych/visitors/visitor.rb:6:in `accept'
        from /snap/ruby/299/lib/ruby/3.2.0/psych/visitors/to_ruby.rb:35:in `accept'
        from /snap/ruby/299/lib/ruby/3.2.0/psych.rb:334:in `safe_load'
        from /snap/ruby/299/lib/ruby/3.2.0/psych.rb:369:in `load'
        from /home/maverick/.gem/gems/cfn-model-0.6.6/lib/cfn-model/validator/resource_type_validator.rb:8:in `validate'
        from /home/maverick/.gem/gems/cfn-model-0.6.6/lib/cfn-model/validator/schema_generator.rb:17:in `generate'
        from /home/maverick/.gem/gems/cfn-model-0.6.6/lib/cfn-model/validator/cloudformation_validator.rb:13:in `validate'
        from /home/maverick/.gem/gems/cfn-model-0.6.6/lib/cfn-model/parser/cfn_parser.rb:220:in `pre_validate_model'
        from /home/maverick/.gem/gems/cfn-model-0.6.6/lib/cfn-model/parser/cfn_parser.rb:62:in `parse_without_parameters'
        from /home/maverick/.gem/gems/cfn-model-0.6.6/lib/cfn-model/parser/cfn_parser.rb:43:in `parse'
        from /home/maverick/.gem/gems/cfn-nag-0.8.10/lib/cfn-nag/cfn_nag.rb:87:in `audit'
        from /home/maverick/.gem/gems/cfn-nag-0.8.10/lib/cfn-nag/cfn_nag.rb:68:in `block in audit_aggregate_across_files'
        from /home/maverick/.gem/gems/cfn-nag-0.8.10/lib/cfn-nag/cfn_nag.rb:65:in `each'
        from /home/maverick/.gem/gems/cfn-nag-0.8.10/lib/cfn-nag/cfn_nag.rb:65:in `audit_aggregate_across_files'
        from /home/maverick/.gem/gems/cfn-nag-0.8.10/lib/cfn-nag/cfn_nag.rb:35:in `audit_aggregate_across_files_and_render_results'
        from /home/maverick/.gem/gems/cfn-nag-0.8.10/lib/cfn-nag/cfn_nag_executor.rb:50:in `execute_aggregate_scan'
        from /home/maverick/.gem/gems/cfn-nag-0.8.10/lib/cfn-nag/cfn_nag_executor.rb:30:in `scan'
        from /home/maverick/.gem/gems/cfn-nag-0.8.10/bin/cfn_nag_scan:11:in `<top (required)>'
        from /home/maverick/.gem/bin/cfn_nag_scan:23:in `load'
        from /home/maverick/.gem/bin/cfn_nag_scan:23:in `<main>'
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

1 participant