inspec 4.18.51 → 4.18.85
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/inspec.gemspec +15 -37
- data/lib/resource_support/aws/aws_resource_mixin.rb +1 -1
- metadata +22 -709
- data/Gemfile +0 -61
- data/LICENSE +0 -14
- data/README.md +0 -474
- data/etc/deprecations.json +0 -125
- data/etc/plugin_filters.json +0 -45
- data/lib/bundles/README.md +0 -3
- data/lib/bundles/inspec-compliance/api.rb +0 -7
- data/lib/bundles/inspec-compliance/configuration.rb +0 -7
- data/lib/bundles/inspec-compliance/http.rb +0 -7
- data/lib/bundles/inspec-compliance/support.rb +0 -7
- data/lib/bundles/inspec-compliance/target.rb +0 -7
- data/lib/bundles/inspec-supermarket.rb +0 -9
- data/lib/bundles/inspec-supermarket/README.md +0 -45
- data/lib/bundles/inspec-supermarket/api.rb +0 -87
- data/lib/bundles/inspec-supermarket/cli.rb +0 -71
- data/lib/bundles/inspec-supermarket/target.rb +0 -31
- data/lib/inspec.rb +0 -30
- data/lib/inspec/archive/tar.rb +0 -25
- data/lib/inspec/archive/zip.rb +0 -15
- data/lib/inspec/backend.rb +0 -101
- data/lib/inspec/base_cli.rb +0 -318
- data/lib/inspec/cached_fetcher.rb +0 -65
- data/lib/inspec/cli.rb +0 -469
- data/lib/inspec/completions/bash.sh.erb +0 -45
- data/lib/inspec/completions/fish.sh.erb +0 -34
- data/lib/inspec/completions/zsh.sh.erb +0 -61
- data/lib/inspec/config.rb +0 -511
- data/lib/inspec/control_eval_context.rb +0 -248
- data/lib/inspec/dependencies/cache.rb +0 -74
- data/lib/inspec/dependencies/dependency_set.rb +0 -93
- data/lib/inspec/dependencies/lockfile.rb +0 -115
- data/lib/inspec/dependencies/requirement.rb +0 -135
- data/lib/inspec/dependencies/resolver.rb +0 -86
- data/lib/inspec/describe_base.rb +0 -53
- data/lib/inspec/dist.rb +0 -20
- data/lib/inspec/dsl.rb +0 -115
- data/lib/inspec/dsl_shared.rb +0 -32
- data/lib/inspec/env_printer.rb +0 -156
- data/lib/inspec/errors.rb +0 -18
- data/lib/inspec/exceptions.rb +0 -11
- data/lib/inspec/expect.rb +0 -42
- data/lib/inspec/fetcher.rb +0 -48
- data/lib/inspec/fetcher/git.rb +0 -211
- data/lib/inspec/fetcher/local.rb +0 -116
- data/lib/inspec/fetcher/mock.rb +0 -34
- data/lib/inspec/fetcher/url.rb +0 -281
- data/lib/inspec/file_provider.rb +0 -318
- data/lib/inspec/formatters.rb +0 -3
- data/lib/inspec/formatters/base.rb +0 -269
- data/lib/inspec/formatters/json_rspec.rb +0 -20
- data/lib/inspec/formatters/show_progress.rb +0 -12
- data/lib/inspec/globals.rb +0 -9
- data/lib/inspec/impact.rb +0 -36
- data/lib/inspec/input.rb +0 -421
- data/lib/inspec/input_dsl_helpers.rb +0 -26
- data/lib/inspec/input_registry.rb +0 -315
- data/lib/inspec/library_eval_context.rb +0 -55
- data/lib/inspec/log.rb +0 -7
- data/lib/inspec/metadata.rb +0 -253
- data/lib/inspec/method_source.rb +0 -20
- data/lib/inspec/objects.rb +0 -14
- data/lib/inspec/objects/control.rb +0 -85
- data/lib/inspec/objects/describe.rb +0 -106
- data/lib/inspec/objects/each_loop.rb +0 -41
- data/lib/inspec/objects/input.rb +0 -49
- data/lib/inspec/objects/list.rb +0 -15
- data/lib/inspec/objects/or_test.rb +0 -45
- data/lib/inspec/objects/ruby_helper.rb +0 -13
- data/lib/inspec/objects/tag.rb +0 -32
- data/lib/inspec/objects/test.rb +0 -94
- data/lib/inspec/objects/value.rb +0 -32
- data/lib/inspec/plugin/v1.rb +0 -2
- data/lib/inspec/plugin/v1/plugin_types/cli.rb +0 -22
- data/lib/inspec/plugin/v1/plugin_types/fetcher.rb +0 -83
- data/lib/inspec/plugin/v1/plugin_types/resource.rb +0 -176
- data/lib/inspec/plugin/v1/plugin_types/secret.rb +0 -11
- data/lib/inspec/plugin/v1/plugin_types/source_reader.rb +0 -36
- data/lib/inspec/plugin/v1/plugins.rb +0 -59
- data/lib/inspec/plugin/v1/registry.rb +0 -90
- data/lib/inspec/plugin/v2.rb +0 -46
- data/lib/inspec/plugin/v2/activator.rb +0 -40
- data/lib/inspec/plugin/v2/config_file.rb +0 -151
- data/lib/inspec/plugin/v2/filter.rb +0 -96
- data/lib/inspec/plugin/v2/installer.rb +0 -512
- data/lib/inspec/plugin/v2/loader.rb +0 -321
- data/lib/inspec/plugin/v2/plugin_base.rb +0 -112
- data/lib/inspec/plugin/v2/plugin_types/cli.rb +0 -49
- data/lib/inspec/plugin/v2/plugin_types/dsl.rb +0 -11
- data/lib/inspec/plugin/v2/plugin_types/input.rb +0 -34
- data/lib/inspec/plugin/v2/plugin_types/mock.rb +0 -12
- data/lib/inspec/plugin/v2/registry.rb +0 -98
- data/lib/inspec/plugin/v2/status.rb +0 -29
- data/lib/inspec/profile.rb +0 -658
- data/lib/inspec/profile_context.rb +0 -203
- data/lib/inspec/profile_vendor.rb +0 -84
- data/lib/inspec/reporters.rb +0 -73
- data/lib/inspec/reporters/automate.rb +0 -78
- data/lib/inspec/reporters/base.rb +0 -25
- data/lib/inspec/reporters/cli.rb +0 -370
- data/lib/inspec/reporters/json.rb +0 -113
- data/lib/inspec/reporters/json_automate.rb +0 -80
- data/lib/inspec/reporters/json_min.rb +0 -48
- data/lib/inspec/reporters/junit.rb +0 -77
- data/lib/inspec/reporters/yaml.rb +0 -20
- data/lib/inspec/require_loader.rb +0 -29
- data/lib/inspec/resource.rb +0 -114
- data/lib/inspec/resources.rb +0 -130
- data/lib/inspec/resources/aide_conf.rb +0 -153
- data/lib/inspec/resources/apache.rb +0 -47
- data/lib/inspec/resources/apache_conf.rb +0 -156
- data/lib/inspec/resources/apt.rb +0 -151
- data/lib/inspec/resources/audit_policy.rb +0 -64
- data/lib/inspec/resources/auditd.rb +0 -251
- data/lib/inspec/resources/auditd_conf.rb +0 -45
- data/lib/inspec/resources/bash.rb +0 -33
- data/lib/inspec/resources/bond.rb +0 -70
- data/lib/inspec/resources/bridge.rb +0 -125
- data/lib/inspec/resources/bsd_service.rb +0 -2
- data/lib/inspec/resources/chocolatey_package.rb +0 -82
- data/lib/inspec/resources/command.rb +0 -91
- data/lib/inspec/resources/cpan.rb +0 -58
- data/lib/inspec/resources/cran.rb +0 -64
- data/lib/inspec/resources/crontab.rb +0 -173
- data/lib/inspec/resources/csv.rb +0 -56
- data/lib/inspec/resources/dh_params.rb +0 -83
- data/lib/inspec/resources/directory.rb +0 -23
- data/lib/inspec/resources/docker.rb +0 -274
- data/lib/inspec/resources/docker_container.rb +0 -91
- data/lib/inspec/resources/docker_image.rb +0 -84
- data/lib/inspec/resources/docker_object.rb +0 -52
- data/lib/inspec/resources/docker_plugin.rb +0 -64
- data/lib/inspec/resources/docker_service.rb +0 -91
- data/lib/inspec/resources/elasticsearch.rb +0 -165
- data/lib/inspec/resources/etc_fstab.rb +0 -96
- data/lib/inspec/resources/etc_group.rb +0 -157
- data/lib/inspec/resources/etc_hosts.rb +0 -68
- data/lib/inspec/resources/etc_hosts_allow.rb +0 -2
- data/lib/inspec/resources/etc_hosts_allow_deny.rb +0 -114
- data/lib/inspec/resources/etc_hosts_deny.rb +0 -2
- data/lib/inspec/resources/file.rb +0 -339
- data/lib/inspec/resources/filesystem.rb +0 -139
- data/lib/inspec/resources/firewalld.rb +0 -148
- data/lib/inspec/resources/gem.rb +0 -80
- data/lib/inspec/resources/group.rb +0 -2
- data/lib/inspec/resources/groups.rb +0 -241
- data/lib/inspec/resources/grub_conf.rb +0 -230
- data/lib/inspec/resources/host.rb +0 -310
- data/lib/inspec/resources/http.rb +0 -275
- data/lib/inspec/resources/iis_app.rb +0 -101
- data/lib/inspec/resources/iis_app_pool.rb +0 -127
- data/lib/inspec/resources/iis_site.rb +0 -148
- data/lib/inspec/resources/iis_website.rb +0 -2
- data/lib/inspec/resources/inetd_conf.rb +0 -53
- data/lib/inspec/resources/ini.rb +0 -28
- data/lib/inspec/resources/interface.rb +0 -204
- data/lib/inspec/resources/ip6tables.rb +0 -79
- data/lib/inspec/resources/iptables.rb +0 -80
- data/lib/inspec/resources/json.rb +0 -116
- data/lib/inspec/resources/kernel_module.rb +0 -106
- data/lib/inspec/resources/kernel_parameter.rb +0 -54
- data/lib/inspec/resources/key_rsa.rb +0 -66
- data/lib/inspec/resources/ksh.rb +0 -33
- data/lib/inspec/resources/launchd_service.rb +0 -2
- data/lib/inspec/resources/limits_conf.rb +0 -45
- data/lib/inspec/resources/linux_kernel_parameter.rb +0 -2
- data/lib/inspec/resources/login_defs.rb +0 -56
- data/lib/inspec/resources/mount.rb +0 -88
- data/lib/inspec/resources/mssql_session.rb +0 -117
- data/lib/inspec/resources/mysql.rb +0 -81
- data/lib/inspec/resources/mysql_conf.rb +0 -128
- data/lib/inspec/resources/mysql_session.rb +0 -88
- data/lib/inspec/resources/nginx.rb +0 -96
- data/lib/inspec/resources/nginx_conf.rb +0 -232
- data/lib/inspec/resources/noop.rb +0 -9
- data/lib/inspec/resources/npm.rb +0 -68
- data/lib/inspec/resources/ntp_conf.rb +0 -51
- data/lib/inspec/resources/oneget.rb +0 -71
- data/lib/inspec/resources/oracledb_session.rb +0 -149
- data/lib/inspec/resources/os.rb +0 -34
- data/lib/inspec/resources/os_env.rb +0 -86
- data/lib/inspec/resources/package.rb +0 -391
- data/lib/inspec/resources/packages.rb +0 -111
- data/lib/inspec/resources/parse_config.rb +0 -112
- data/lib/inspec/resources/parse_config_file.rb +0 -2
- data/lib/inspec/resources/passwd.rb +0 -73
- data/lib/inspec/resources/pip.rb +0 -132
- data/lib/inspec/resources/platform.rb +0 -112
- data/lib/inspec/resources/port.rb +0 -791
- data/lib/inspec/resources/postfix_conf.rb +0 -35
- data/lib/inspec/resources/postgres.rb +0 -152
- data/lib/inspec/resources/postgres_conf.rb +0 -116
- data/lib/inspec/resources/postgres_hba_conf.rb +0 -86
- data/lib/inspec/resources/postgres_ident_conf.rb +0 -75
- data/lib/inspec/resources/postgres_session.rb +0 -70
- data/lib/inspec/resources/powershell.rb +0 -67
- data/lib/inspec/resources/ppa.rb +0 -2
- data/lib/inspec/resources/processes.rb +0 -219
- data/lib/inspec/resources/rabbitmq_conf.rb +0 -2
- data/lib/inspec/resources/rabbitmq_config.rb +0 -52
- data/lib/inspec/resources/registry_key.rb +0 -296
- data/lib/inspec/resources/runit_service.rb +0 -2
- data/lib/inspec/resources/script.rb +0 -1
- data/lib/inspec/resources/security_identifier.rb +0 -91
- data/lib/inspec/resources/security_policy.rb +0 -182
- data/lib/inspec/resources/service.rb +0 -820
- data/lib/inspec/resources/shadow.rb +0 -150
- data/lib/inspec/resources/ssh_config.rb +0 -98
- data/lib/inspec/resources/sshd_config.rb +0 -2
- data/lib/inspec/resources/ssl.rb +0 -99
- data/lib/inspec/resources/sys_info.rb +0 -119
- data/lib/inspec/resources/systemd_service.rb +0 -2
- data/lib/inspec/resources/sysv_service.rb +0 -2
- data/lib/inspec/resources/toml.rb +0 -30
- data/lib/inspec/resources/upstart_service.rb +0 -2
- data/lib/inspec/resources/user.rb +0 -1
- data/lib/inspec/resources/users.rb +0 -742
- data/lib/inspec/resources/vbscript.rb +0 -67
- data/lib/inspec/resources/virtualization.rb +0 -255
- data/lib/inspec/resources/windows_feature.rb +0 -126
- data/lib/inspec/resources/windows_hotfix.rb +0 -37
- data/lib/inspec/resources/windows_registry_key.rb +0 -2
- data/lib/inspec/resources/windows_task.rb +0 -112
- data/lib/inspec/resources/wmi.rb +0 -109
- data/lib/inspec/resources/x509_certificate.rb +0 -143
- data/lib/inspec/resources/xinetd_conf.rb +0 -103
- data/lib/inspec/resources/xml.rb +0 -48
- data/lib/inspec/resources/yaml.rb +0 -42
- data/lib/inspec/resources/yum.rb +0 -162
- data/lib/inspec/resources/zfs_dataset.rb +0 -62
- data/lib/inspec/resources/zfs_pool.rb +0 -50
- data/lib/inspec/rspec_extensions.rb +0 -116
- data/lib/inspec/rule.rb +0 -389
- data/lib/inspec/runner.rb +0 -333
- data/lib/inspec/runner_mock.rb +0 -37
- data/lib/inspec/runner_rspec.rb +0 -184
- data/lib/inspec/runtime_profile.rb +0 -23
- data/lib/inspec/schema.rb +0 -245
- data/lib/inspec/secrets.rb +0 -15
- data/lib/inspec/secrets/yaml.rb +0 -29
- data/lib/inspec/shell.rb +0 -211
- data/lib/inspec/shell_detector.rb +0 -89
- data/lib/inspec/source_reader.rb +0 -26
- data/lib/inspec/ui.rb +0 -213
- data/lib/inspec/ui_table_helper.rb +0 -12
- data/lib/inspec/utils/command_wrapper.rb +0 -23
- data/lib/inspec/utils/convert.rb +0 -8
- data/lib/inspec/utils/database_helpers.rb +0 -75
- data/lib/inspec/utils/deprecation.rb +0 -6
- data/lib/inspec/utils/deprecation/config_file.rb +0 -109
- data/lib/inspec/utils/deprecation/deprecator.rb +0 -118
- data/lib/inspec/utils/deprecation/errors.rb +0 -14
- data/lib/inspec/utils/deprecation/global_method.rb +0 -9
- data/lib/inspec/utils/enumerable_delegation.rb +0 -7
- data/lib/inspec/utils/erlang_parser.rb +0 -190
- data/lib/inspec/utils/file_reader.rb +0 -24
- data/lib/inspec/utils/filter.rb +0 -461
- data/lib/inspec/utils/filter_array.rb +0 -25
- data/lib/inspec/utils/find_files.rb +0 -44
- data/lib/inspec/utils/hash.rb +0 -37
- data/lib/inspec/utils/json_log.rb +0 -15
- data/lib/inspec/utils/modulator.rb +0 -9
- data/lib/inspec/utils/nginx_parser.rb +0 -101
- data/lib/inspec/utils/object_traversal.rb +0 -47
- data/lib/inspec/utils/parser.rb +0 -277
- data/lib/inspec/utils/pkey_reader.rb +0 -17
- data/lib/inspec/utils/simpleconfig.rb +0 -121
- data/lib/inspec/utils/spdx.rb +0 -10
- data/lib/inspec/utils/spdx.txt +0 -383
- data/lib/inspec/utils/telemetry.rb +0 -3
- data/lib/inspec/utils/telemetry/collector.rb +0 -81
- data/lib/inspec/utils/telemetry/data_series.rb +0 -44
- data/lib/inspec/utils/telemetry/global_methods.rb +0 -22
- data/lib/inspec/version.rb +0 -3
- data/lib/matchers/matchers.rb +0 -341
- data/lib/plugins/README.md +0 -16
- data/lib/plugins/inspec-artifact/lib/inspec-artifact.rb +0 -12
- data/lib/plugins/inspec-artifact/lib/inspec-artifact/base.rb +0 -170
- data/lib/plugins/inspec-artifact/lib/inspec-artifact/cli.rb +0 -116
- data/lib/plugins/inspec-artifact/test/functional/inspec_artifact_test.rb +0 -50
- data/lib/plugins/inspec-compliance/README.md +0 -207
- data/lib/plugins/inspec-compliance/lib/inspec-compliance.rb +0 -12
- data/lib/plugins/inspec-compliance/lib/inspec-compliance/api.rb +0 -362
- data/lib/plugins/inspec-compliance/lib/inspec-compliance/api/login.rb +0 -198
- data/lib/plugins/inspec-compliance/lib/inspec-compliance/cli.rb +0 -269
- data/lib/plugins/inspec-compliance/lib/inspec-compliance/configuration.rb +0 -103
- data/lib/plugins/inspec-compliance/lib/inspec-compliance/http.rb +0 -117
- data/lib/plugins/inspec-compliance/lib/inspec-compliance/images/cc-token.png +0 -0
- data/lib/plugins/inspec-compliance/lib/inspec-compliance/support.rb +0 -34
- data/lib/plugins/inspec-compliance/lib/inspec-compliance/target.rb +0 -146
- data/lib/plugins/inspec-compliance/test/functional/inspec_compliance_test.rb +0 -53
- data/lib/plugins/inspec-compliance/test/integration/default/cli.rb +0 -91
- data/lib/plugins/inspec-compliance/test/unit/api/login_test.rb +0 -190
- data/lib/plugins/inspec-compliance/test/unit/api_test.rb +0 -386
- data/lib/plugins/inspec-compliance/test/unit/target_test.rb +0 -155
- data/lib/plugins/inspec-habitat/Berksfile +0 -5
- data/lib/plugins/inspec-habitat/README.md +0 -150
- data/lib/plugins/inspec-habitat/kitchen.yml +0 -28
- data/lib/plugins/inspec-habitat/lib/inspec-habitat.rb +0 -11
- data/lib/plugins/inspec-habitat/lib/inspec-habitat/cli.rb +0 -41
- data/lib/plugins/inspec-habitat/lib/inspec-habitat/profile.rb +0 -265
- data/lib/plugins/inspec-habitat/templates/habitat/plan.sh.erb +0 -6
- data/lib/plugins/inspec-habitat/test/cookbooks/inspec_habitat_fixture/Berksfile +0 -2
- data/lib/plugins/inspec-habitat/test/cookbooks/inspec_habitat_fixture/README.md +0 -3
- data/lib/plugins/inspec-habitat/test/cookbooks/inspec_habitat_fixture/files/hab_setup.exp +0 -28
- data/lib/plugins/inspec-habitat/test/cookbooks/inspec_habitat_fixture/metadata.rb +0 -9
- data/lib/plugins/inspec-habitat/test/cookbooks/inspec_habitat_fixture/recipes/default.rb +0 -61
- data/lib/plugins/inspec-habitat/test/functional/inspec_habitat_test.rb +0 -34
- data/lib/plugins/inspec-habitat/test/integration/default/inspec_habitat/README.md +0 -3
- data/lib/plugins/inspec-habitat/test/integration/default/inspec_habitat/controls/inspec_habitat.rb +0 -40
- data/lib/plugins/inspec-habitat/test/integration/default/inspec_habitat/inspec.yml +0 -10
- data/lib/plugins/inspec-habitat/test/support/example_profile/README.md +0 -3
- data/lib/plugins/inspec-habitat/test/support/example_profile/controls/example.rb +0 -7
- data/lib/plugins/inspec-habitat/test/support/example_profile/inspec.yml +0 -10
- data/lib/plugins/inspec-habitat/test/unit/profile_test.rb +0 -242
- data/lib/plugins/inspec-init/README.md +0 -31
- data/lib/plugins/inspec-init/lib/inspec-init.rb +0 -12
- data/lib/plugins/inspec-init/lib/inspec-init/cli.rb +0 -15
- data/lib/plugins/inspec-init/lib/inspec-init/cli_plugin.rb +0 -243
- data/lib/plugins/inspec-init/lib/inspec-init/cli_profile.rb +0 -47
- data/lib/plugins/inspec-init/lib/inspec-init/renderer.rb +0 -97
- data/lib/plugins/inspec-init/templates/plugins/inspec-plugin-template/Gemfile +0 -11
- data/lib/plugins/inspec-init/templates/plugins/inspec-plugin-template/LICENSE +0 -2
- data/lib/plugins/inspec-init/templates/plugins/inspec-plugin-template/README.md +0 -28
- data/lib/plugins/inspec-init/templates/plugins/inspec-plugin-template/Rakefile +0 -40
- data/lib/plugins/inspec-init/templates/plugins/inspec-plugin-template/lib/inspec-plugin-template.rb +0 -14
- data/lib/plugins/inspec-init/templates/plugins/inspec-plugin-template/lib/inspec-plugin-template/cli_command.rb +0 -62
- data/lib/plugins/inspec-init/templates/plugins/inspec-plugin-template/lib/inspec-plugin-template/plugin.rb +0 -53
- data/lib/plugins/inspec-init/templates/plugins/inspec-plugin-template/lib/inspec-plugin-template/version.rb +0 -8
- data/lib/plugins/inspec-init/templates/plugins/inspec-plugin-template/test/fixtures/README.md +0 -24
- data/lib/plugins/inspec-init/templates/plugins/inspec-plugin-template/test/functional/README.md +0 -12
- data/lib/plugins/inspec-init/templates/plugins/inspec-plugin-template/test/functional/inspec_plugin_template_test.rb +0 -110
- data/lib/plugins/inspec-init/templates/plugins/inspec-plugin-template/test/helper.rb +0 -24
- data/lib/plugins/inspec-init/templates/plugins/inspec-plugin-template/test/unit/README.md +0 -17
- data/lib/plugins/inspec-init/templates/plugins/inspec-plugin-template/test/unit/cli_args_test.rb +0 -67
- data/lib/plugins/inspec-init/templates/plugins/inspec-plugin-template/test/unit/plugin_def_test.rb +0 -51
- data/lib/plugins/inspec-init/templates/profiles/aws/libraries/.gitkeep +0 -0
- data/lib/plugins/inspec-init/templates/profiles/azure/libraries/.gitkeep +0 -0
- data/lib/plugins/inspec-init/templates/profiles/gcp/libraries/.gitkeep +0 -0
- data/lib/plugins/inspec-init/templates/profiles/os/README.md +0 -3
- data/lib/plugins/inspec-init/templates/profiles/os/controls/example.rb +0 -18
- data/lib/plugins/inspec-init/templates/profiles/os/inspec.yml +0 -10
- data/lib/plugins/inspec-init/templates/profiles/os/libraries/.gitkeep +0 -0
- data/lib/plugins/inspec-init/test/functional/inspec_init_plugin_test.rb +0 -184
- data/lib/plugins/inspec-init/test/functional/inspec_init_profile_test.rb +0 -121
- data/lib/plugins/inspec-plugin-manager-cli/README.md +0 -6
- data/lib/plugins/inspec-plugin-manager-cli/lib/inspec-plugin-manager-cli.rb +0 -17
- data/lib/plugins/inspec-plugin-manager-cli/lib/inspec-plugin-manager-cli/cli_command.rb +0 -518
- data/lib/plugins/inspec-plugin-manager-cli/lib/inspec-plugin-manager-cli/plugin.rb +0 -12
- data/lib/plugins/inspec-plugin-manager-cli/test/fixtures/config_dirs/empty/.gitkeep +0 -0
- data/lib/plugins/inspec-plugin-manager-cli/test/fixtures/plugins/inspec-egg-white-omelette/lib/inspec-egg-white-omelette.rb +0 -2
- data/lib/plugins/inspec-plugin-manager-cli/test/fixtures/plugins/inspec-egg-white-omelette/lib/inspec-egg-white-omelette/.gitkeep +0 -0
- data/lib/plugins/inspec-plugin-manager-cli/test/fixtures/plugins/inspec-wrong-structure/.gitkeep +0 -0
- data/lib/plugins/inspec-plugin-manager-cli/test/fixtures/plugins/wrong-name/lib/wrong-name.rb +0 -1
- data/lib/plugins/inspec-plugin-manager-cli/test/fixtures/plugins/wrong-name/lib/wrong-name/.gitkeep +0 -0
- data/lib/plugins/inspec-plugin-manager-cli/test/functional/help_test.rb +0 -23
- data/lib/plugins/inspec-plugin-manager-cli/test/functional/helper.rb +0 -62
- data/lib/plugins/inspec-plugin-manager-cli/test/functional/install_test.rb +0 -368
- data/lib/plugins/inspec-plugin-manager-cli/test/functional/list_test.rb +0 -101
- data/lib/plugins/inspec-plugin-manager-cli/test/functional/search_test.rb +0 -129
- data/lib/plugins/inspec-plugin-manager-cli/test/functional/uninstall_test.rb +0 -63
- data/lib/plugins/inspec-plugin-manager-cli/test/functional/update_test.rb +0 -84
- data/lib/plugins/inspec-plugin-manager-cli/test/unit/cli_args_test.rb +0 -77
- data/lib/plugins/inspec-plugin-manager-cli/test/unit/plugin_def_test.rb +0 -39
- data/lib/plugins/shared/core_plugin_test_helper.rb +0 -153
- data/lib/plugins/things-for-train-integration.rb +0 -14
- data/lib/source_readers/flat.rb +0 -36
- data/lib/source_readers/inspec.rb +0 -66
data/lib/inspec/reporters/cli.rb
DELETED
@@ -1,370 +0,0 @@
|
|
1
|
-
module Inspec::Reporters
|
2
|
-
class CLI < Base
|
3
|
-
case RUBY_PLATFORM
|
4
|
-
when /windows|mswin|msys|mingw|cygwin/
|
5
|
-
# Most currently available Windows terminals have poor support
|
6
|
-
# for ANSI extended colors
|
7
|
-
COLORS = {
|
8
|
-
"failed" => "\033[0;1;31m",
|
9
|
-
"passed" => "\033[0;1;32m",
|
10
|
-
"skipped" => "\033[0;37m",
|
11
|
-
"reset" => "\033[0m",
|
12
|
-
}.freeze
|
13
|
-
|
14
|
-
# Most currently available Windows terminals have poor support
|
15
|
-
# for UTF-8 characters so use these boring indicators
|
16
|
-
INDICATORS = {
|
17
|
-
"failed" => "[FAIL]",
|
18
|
-
"skipped" => "[SKIP]",
|
19
|
-
"passed" => "[PASS]",
|
20
|
-
"unknown" => "[UNKN]",
|
21
|
-
}.freeze
|
22
|
-
else
|
23
|
-
# Extended colors for everyone else
|
24
|
-
COLORS = {
|
25
|
-
"failed" => "\033[38;5;9m",
|
26
|
-
"passed" => "\033[38;5;41m",
|
27
|
-
"skipped" => "\033[38;5;247m",
|
28
|
-
"reset" => "\033[0m",
|
29
|
-
}.freeze
|
30
|
-
|
31
|
-
# Groovy UTF-8 characters for everyone else...
|
32
|
-
# ...even though they probably only work on Mac
|
33
|
-
INDICATORS = {
|
34
|
-
"failed" => "×",
|
35
|
-
"skipped" => "↺",
|
36
|
-
"passed" => "✔",
|
37
|
-
"unknown" => "?",
|
38
|
-
}.freeze
|
39
|
-
end
|
40
|
-
|
41
|
-
MULTI_TEST_CONTROL_SUMMARY_MAX_LEN = 60
|
42
|
-
|
43
|
-
def render
|
44
|
-
run_data[:profiles].each do |profile|
|
45
|
-
if profile[:status] == "skipped"
|
46
|
-
platform = run_data[:platform]
|
47
|
-
output("Skipping profile: '#{profile[:name]}' on unsupported platform: '#{platform[:name]}/#{platform[:release]}'.")
|
48
|
-
next
|
49
|
-
end
|
50
|
-
@control_count = 0
|
51
|
-
output("")
|
52
|
-
print_profile_header(profile)
|
53
|
-
print_standard_control_results(profile)
|
54
|
-
print_anonymous_control_results(profile)
|
55
|
-
if @control_count == 0
|
56
|
-
output(format_message(
|
57
|
-
indentation: 5,
|
58
|
-
message: "No tests executed."
|
59
|
-
))
|
60
|
-
end
|
61
|
-
end
|
62
|
-
|
63
|
-
output("")
|
64
|
-
print_profile_summary
|
65
|
-
print_tests_summary
|
66
|
-
end
|
67
|
-
|
68
|
-
private
|
69
|
-
|
70
|
-
def print_profile_header(profile)
|
71
|
-
header = {
|
72
|
-
"Profile" => format_profile_name(profile),
|
73
|
-
"Version" => profile[:version] || "(not specified)",
|
74
|
-
}
|
75
|
-
header["Target"] = run_data[:platform][:target] unless run_data[:platform][:target].nil?
|
76
|
-
header["Target ID"] = @config["target_id"] unless @config["target_id"].nil?
|
77
|
-
|
78
|
-
pad = header.keys.max_by(&:length).length + 1
|
79
|
-
header.each do |title, value|
|
80
|
-
output(format("%-#{pad}s %s", title + ":", value))
|
81
|
-
end
|
82
|
-
output("")
|
83
|
-
end
|
84
|
-
|
85
|
-
def print_standard_control_results(profile)
|
86
|
-
standard_controls_from_profile(profile).each do |control_from_profile|
|
87
|
-
control = Control.new(control_from_profile)
|
88
|
-
next if control.results.nil?
|
89
|
-
|
90
|
-
output(format_control_header(control))
|
91
|
-
control.results.each do |result|
|
92
|
-
output(format_result(control, result, :standard))
|
93
|
-
@control_count += 1
|
94
|
-
end
|
95
|
-
end
|
96
|
-
output("") if @control_count > 0
|
97
|
-
end
|
98
|
-
|
99
|
-
def print_anonymous_control_results(profile)
|
100
|
-
anonymous_controls_from_profile(profile).each do |control_from_profile|
|
101
|
-
control = Control.new(control_from_profile)
|
102
|
-
next if control.results.nil?
|
103
|
-
|
104
|
-
output(format_control_header(control))
|
105
|
-
control.results.each do |result|
|
106
|
-
output(format_result(control, result, :anonymous))
|
107
|
-
@control_count += 1
|
108
|
-
end
|
109
|
-
end
|
110
|
-
end
|
111
|
-
|
112
|
-
def format_profile_name(profile)
|
113
|
-
if profile[:title].nil?
|
114
|
-
(profile[:name] || "unknown").to_s
|
115
|
-
else
|
116
|
-
"#{profile[:title]} (#{profile[:name] || "unknown"})"
|
117
|
-
end
|
118
|
-
end
|
119
|
-
|
120
|
-
def format_control_header(control)
|
121
|
-
impact = control.impact_string
|
122
|
-
format_message(
|
123
|
-
color: impact,
|
124
|
-
indicator: impact,
|
125
|
-
message: control.title_for_report
|
126
|
-
)
|
127
|
-
end
|
128
|
-
|
129
|
-
def format_result(control, result, type)
|
130
|
-
impact = control.impact_string_for_result(result)
|
131
|
-
|
132
|
-
message = if result[:status] == "skipped"
|
133
|
-
result[:skip_message]
|
134
|
-
elsif type == :anonymous
|
135
|
-
result[:expectation_message]
|
136
|
-
else
|
137
|
-
result[:code_desc]
|
138
|
-
end
|
139
|
-
|
140
|
-
# append any failure details to the message if they exist
|
141
|
-
message += "\n#{result[:message]}" if result[:message]
|
142
|
-
|
143
|
-
format_message(
|
144
|
-
color: impact,
|
145
|
-
indicator: impact,
|
146
|
-
indentation: 5,
|
147
|
-
message: message
|
148
|
-
)
|
149
|
-
end
|
150
|
-
|
151
|
-
def format_message(message_info)
|
152
|
-
indicator = message_info[:indicator]
|
153
|
-
color = message_info[:color]
|
154
|
-
indentation = message_info.fetch(:indentation, 2)
|
155
|
-
message = message_info[:message]
|
156
|
-
|
157
|
-
message_to_format = ""
|
158
|
-
message_to_format += "#{INDICATORS[indicator]} " unless indicator.nil?
|
159
|
-
message_to_format += message.to_s.lstrip.force_encoding(Encoding::UTF_8)
|
160
|
-
|
161
|
-
format_with_color(color, indent_lines(message_to_format, indentation))
|
162
|
-
end
|
163
|
-
|
164
|
-
def format_with_color(color_name, text)
|
165
|
-
return text if defined?(RSpec.configuration) && !RSpec.configuration.color
|
166
|
-
return text unless COLORS.key?(color_name)
|
167
|
-
|
168
|
-
"#{COLORS[color_name]}#{text}#{COLORS["reset"]}"
|
169
|
-
end
|
170
|
-
|
171
|
-
def all_unique_controls
|
172
|
-
@unique_controls ||= begin
|
173
|
-
run_data[:profiles].flat_map do |profile|
|
174
|
-
profile[:controls]
|
175
|
-
end.uniq
|
176
|
-
end
|
177
|
-
end
|
178
|
-
|
179
|
-
def profile_summary
|
180
|
-
failed = 0
|
181
|
-
skipped = 0
|
182
|
-
passed = 0
|
183
|
-
|
184
|
-
all_unique_controls.each do |control|
|
185
|
-
next if control[:id].start_with? "(generated from "
|
186
|
-
next unless control[:results]
|
187
|
-
|
188
|
-
if control[:results].any? { |r| r[:status] == "failed" }
|
189
|
-
failed += 1
|
190
|
-
elsif control[:results].any? { |r| r[:status] == "skipped" }
|
191
|
-
skipped += 1
|
192
|
-
else
|
193
|
-
passed += 1
|
194
|
-
end
|
195
|
-
end
|
196
|
-
|
197
|
-
total = failed + passed + skipped
|
198
|
-
|
199
|
-
{
|
200
|
-
"total" => total,
|
201
|
-
"failed" => failed,
|
202
|
-
"skipped" => skipped,
|
203
|
-
"passed" => passed,
|
204
|
-
}
|
205
|
-
end
|
206
|
-
|
207
|
-
def tests_summary
|
208
|
-
total = 0
|
209
|
-
failed = 0
|
210
|
-
skipped = 0
|
211
|
-
passed = 0
|
212
|
-
|
213
|
-
all_unique_controls.each do |control|
|
214
|
-
next unless control[:results]
|
215
|
-
|
216
|
-
control[:results].each do |result|
|
217
|
-
if result[:status] == "failed"
|
218
|
-
failed += 1
|
219
|
-
elsif result[:status] == "skipped"
|
220
|
-
skipped += 1
|
221
|
-
else
|
222
|
-
passed += 1
|
223
|
-
end
|
224
|
-
end
|
225
|
-
end
|
226
|
-
|
227
|
-
{
|
228
|
-
"total" => total,
|
229
|
-
"failed" => failed,
|
230
|
-
"skipped" => skipped,
|
231
|
-
"passed" => passed,
|
232
|
-
}
|
233
|
-
end
|
234
|
-
|
235
|
-
def print_profile_summary
|
236
|
-
summary = profile_summary
|
237
|
-
return unless summary["total"] > 0
|
238
|
-
|
239
|
-
success_str = summary["passed"] == 1 ? "1 successful control" : "#{summary["passed"]} successful controls"
|
240
|
-
failed_str = summary["failed"] == 1 ? "1 control failure" : "#{summary["failed"]} control failures"
|
241
|
-
skipped_str = summary["skipped"] == 1 ? "1 control skipped" : "#{summary["skipped"]} controls skipped"
|
242
|
-
|
243
|
-
success_color = summary["passed"] > 0 ? "passed" : "no_color"
|
244
|
-
failed_color = summary["failed"] > 0 ? "failed" : "no_color"
|
245
|
-
skipped_color = summary["skipped"] > 0 ? "skipped" : "no_color"
|
246
|
-
|
247
|
-
s = format(
|
248
|
-
"Profile Summary: %s, %s, %s",
|
249
|
-
format_with_color(success_color, success_str),
|
250
|
-
format_with_color(failed_color, failed_str),
|
251
|
-
format_with_color(skipped_color, skipped_str)
|
252
|
-
)
|
253
|
-
output(s) if summary["total"] > 0
|
254
|
-
end
|
255
|
-
|
256
|
-
def print_tests_summary
|
257
|
-
summary = tests_summary
|
258
|
-
|
259
|
-
failed_str = summary["failed"] == 1 ? "1 failure" : "#{summary["failed"]} failures"
|
260
|
-
|
261
|
-
success_color = summary["passed"] > 0 ? "passed" : "no_color"
|
262
|
-
failed_color = summary["failed"] > 0 ? "failed" : "no_color"
|
263
|
-
skipped_color = summary["skipped"] > 0 ? "skipped" : "no_color"
|
264
|
-
|
265
|
-
s = format(
|
266
|
-
"Test Summary: %s, %s, %s",
|
267
|
-
format_with_color(success_color, "#{summary["passed"]} successful"),
|
268
|
-
format_with_color(failed_color, failed_str),
|
269
|
-
format_with_color(skipped_color, "#{summary["skipped"]} skipped")
|
270
|
-
)
|
271
|
-
|
272
|
-
output(s)
|
273
|
-
end
|
274
|
-
|
275
|
-
def standard_controls_from_profile(profile)
|
276
|
-
profile[:controls].reject { |c| is_anonymous_control?(c) }
|
277
|
-
end
|
278
|
-
|
279
|
-
def anonymous_controls_from_profile(profile)
|
280
|
-
profile[:controls].select { |c| is_anonymous_control?(c) && !c[:results].nil? }
|
281
|
-
end
|
282
|
-
|
283
|
-
def is_anonymous_control?(control)
|
284
|
-
control[:id].start_with?("(generated from ")
|
285
|
-
end
|
286
|
-
|
287
|
-
def indent_lines(message, indentation)
|
288
|
-
message.lines.map { |line| " " * indentation + line }.join
|
289
|
-
end
|
290
|
-
|
291
|
-
class Control
|
292
|
-
attr_reader :data
|
293
|
-
|
294
|
-
def initialize(control_hash)
|
295
|
-
@data = control_hash
|
296
|
-
end
|
297
|
-
|
298
|
-
def id
|
299
|
-
data[:id]
|
300
|
-
end
|
301
|
-
|
302
|
-
def title
|
303
|
-
data[:title]
|
304
|
-
end
|
305
|
-
|
306
|
-
def results
|
307
|
-
data[:results]
|
308
|
-
end
|
309
|
-
|
310
|
-
def impact
|
311
|
-
data[:impact]
|
312
|
-
end
|
313
|
-
|
314
|
-
def anonymous?
|
315
|
-
id.start_with?("(generated from ")
|
316
|
-
end
|
317
|
-
|
318
|
-
def title_for_report
|
319
|
-
# if this is an anonymous control, just grab the resource title from any result entry
|
320
|
-
return results.first[:resource_title] if anonymous?
|
321
|
-
|
322
|
-
title_for_report = "#{id}: #{title || results.first[:resource_title]}"
|
323
|
-
|
324
|
-
# we will not add any additional data to the title if there's only
|
325
|
-
# zero or one test for this control.
|
326
|
-
return title_for_report if results.nil? || results.size <= 1
|
327
|
-
|
328
|
-
# append a failure summary if appropriate.
|
329
|
-
title_for_report += " (#{failure_count} failed)" if failure_count > 0
|
330
|
-
title_for_report += " (#{skipped_count} skipped)" if skipped_count > 0
|
331
|
-
|
332
|
-
title_for_report
|
333
|
-
end
|
334
|
-
|
335
|
-
def impact_string
|
336
|
-
if anonymous?
|
337
|
-
nil
|
338
|
-
elsif impact.nil?
|
339
|
-
"unknown"
|
340
|
-
elsif results&.find { |r| r[:status] == "skipped" }
|
341
|
-
"skipped"
|
342
|
-
elsif results.nil? || results.empty? || results.all? { |r| r[:status] == "passed" }
|
343
|
-
"passed"
|
344
|
-
else
|
345
|
-
"failed"
|
346
|
-
end
|
347
|
-
end
|
348
|
-
|
349
|
-
def impact_string_for_result(result)
|
350
|
-
if result[:status] == "skipped"
|
351
|
-
"skipped"
|
352
|
-
elsif result[:status] == "passed"
|
353
|
-
"passed"
|
354
|
-
elsif impact.nil?
|
355
|
-
"unknown"
|
356
|
-
else
|
357
|
-
"failed"
|
358
|
-
end
|
359
|
-
end
|
360
|
-
|
361
|
-
def failure_count
|
362
|
-
results.select { |r| r[:status] == "failed" }.size
|
363
|
-
end
|
364
|
-
|
365
|
-
def skipped_count
|
366
|
-
results.select { |r| r[:status] == "skipped" }.size
|
367
|
-
end
|
368
|
-
end
|
369
|
-
end
|
370
|
-
end
|
@@ -1,113 +0,0 @@
|
|
1
|
-
require "json"
|
2
|
-
|
3
|
-
module Inspec::Reporters
|
4
|
-
# rubocop:disable Layout/AlignHash, Style/BlockDelimiters
|
5
|
-
class Json < Base
|
6
|
-
def render
|
7
|
-
output(report.to_json, false)
|
8
|
-
end
|
9
|
-
|
10
|
-
def report
|
11
|
-
{
|
12
|
-
platform: platform,
|
13
|
-
profiles: profiles,
|
14
|
-
statistics: {
|
15
|
-
duration: run_data[:statistics][:duration],
|
16
|
-
},
|
17
|
-
version: run_data[:version],
|
18
|
-
}
|
19
|
-
end
|
20
|
-
|
21
|
-
private
|
22
|
-
|
23
|
-
def platform
|
24
|
-
{
|
25
|
-
name: run_data[:platform][:name],
|
26
|
-
release: run_data[:platform][:release],
|
27
|
-
target_id: @config["target_id"],
|
28
|
-
}.reject { |_k, v| v.nil? }
|
29
|
-
end
|
30
|
-
|
31
|
-
def profile_results(control)
|
32
|
-
(control[:results] || []).map { |r|
|
33
|
-
{
|
34
|
-
status: r[:status],
|
35
|
-
code_desc: r[:code_desc],
|
36
|
-
run_time: r[:run_time],
|
37
|
-
start_time: r[:start_time],
|
38
|
-
resource: r[:resource],
|
39
|
-
skip_message: r[:skip_message],
|
40
|
-
message: r[:message],
|
41
|
-
exception: r[:exception],
|
42
|
-
backtrace: r[:backtrace],
|
43
|
-
}.reject { |_k, v| v.nil? }
|
44
|
-
}
|
45
|
-
end
|
46
|
-
|
47
|
-
def profiles
|
48
|
-
run_data[:profiles].map { |p|
|
49
|
-
{
|
50
|
-
name: p[:name],
|
51
|
-
version: p[:version],
|
52
|
-
sha256: p[:sha256],
|
53
|
-
title: p[:title],
|
54
|
-
maintainer: p[:maintainer],
|
55
|
-
summary: p[:summary],
|
56
|
-
license: p[:license],
|
57
|
-
copyright: p[:copyright],
|
58
|
-
copyright_email: p[:copyright_email],
|
59
|
-
supports: p[:supports],
|
60
|
-
# TODO: rename exposed field to inputs, see #3802:
|
61
|
-
attributes: (p[:inputs] || p[:attributes]),
|
62
|
-
parent_profile: p[:parent_profile],
|
63
|
-
depends: p[:depends],
|
64
|
-
groups: profile_groups(p),
|
65
|
-
controls: profile_controls(p),
|
66
|
-
status: p[:status],
|
67
|
-
skip_message: p[:skip_message],
|
68
|
-
waiver_data: p[:waiver_data],
|
69
|
-
}.reject { |_k, v| v.nil? }
|
70
|
-
}
|
71
|
-
end
|
72
|
-
|
73
|
-
def profile_groups(profile)
|
74
|
-
(profile[:groups] || []).map { |g|
|
75
|
-
{
|
76
|
-
id: g[:id],
|
77
|
-
controls: g[:controls],
|
78
|
-
title: g[:title],
|
79
|
-
}.reject { |_k, v| v.nil? }
|
80
|
-
}
|
81
|
-
end
|
82
|
-
|
83
|
-
def profile_controls(profile)
|
84
|
-
(profile[:controls] || []).map { |c|
|
85
|
-
{
|
86
|
-
id: c[:id],
|
87
|
-
title: c[:title],
|
88
|
-
desc: c.dig(:descriptions, :default),
|
89
|
-
descriptions: convert_descriptions(c[:descriptions]),
|
90
|
-
impact: c[:impact],
|
91
|
-
refs: c[:refs],
|
92
|
-
tags: c[:tags],
|
93
|
-
code: c[:code],
|
94
|
-
source_location: {
|
95
|
-
line: c[:source_location][:line],
|
96
|
-
ref: c[:source_location][:ref],
|
97
|
-
},
|
98
|
-
waiver_data: c[:waiver_data] || {},
|
99
|
-
results: profile_results(c),
|
100
|
-
}
|
101
|
-
}
|
102
|
-
end
|
103
|
-
|
104
|
-
def convert_descriptions(data)
|
105
|
-
(data || []).map { |label, text|
|
106
|
-
{
|
107
|
-
label: label.to_s,
|
108
|
-
data: text,
|
109
|
-
}
|
110
|
-
}
|
111
|
-
end
|
112
|
-
end
|
113
|
-
end
|