diff --git a/ssf/defaults.yaml b/ssf/defaults.yaml index c9230953..9cbdebcb 100644 --- a/ssf/defaults.yaml +++ b/ssf/defaults.yaml @@ -62,8 +62,8 @@ ssf_node_anchors: # An alternative method could be to use: # `git describe --abbrev=0 --tags` # yamllint disable rule:line-length rule:quoted-strings - title: "chore(shellcheck): switch hook for '`'shellcheck'`' [skip ci]" - body: '* Automated using https://github.com/myii/ssf-formula/pull/295' + title: "chore(rubocop): allow use of '`'YAML.load'`' for '`'_mapdata.rb'`' [skip ci]" + body: '* Automated using https://github.com/myii/ssf-formula/pull/296' # yamllint enable rule:line-length rule:quoted-strings github: owner: 'saltstack-formulas' @@ -214,6 +214,9 @@ ssf_node_anchors: - describe Default: 25 Max: 30 + Security/YAMLLoad: + Exclude: + - 'test/integration/**/_mapdata.rb' salt_lint: {} script_kitchen: bin: 'bin/kitchen' diff --git a/ssf/files/default/.rubocop.yml b/ssf/files/default/.rubocop.yml index f63468a4..904a2507 100644 --- a/ssf/files/default/.rubocop.yml +++ b/ssf/files/default/.rubocop.yml @@ -19,6 +19,13 @@ {%- endfor %} # Increase from default of `{{ rbcp_MBL.Default }}` Max: {{ rbcp_MBL.Max }} +{%- set SYL = 'Security/YAMLLoad' %} +{{ SYL }}: + {%- set rbcp_SYL = rubocop.Cops.get(SYL) %} + Exclude: + {%- for path in rbcp_SYL.Exclude %} + - {{ path }} + {%- endfor %} {%- if rubocop.AllCops %} @@ -36,7 +43,7 @@ AllCops: {%- endif %} # Any offenses that should be fixed, e.g. collected via. `rubocop --auto-gen-config` -{%- for cop, config in rubocop.Cops.items() if cop not in [LLL, MBL] %} +{%- for cop, config in rubocop.Cops.items() if cop not in [LLL, MBL, SYL] %} {{ cop }}: {#- This is purposefully simplistic for the time being, until (if ever) more advanced configuration is necessary #} diff --git a/ssf/files/default/inspec/controls/_mapdata.rb b/ssf/files/default/inspec/controls/_mapdata.rb index e95298cc..d0e4a4dc 100644 --- a/ssf/files/default/inspec/controls/_mapdata.rb +++ b/ssf/files/default/inspec/controls/_mapdata.rb @@ -23,7 +23,7 @@ mapdata_file_path = "_mapdata/#{platform_finger}.yaml" # Load the mapdata from profile, into a YAML structure # https://docs.chef.io/inspec/profiles/#profile-files - mapdata_file_yaml = YAML.safe_load(inspec.profile.file(mapdata_file_path)) + mapdata_file_yaml = YAML.load(inspec.profile.file(mapdata_file_path)) # Dump the YAML back into a string for comparison mapdata_file_dump = YAML.dump(mapdata_file_yaml)