inspec 4.18.51 → 4.18.85

Sign up to get free protection for your applications and to get access to all the features.
Files changed (371) hide show
  1. checksums.yaml +4 -4
  2. data/inspec.gemspec +15 -37
  3. data/lib/resource_support/aws/aws_resource_mixin.rb +1 -1
  4. metadata +22 -709
  5. data/Gemfile +0 -61
  6. data/LICENSE +0 -14
  7. data/README.md +0 -474
  8. data/etc/deprecations.json +0 -125
  9. data/etc/plugin_filters.json +0 -45
  10. data/lib/bundles/README.md +0 -3
  11. data/lib/bundles/inspec-compliance/api.rb +0 -7
  12. data/lib/bundles/inspec-compliance/configuration.rb +0 -7
  13. data/lib/bundles/inspec-compliance/http.rb +0 -7
  14. data/lib/bundles/inspec-compliance/support.rb +0 -7
  15. data/lib/bundles/inspec-compliance/target.rb +0 -7
  16. data/lib/bundles/inspec-supermarket.rb +0 -9
  17. data/lib/bundles/inspec-supermarket/README.md +0 -45
  18. data/lib/bundles/inspec-supermarket/api.rb +0 -87
  19. data/lib/bundles/inspec-supermarket/cli.rb +0 -71
  20. data/lib/bundles/inspec-supermarket/target.rb +0 -31
  21. data/lib/inspec.rb +0 -30
  22. data/lib/inspec/archive/tar.rb +0 -25
  23. data/lib/inspec/archive/zip.rb +0 -15
  24. data/lib/inspec/backend.rb +0 -101
  25. data/lib/inspec/base_cli.rb +0 -318
  26. data/lib/inspec/cached_fetcher.rb +0 -65
  27. data/lib/inspec/cli.rb +0 -469
  28. data/lib/inspec/completions/bash.sh.erb +0 -45
  29. data/lib/inspec/completions/fish.sh.erb +0 -34
  30. data/lib/inspec/completions/zsh.sh.erb +0 -61
  31. data/lib/inspec/config.rb +0 -511
  32. data/lib/inspec/control_eval_context.rb +0 -248
  33. data/lib/inspec/dependencies/cache.rb +0 -74
  34. data/lib/inspec/dependencies/dependency_set.rb +0 -93
  35. data/lib/inspec/dependencies/lockfile.rb +0 -115
  36. data/lib/inspec/dependencies/requirement.rb +0 -135
  37. data/lib/inspec/dependencies/resolver.rb +0 -86
  38. data/lib/inspec/describe_base.rb +0 -53
  39. data/lib/inspec/dist.rb +0 -20
  40. data/lib/inspec/dsl.rb +0 -115
  41. data/lib/inspec/dsl_shared.rb +0 -32
  42. data/lib/inspec/env_printer.rb +0 -156
  43. data/lib/inspec/errors.rb +0 -18
  44. data/lib/inspec/exceptions.rb +0 -11
  45. data/lib/inspec/expect.rb +0 -42
  46. data/lib/inspec/fetcher.rb +0 -48
  47. data/lib/inspec/fetcher/git.rb +0 -211
  48. data/lib/inspec/fetcher/local.rb +0 -116
  49. data/lib/inspec/fetcher/mock.rb +0 -34
  50. data/lib/inspec/fetcher/url.rb +0 -281
  51. data/lib/inspec/file_provider.rb +0 -318
  52. data/lib/inspec/formatters.rb +0 -3
  53. data/lib/inspec/formatters/base.rb +0 -269
  54. data/lib/inspec/formatters/json_rspec.rb +0 -20
  55. data/lib/inspec/formatters/show_progress.rb +0 -12
  56. data/lib/inspec/globals.rb +0 -9
  57. data/lib/inspec/impact.rb +0 -36
  58. data/lib/inspec/input.rb +0 -421
  59. data/lib/inspec/input_dsl_helpers.rb +0 -26
  60. data/lib/inspec/input_registry.rb +0 -315
  61. data/lib/inspec/library_eval_context.rb +0 -55
  62. data/lib/inspec/log.rb +0 -7
  63. data/lib/inspec/metadata.rb +0 -253
  64. data/lib/inspec/method_source.rb +0 -20
  65. data/lib/inspec/objects.rb +0 -14
  66. data/lib/inspec/objects/control.rb +0 -85
  67. data/lib/inspec/objects/describe.rb +0 -106
  68. data/lib/inspec/objects/each_loop.rb +0 -41
  69. data/lib/inspec/objects/input.rb +0 -49
  70. data/lib/inspec/objects/list.rb +0 -15
  71. data/lib/inspec/objects/or_test.rb +0 -45
  72. data/lib/inspec/objects/ruby_helper.rb +0 -13
  73. data/lib/inspec/objects/tag.rb +0 -32
  74. data/lib/inspec/objects/test.rb +0 -94
  75. data/lib/inspec/objects/value.rb +0 -32
  76. data/lib/inspec/plugin/v1.rb +0 -2
  77. data/lib/inspec/plugin/v1/plugin_types/cli.rb +0 -22
  78. data/lib/inspec/plugin/v1/plugin_types/fetcher.rb +0 -83
  79. data/lib/inspec/plugin/v1/plugin_types/resource.rb +0 -176
  80. data/lib/inspec/plugin/v1/plugin_types/secret.rb +0 -11
  81. data/lib/inspec/plugin/v1/plugin_types/source_reader.rb +0 -36
  82. data/lib/inspec/plugin/v1/plugins.rb +0 -59
  83. data/lib/inspec/plugin/v1/registry.rb +0 -90
  84. data/lib/inspec/plugin/v2.rb +0 -46
  85. data/lib/inspec/plugin/v2/activator.rb +0 -40
  86. data/lib/inspec/plugin/v2/config_file.rb +0 -151
  87. data/lib/inspec/plugin/v2/filter.rb +0 -96
  88. data/lib/inspec/plugin/v2/installer.rb +0 -512
  89. data/lib/inspec/plugin/v2/loader.rb +0 -321
  90. data/lib/inspec/plugin/v2/plugin_base.rb +0 -112
  91. data/lib/inspec/plugin/v2/plugin_types/cli.rb +0 -49
  92. data/lib/inspec/plugin/v2/plugin_types/dsl.rb +0 -11
  93. data/lib/inspec/plugin/v2/plugin_types/input.rb +0 -34
  94. data/lib/inspec/plugin/v2/plugin_types/mock.rb +0 -12
  95. data/lib/inspec/plugin/v2/registry.rb +0 -98
  96. data/lib/inspec/plugin/v2/status.rb +0 -29
  97. data/lib/inspec/profile.rb +0 -658
  98. data/lib/inspec/profile_context.rb +0 -203
  99. data/lib/inspec/profile_vendor.rb +0 -84
  100. data/lib/inspec/reporters.rb +0 -73
  101. data/lib/inspec/reporters/automate.rb +0 -78
  102. data/lib/inspec/reporters/base.rb +0 -25
  103. data/lib/inspec/reporters/cli.rb +0 -370
  104. data/lib/inspec/reporters/json.rb +0 -113
  105. data/lib/inspec/reporters/json_automate.rb +0 -80
  106. data/lib/inspec/reporters/json_min.rb +0 -48
  107. data/lib/inspec/reporters/junit.rb +0 -77
  108. data/lib/inspec/reporters/yaml.rb +0 -20
  109. data/lib/inspec/require_loader.rb +0 -29
  110. data/lib/inspec/resource.rb +0 -114
  111. data/lib/inspec/resources.rb +0 -130
  112. data/lib/inspec/resources/aide_conf.rb +0 -153
  113. data/lib/inspec/resources/apache.rb +0 -47
  114. data/lib/inspec/resources/apache_conf.rb +0 -156
  115. data/lib/inspec/resources/apt.rb +0 -151
  116. data/lib/inspec/resources/audit_policy.rb +0 -64
  117. data/lib/inspec/resources/auditd.rb +0 -251
  118. data/lib/inspec/resources/auditd_conf.rb +0 -45
  119. data/lib/inspec/resources/bash.rb +0 -33
  120. data/lib/inspec/resources/bond.rb +0 -70
  121. data/lib/inspec/resources/bridge.rb +0 -125
  122. data/lib/inspec/resources/bsd_service.rb +0 -2
  123. data/lib/inspec/resources/chocolatey_package.rb +0 -82
  124. data/lib/inspec/resources/command.rb +0 -91
  125. data/lib/inspec/resources/cpan.rb +0 -58
  126. data/lib/inspec/resources/cran.rb +0 -64
  127. data/lib/inspec/resources/crontab.rb +0 -173
  128. data/lib/inspec/resources/csv.rb +0 -56
  129. data/lib/inspec/resources/dh_params.rb +0 -83
  130. data/lib/inspec/resources/directory.rb +0 -23
  131. data/lib/inspec/resources/docker.rb +0 -274
  132. data/lib/inspec/resources/docker_container.rb +0 -91
  133. data/lib/inspec/resources/docker_image.rb +0 -84
  134. data/lib/inspec/resources/docker_object.rb +0 -52
  135. data/lib/inspec/resources/docker_plugin.rb +0 -64
  136. data/lib/inspec/resources/docker_service.rb +0 -91
  137. data/lib/inspec/resources/elasticsearch.rb +0 -165
  138. data/lib/inspec/resources/etc_fstab.rb +0 -96
  139. data/lib/inspec/resources/etc_group.rb +0 -157
  140. data/lib/inspec/resources/etc_hosts.rb +0 -68
  141. data/lib/inspec/resources/etc_hosts_allow.rb +0 -2
  142. data/lib/inspec/resources/etc_hosts_allow_deny.rb +0 -114
  143. data/lib/inspec/resources/etc_hosts_deny.rb +0 -2
  144. data/lib/inspec/resources/file.rb +0 -339
  145. data/lib/inspec/resources/filesystem.rb +0 -139
  146. data/lib/inspec/resources/firewalld.rb +0 -148
  147. data/lib/inspec/resources/gem.rb +0 -80
  148. data/lib/inspec/resources/group.rb +0 -2
  149. data/lib/inspec/resources/groups.rb +0 -241
  150. data/lib/inspec/resources/grub_conf.rb +0 -230
  151. data/lib/inspec/resources/host.rb +0 -310
  152. data/lib/inspec/resources/http.rb +0 -275
  153. data/lib/inspec/resources/iis_app.rb +0 -101
  154. data/lib/inspec/resources/iis_app_pool.rb +0 -127
  155. data/lib/inspec/resources/iis_site.rb +0 -148
  156. data/lib/inspec/resources/iis_website.rb +0 -2
  157. data/lib/inspec/resources/inetd_conf.rb +0 -53
  158. data/lib/inspec/resources/ini.rb +0 -28
  159. data/lib/inspec/resources/interface.rb +0 -204
  160. data/lib/inspec/resources/ip6tables.rb +0 -79
  161. data/lib/inspec/resources/iptables.rb +0 -80
  162. data/lib/inspec/resources/json.rb +0 -116
  163. data/lib/inspec/resources/kernel_module.rb +0 -106
  164. data/lib/inspec/resources/kernel_parameter.rb +0 -54
  165. data/lib/inspec/resources/key_rsa.rb +0 -66
  166. data/lib/inspec/resources/ksh.rb +0 -33
  167. data/lib/inspec/resources/launchd_service.rb +0 -2
  168. data/lib/inspec/resources/limits_conf.rb +0 -45
  169. data/lib/inspec/resources/linux_kernel_parameter.rb +0 -2
  170. data/lib/inspec/resources/login_defs.rb +0 -56
  171. data/lib/inspec/resources/mount.rb +0 -88
  172. data/lib/inspec/resources/mssql_session.rb +0 -117
  173. data/lib/inspec/resources/mysql.rb +0 -81
  174. data/lib/inspec/resources/mysql_conf.rb +0 -128
  175. data/lib/inspec/resources/mysql_session.rb +0 -88
  176. data/lib/inspec/resources/nginx.rb +0 -96
  177. data/lib/inspec/resources/nginx_conf.rb +0 -232
  178. data/lib/inspec/resources/noop.rb +0 -9
  179. data/lib/inspec/resources/npm.rb +0 -68
  180. data/lib/inspec/resources/ntp_conf.rb +0 -51
  181. data/lib/inspec/resources/oneget.rb +0 -71
  182. data/lib/inspec/resources/oracledb_session.rb +0 -149
  183. data/lib/inspec/resources/os.rb +0 -34
  184. data/lib/inspec/resources/os_env.rb +0 -86
  185. data/lib/inspec/resources/package.rb +0 -391
  186. data/lib/inspec/resources/packages.rb +0 -111
  187. data/lib/inspec/resources/parse_config.rb +0 -112
  188. data/lib/inspec/resources/parse_config_file.rb +0 -2
  189. data/lib/inspec/resources/passwd.rb +0 -73
  190. data/lib/inspec/resources/pip.rb +0 -132
  191. data/lib/inspec/resources/platform.rb +0 -112
  192. data/lib/inspec/resources/port.rb +0 -791
  193. data/lib/inspec/resources/postfix_conf.rb +0 -35
  194. data/lib/inspec/resources/postgres.rb +0 -152
  195. data/lib/inspec/resources/postgres_conf.rb +0 -116
  196. data/lib/inspec/resources/postgres_hba_conf.rb +0 -86
  197. data/lib/inspec/resources/postgres_ident_conf.rb +0 -75
  198. data/lib/inspec/resources/postgres_session.rb +0 -70
  199. data/lib/inspec/resources/powershell.rb +0 -67
  200. data/lib/inspec/resources/ppa.rb +0 -2
  201. data/lib/inspec/resources/processes.rb +0 -219
  202. data/lib/inspec/resources/rabbitmq_conf.rb +0 -2
  203. data/lib/inspec/resources/rabbitmq_config.rb +0 -52
  204. data/lib/inspec/resources/registry_key.rb +0 -296
  205. data/lib/inspec/resources/runit_service.rb +0 -2
  206. data/lib/inspec/resources/script.rb +0 -1
  207. data/lib/inspec/resources/security_identifier.rb +0 -91
  208. data/lib/inspec/resources/security_policy.rb +0 -182
  209. data/lib/inspec/resources/service.rb +0 -820
  210. data/lib/inspec/resources/shadow.rb +0 -150
  211. data/lib/inspec/resources/ssh_config.rb +0 -98
  212. data/lib/inspec/resources/sshd_config.rb +0 -2
  213. data/lib/inspec/resources/ssl.rb +0 -99
  214. data/lib/inspec/resources/sys_info.rb +0 -119
  215. data/lib/inspec/resources/systemd_service.rb +0 -2
  216. data/lib/inspec/resources/sysv_service.rb +0 -2
  217. data/lib/inspec/resources/toml.rb +0 -30
  218. data/lib/inspec/resources/upstart_service.rb +0 -2
  219. data/lib/inspec/resources/user.rb +0 -1
  220. data/lib/inspec/resources/users.rb +0 -742
  221. data/lib/inspec/resources/vbscript.rb +0 -67
  222. data/lib/inspec/resources/virtualization.rb +0 -255
  223. data/lib/inspec/resources/windows_feature.rb +0 -126
  224. data/lib/inspec/resources/windows_hotfix.rb +0 -37
  225. data/lib/inspec/resources/windows_registry_key.rb +0 -2
  226. data/lib/inspec/resources/windows_task.rb +0 -112
  227. data/lib/inspec/resources/wmi.rb +0 -109
  228. data/lib/inspec/resources/x509_certificate.rb +0 -143
  229. data/lib/inspec/resources/xinetd_conf.rb +0 -103
  230. data/lib/inspec/resources/xml.rb +0 -48
  231. data/lib/inspec/resources/yaml.rb +0 -42
  232. data/lib/inspec/resources/yum.rb +0 -162
  233. data/lib/inspec/resources/zfs_dataset.rb +0 -62
  234. data/lib/inspec/resources/zfs_pool.rb +0 -50
  235. data/lib/inspec/rspec_extensions.rb +0 -116
  236. data/lib/inspec/rule.rb +0 -389
  237. data/lib/inspec/runner.rb +0 -333
  238. data/lib/inspec/runner_mock.rb +0 -37
  239. data/lib/inspec/runner_rspec.rb +0 -184
  240. data/lib/inspec/runtime_profile.rb +0 -23
  241. data/lib/inspec/schema.rb +0 -245
  242. data/lib/inspec/secrets.rb +0 -15
  243. data/lib/inspec/secrets/yaml.rb +0 -29
  244. data/lib/inspec/shell.rb +0 -211
  245. data/lib/inspec/shell_detector.rb +0 -89
  246. data/lib/inspec/source_reader.rb +0 -26
  247. data/lib/inspec/ui.rb +0 -213
  248. data/lib/inspec/ui_table_helper.rb +0 -12
  249. data/lib/inspec/utils/command_wrapper.rb +0 -23
  250. data/lib/inspec/utils/convert.rb +0 -8
  251. data/lib/inspec/utils/database_helpers.rb +0 -75
  252. data/lib/inspec/utils/deprecation.rb +0 -6
  253. data/lib/inspec/utils/deprecation/config_file.rb +0 -109
  254. data/lib/inspec/utils/deprecation/deprecator.rb +0 -118
  255. data/lib/inspec/utils/deprecation/errors.rb +0 -14
  256. data/lib/inspec/utils/deprecation/global_method.rb +0 -9
  257. data/lib/inspec/utils/enumerable_delegation.rb +0 -7
  258. data/lib/inspec/utils/erlang_parser.rb +0 -190
  259. data/lib/inspec/utils/file_reader.rb +0 -24
  260. data/lib/inspec/utils/filter.rb +0 -461
  261. data/lib/inspec/utils/filter_array.rb +0 -25
  262. data/lib/inspec/utils/find_files.rb +0 -44
  263. data/lib/inspec/utils/hash.rb +0 -37
  264. data/lib/inspec/utils/json_log.rb +0 -15
  265. data/lib/inspec/utils/modulator.rb +0 -9
  266. data/lib/inspec/utils/nginx_parser.rb +0 -101
  267. data/lib/inspec/utils/object_traversal.rb +0 -47
  268. data/lib/inspec/utils/parser.rb +0 -277
  269. data/lib/inspec/utils/pkey_reader.rb +0 -17
  270. data/lib/inspec/utils/simpleconfig.rb +0 -121
  271. data/lib/inspec/utils/spdx.rb +0 -10
  272. data/lib/inspec/utils/spdx.txt +0 -383
  273. data/lib/inspec/utils/telemetry.rb +0 -3
  274. data/lib/inspec/utils/telemetry/collector.rb +0 -81
  275. data/lib/inspec/utils/telemetry/data_series.rb +0 -44
  276. data/lib/inspec/utils/telemetry/global_methods.rb +0 -22
  277. data/lib/inspec/version.rb +0 -3
  278. data/lib/matchers/matchers.rb +0 -341
  279. data/lib/plugins/README.md +0 -16
  280. data/lib/plugins/inspec-artifact/lib/inspec-artifact.rb +0 -12
  281. data/lib/plugins/inspec-artifact/lib/inspec-artifact/base.rb +0 -170
  282. data/lib/plugins/inspec-artifact/lib/inspec-artifact/cli.rb +0 -116
  283. data/lib/plugins/inspec-artifact/test/functional/inspec_artifact_test.rb +0 -50
  284. data/lib/plugins/inspec-compliance/README.md +0 -207
  285. data/lib/plugins/inspec-compliance/lib/inspec-compliance.rb +0 -12
  286. data/lib/plugins/inspec-compliance/lib/inspec-compliance/api.rb +0 -362
  287. data/lib/plugins/inspec-compliance/lib/inspec-compliance/api/login.rb +0 -198
  288. data/lib/plugins/inspec-compliance/lib/inspec-compliance/cli.rb +0 -269
  289. data/lib/plugins/inspec-compliance/lib/inspec-compliance/configuration.rb +0 -103
  290. data/lib/plugins/inspec-compliance/lib/inspec-compliance/http.rb +0 -117
  291. data/lib/plugins/inspec-compliance/lib/inspec-compliance/images/cc-token.png +0 -0
  292. data/lib/plugins/inspec-compliance/lib/inspec-compliance/support.rb +0 -34
  293. data/lib/plugins/inspec-compliance/lib/inspec-compliance/target.rb +0 -146
  294. data/lib/plugins/inspec-compliance/test/functional/inspec_compliance_test.rb +0 -53
  295. data/lib/plugins/inspec-compliance/test/integration/default/cli.rb +0 -91
  296. data/lib/plugins/inspec-compliance/test/unit/api/login_test.rb +0 -190
  297. data/lib/plugins/inspec-compliance/test/unit/api_test.rb +0 -386
  298. data/lib/plugins/inspec-compliance/test/unit/target_test.rb +0 -155
  299. data/lib/plugins/inspec-habitat/Berksfile +0 -5
  300. data/lib/plugins/inspec-habitat/README.md +0 -150
  301. data/lib/plugins/inspec-habitat/kitchen.yml +0 -28
  302. data/lib/plugins/inspec-habitat/lib/inspec-habitat.rb +0 -11
  303. data/lib/plugins/inspec-habitat/lib/inspec-habitat/cli.rb +0 -41
  304. data/lib/plugins/inspec-habitat/lib/inspec-habitat/profile.rb +0 -265
  305. data/lib/plugins/inspec-habitat/templates/habitat/plan.sh.erb +0 -6
  306. data/lib/plugins/inspec-habitat/test/cookbooks/inspec_habitat_fixture/Berksfile +0 -2
  307. data/lib/plugins/inspec-habitat/test/cookbooks/inspec_habitat_fixture/README.md +0 -3
  308. data/lib/plugins/inspec-habitat/test/cookbooks/inspec_habitat_fixture/files/hab_setup.exp +0 -28
  309. data/lib/plugins/inspec-habitat/test/cookbooks/inspec_habitat_fixture/metadata.rb +0 -9
  310. data/lib/plugins/inspec-habitat/test/cookbooks/inspec_habitat_fixture/recipes/default.rb +0 -61
  311. data/lib/plugins/inspec-habitat/test/functional/inspec_habitat_test.rb +0 -34
  312. data/lib/plugins/inspec-habitat/test/integration/default/inspec_habitat/README.md +0 -3
  313. data/lib/plugins/inspec-habitat/test/integration/default/inspec_habitat/controls/inspec_habitat.rb +0 -40
  314. data/lib/plugins/inspec-habitat/test/integration/default/inspec_habitat/inspec.yml +0 -10
  315. data/lib/plugins/inspec-habitat/test/support/example_profile/README.md +0 -3
  316. data/lib/plugins/inspec-habitat/test/support/example_profile/controls/example.rb +0 -7
  317. data/lib/plugins/inspec-habitat/test/support/example_profile/inspec.yml +0 -10
  318. data/lib/plugins/inspec-habitat/test/unit/profile_test.rb +0 -242
  319. data/lib/plugins/inspec-init/README.md +0 -31
  320. data/lib/plugins/inspec-init/lib/inspec-init.rb +0 -12
  321. data/lib/plugins/inspec-init/lib/inspec-init/cli.rb +0 -15
  322. data/lib/plugins/inspec-init/lib/inspec-init/cli_plugin.rb +0 -243
  323. data/lib/plugins/inspec-init/lib/inspec-init/cli_profile.rb +0 -47
  324. data/lib/plugins/inspec-init/lib/inspec-init/renderer.rb +0 -97
  325. data/lib/plugins/inspec-init/templates/plugins/inspec-plugin-template/Gemfile +0 -11
  326. data/lib/plugins/inspec-init/templates/plugins/inspec-plugin-template/LICENSE +0 -2
  327. data/lib/plugins/inspec-init/templates/plugins/inspec-plugin-template/README.md +0 -28
  328. data/lib/plugins/inspec-init/templates/plugins/inspec-plugin-template/Rakefile +0 -40
  329. data/lib/plugins/inspec-init/templates/plugins/inspec-plugin-template/lib/inspec-plugin-template.rb +0 -14
  330. data/lib/plugins/inspec-init/templates/plugins/inspec-plugin-template/lib/inspec-plugin-template/cli_command.rb +0 -62
  331. data/lib/plugins/inspec-init/templates/plugins/inspec-plugin-template/lib/inspec-plugin-template/plugin.rb +0 -53
  332. data/lib/plugins/inspec-init/templates/plugins/inspec-plugin-template/lib/inspec-plugin-template/version.rb +0 -8
  333. data/lib/plugins/inspec-init/templates/plugins/inspec-plugin-template/test/fixtures/README.md +0 -24
  334. data/lib/plugins/inspec-init/templates/plugins/inspec-plugin-template/test/functional/README.md +0 -12
  335. data/lib/plugins/inspec-init/templates/plugins/inspec-plugin-template/test/functional/inspec_plugin_template_test.rb +0 -110
  336. data/lib/plugins/inspec-init/templates/plugins/inspec-plugin-template/test/helper.rb +0 -24
  337. data/lib/plugins/inspec-init/templates/plugins/inspec-plugin-template/test/unit/README.md +0 -17
  338. data/lib/plugins/inspec-init/templates/plugins/inspec-plugin-template/test/unit/cli_args_test.rb +0 -67
  339. data/lib/plugins/inspec-init/templates/plugins/inspec-plugin-template/test/unit/plugin_def_test.rb +0 -51
  340. data/lib/plugins/inspec-init/templates/profiles/aws/libraries/.gitkeep +0 -0
  341. data/lib/plugins/inspec-init/templates/profiles/azure/libraries/.gitkeep +0 -0
  342. data/lib/plugins/inspec-init/templates/profiles/gcp/libraries/.gitkeep +0 -0
  343. data/lib/plugins/inspec-init/templates/profiles/os/README.md +0 -3
  344. data/lib/plugins/inspec-init/templates/profiles/os/controls/example.rb +0 -18
  345. data/lib/plugins/inspec-init/templates/profiles/os/inspec.yml +0 -10
  346. data/lib/plugins/inspec-init/templates/profiles/os/libraries/.gitkeep +0 -0
  347. data/lib/plugins/inspec-init/test/functional/inspec_init_plugin_test.rb +0 -184
  348. data/lib/plugins/inspec-init/test/functional/inspec_init_profile_test.rb +0 -121
  349. data/lib/plugins/inspec-plugin-manager-cli/README.md +0 -6
  350. data/lib/plugins/inspec-plugin-manager-cli/lib/inspec-plugin-manager-cli.rb +0 -17
  351. data/lib/plugins/inspec-plugin-manager-cli/lib/inspec-plugin-manager-cli/cli_command.rb +0 -518
  352. data/lib/plugins/inspec-plugin-manager-cli/lib/inspec-plugin-manager-cli/plugin.rb +0 -12
  353. data/lib/plugins/inspec-plugin-manager-cli/test/fixtures/config_dirs/empty/.gitkeep +0 -0
  354. data/lib/plugins/inspec-plugin-manager-cli/test/fixtures/plugins/inspec-egg-white-omelette/lib/inspec-egg-white-omelette.rb +0 -2
  355. data/lib/plugins/inspec-plugin-manager-cli/test/fixtures/plugins/inspec-egg-white-omelette/lib/inspec-egg-white-omelette/.gitkeep +0 -0
  356. data/lib/plugins/inspec-plugin-manager-cli/test/fixtures/plugins/inspec-wrong-structure/.gitkeep +0 -0
  357. data/lib/plugins/inspec-plugin-manager-cli/test/fixtures/plugins/wrong-name/lib/wrong-name.rb +0 -1
  358. data/lib/plugins/inspec-plugin-manager-cli/test/fixtures/plugins/wrong-name/lib/wrong-name/.gitkeep +0 -0
  359. data/lib/plugins/inspec-plugin-manager-cli/test/functional/help_test.rb +0 -23
  360. data/lib/plugins/inspec-plugin-manager-cli/test/functional/helper.rb +0 -62
  361. data/lib/plugins/inspec-plugin-manager-cli/test/functional/install_test.rb +0 -368
  362. data/lib/plugins/inspec-plugin-manager-cli/test/functional/list_test.rb +0 -101
  363. data/lib/plugins/inspec-plugin-manager-cli/test/functional/search_test.rb +0 -129
  364. data/lib/plugins/inspec-plugin-manager-cli/test/functional/uninstall_test.rb +0 -63
  365. data/lib/plugins/inspec-plugin-manager-cli/test/functional/update_test.rb +0 -84
  366. data/lib/plugins/inspec-plugin-manager-cli/test/unit/cli_args_test.rb +0 -77
  367. data/lib/plugins/inspec-plugin-manager-cli/test/unit/plugin_def_test.rb +0 -39
  368. data/lib/plugins/shared/core_plugin_test_helper.rb +0 -153
  369. data/lib/plugins/things-for-train-integration.rb +0 -14
  370. data/lib/source_readers/flat.rb +0 -36
  371. data/lib/source_readers/inspec.rb +0 -66
@@ -1,24 +0,0 @@
1
- require "inspec/resources/file"
2
-
3
- module FileReader
4
- def read_file_content(path, allow_empty = false)
5
- # these are currently ResourceSkipped to maintain consistency with the resource
6
- # pre-refactor (which used skip_resource). These should likely be changed to
7
- # ResourceFailed during a major version bump.
8
- file = inspec.file(path)
9
- unless file.file?
10
- raise Inspec::Exceptions::ResourceSkipped, "Can't find file: #{path}"
11
- end
12
-
13
- raw_content = file.content
14
- if raw_content.nil?
15
- raise Inspec::Exceptions::ResourceSkipped, "Can't read file: #{path}"
16
- end
17
-
18
- if !allow_empty && raw_content.empty?
19
- raise Inspec::Exceptions::ResourceSkipped, "File is empty: #{path}"
20
- end
21
-
22
- raw_content
23
- end
24
- end
@@ -1,461 +0,0 @@
1
- module FilterTable
2
- # This is used as a sentinel value in custom property filtering
3
- module NoCriteriaProvided; end
4
-
5
- class ExceptionCatcher
6
- def initialize(original_resource, original_exception)
7
- @original_resource = original_resource
8
- @original_exception = original_exception
9
- end
10
-
11
- # This method is called via the runner and signals RSpec to output a block
12
- # showing why the resource was skipped. This prevents the resource from
13
- # being added to the test collection and being evaluated.
14
- def resource_skipped?
15
- @original_exception.is_a?(Inspec::Exceptions::ResourceSkipped)
16
- end
17
-
18
- # This method is called via the runner and signals RSpec to output a block
19
- # showing why the resource failed. This prevents the resource from
20
- # being added to the test collection and being evaluated.
21
- def resource_failed?
22
- @original_exception.is_a?(Inspec::Exceptions::ResourceFailed)
23
- end
24
-
25
- def resource_exception_message
26
- @original_exception.message
27
- end
28
-
29
- # Capture message chains and return `ExceptionCatcher` objects
30
- def method_missing(*)
31
- self
32
- end
33
-
34
- # RSpec will check the object returned to see if it responds to a method
35
- # before calling it. We need to fake it out and tell it that it does. This
36
- # allows it to skip past that check and fall through to #method_missing
37
- def respond_to?(_method)
38
- true
39
- end
40
-
41
- def to_s
42
- @original_resource.to_s
43
- end
44
- alias inspect to_s
45
- end
46
-
47
- class Trace
48
- def initialize
49
- @chain = []
50
- end
51
-
52
- %w{== != >= > < <= =~ !~}.each do |m|
53
- define_method m.to_sym do |*args|
54
- res = Trace.new
55
- @chain.push([[m.to_sym] + args, res])
56
- res
57
- end
58
- end
59
-
60
- def method_missing(*args)
61
- res = Trace.new
62
- @chain.push([args, res])
63
- res
64
- end
65
-
66
- def self.to_ruby(trace)
67
- chain = trace.instance_variable_get(:@chain)
68
- return "" if chain.empty?
69
-
70
- " " + chain.map do |el|
71
- m = el[0][0]
72
- args = el[0].drop(1)
73
- nxt = to_ruby(el[1])
74
- next m.to_s + nxt if args.empty?
75
- next m.to_s + " " + args[0].inspect + nxt if args.length == 1
76
-
77
- m.to_s + "(" + args.map(&:inspect).join(", ") + ")" + nxt
78
- end.join(" ")
79
- end
80
- end
81
-
82
- class Table
83
- attr_reader :raw_data, :resource_instance, :criteria_string
84
- def initialize(resource_instance, raw_data, criteria_string)
85
- @resource_instance = resource_instance
86
- @raw_data = raw_data
87
- @raw_data = [] if @raw_data.nil?
88
- @criteria_string = criteria_string
89
- @populated_lazy_columns = {}
90
- end
91
-
92
- # Filter the raw data based on criteria (as method params) or by evaling a
93
- # block; then construct a new Table of the same class as ourselves,
94
- # wrapping the filtered data, and return it.
95
- def where(conditions = {}, &block)
96
- return self unless conditions.is_a?(Hash)
97
- return self if conditions.empty? && !block_given?
98
-
99
- # Initialize the details of the new Table.
100
- new_criteria_string = criteria_string
101
- filtered_raw_data = raw_data
102
-
103
- # If we were provided params, interpret them as criteria to be evaluated
104
- # against the raw data. Criteria are assumed to be hash keys.
105
- conditions.each do |raw_field_name, desired_value|
106
- raise(ArgumentError, "'#{decorate_symbols(raw_field_name)}' is not a recognized criterion - expected one of #{decorate_symbols(list_fields).join(", ")}'") unless field?(raw_field_name)
107
-
108
- populate_lazy_field(raw_field_name, desired_value) if is_field_lazy?(raw_field_name)
109
- new_criteria_string += " #{raw_field_name} == #{desired_value.inspect}"
110
- filtered_raw_data = filter_raw_data(filtered_raw_data, raw_field_name, desired_value)
111
- end
112
-
113
- # If we were given a block, make a special Struct for each row, that has an accessor
114
- # for each field declared using `register_custom_property`, then instance-eval the block
115
- # against the struct.
116
- if block_given?
117
- # Perform the filtering.
118
- filtered_raw_data = filtered_raw_data.find_all { |row_as_hash| create_eval_context_for_row(row_as_hash, "").instance_eval(&block) }
119
- # Try to interpret the block for updating the stringification.
120
- src = Trace.new
121
- # Swallow any exceptions raised here.
122
- # See https://github.com/chef/inspec/issues/2929
123
- begin
124
- src.instance_eval(&block)
125
- rescue # rubocop: disable Lint/HandleExceptions
126
- # Yes, robocop, ignoring all exceptions is normally
127
- # a bad idea. Here, an exception just means we don't
128
- # understand what was in a `where` block, so we can't
129
- # meaningfully sytringify it. We still have a decent
130
- # default stringification.
131
- end
132
- new_criteria_string += Trace.to_ruby(src)
133
- end
134
-
135
- self.class.new(resource, filtered_raw_data, new_criteria_string)
136
- end
137
-
138
- def create_eval_context_for_row(*_)
139
- raise "#{self.class} must not be used on its own. It must be inherited "\
140
- "and the #create_eval_context_for_row method must be implemented. This is an internal "\
141
- "error and should not happen."
142
- end
143
-
144
- def resource
145
- resource_instance
146
- end
147
-
148
- def params
149
- # TODO: consider deprecating
150
- raw_data
151
- end
152
-
153
- def entries
154
- row_criteria_string = resource.to_s + criteria_string + " one entry"
155
- raw_data.map do |row|
156
- create_eval_context_for_row(row, row_criteria_string)
157
- end
158
- end
159
-
160
- def get_column_values(field)
161
- raw_data.map do |row|
162
- row[field]
163
- end
164
- end
165
-
166
- def list_fields
167
- @__fields_in_raw_data ||= raw_data.reduce([]) do |fields, row|
168
- fields.concat(row.keys).uniq
169
- end
170
- end
171
-
172
- def field?(proposed_field)
173
- # Currently we only know about a field if it is present in a at least one row of the raw data.
174
- # If we have no rows in the raw data, assume all fields are acceptable (and rely on failing to match on value, nil)
175
- return true if raw_data.empty?
176
-
177
- # Most resources have Symbol keys in their raw data. Some have Strings (looking at you, `shadow`).
178
- is_field = false
179
- is_field ||= list_fields.include?(proposed_field.to_s)
180
- is_field ||= list_fields.include?(proposed_field.to_sym)
181
- is_field ||= is_field_lazy?(proposed_field.to_s)
182
- is_field ||= is_field_lazy?(proposed_field.to_sym)
183
-
184
- is_field
185
- end
186
-
187
- def to_s
188
- resource.to_s + criteria_string
189
- end
190
-
191
- alias inspect to_s
192
-
193
- def populate_lazy_field(field_name, criterion)
194
- return unless is_field_lazy?(field_name)
195
- return if field_populated?(field_name)
196
-
197
- raw_data.each do |row|
198
- next if row.key?(field_name) # skip row if pre-existing data is present
199
-
200
- callback_for_lazy_field(field_name).call(row, criterion, self)
201
- end
202
- mark_lazy_field_populated(field_name)
203
- end
204
-
205
- def is_field_lazy?(sought_field_name)
206
- custom_properties_schema.values.any? do |property_struct|
207
- sought_field_name == property_struct.field_name && \
208
- property_struct.opts[:lazy]
209
- end
210
- end
211
-
212
- def callback_for_lazy_field(field_name)
213
- return unless is_field_lazy?(field_name)
214
-
215
- custom_properties_schema.values.find do |property_struct|
216
- property_struct.field_name == field_name
217
- end.opts[:lazy]
218
- end
219
-
220
- def field_populated?(field_name)
221
- @populated_lazy_columns[field_name]
222
- end
223
-
224
- def mark_lazy_field_populated(field_name)
225
- @populated_lazy_columns[field_name] = true
226
- end
227
-
228
- private
229
-
230
- def matches_float(x, y)
231
- return false if x.nil?
232
- return false if !x.is_a?(Float) && (x =~ /\A[-+]?(\d+\.?\d*|\.\d+)\z/).nil?
233
-
234
- x.to_f == y
235
- end
236
-
237
- def matches_int(x, y)
238
- return false if x.nil?
239
- return false if !x.is_a?(Integer) && (x =~ /\A[-+]?\d+\z/).nil?
240
-
241
- x.to_i == y
242
- end
243
-
244
- def matches_regex(x, y)
245
- return x == y if x.is_a?(Regexp)
246
-
247
- !x.to_s.match(y).nil?
248
- end
249
-
250
- def matches(x, y)
251
- x === y # rubocop:disable Style/CaseEquality
252
- end
253
-
254
- def filter_raw_data(current_raw_data, field, desired_value)
255
- return [] if current_raw_data.empty?
256
-
257
- method_ref = case desired_value
258
- when Float then :matches_float
259
- when Integer then :matches_int
260
- when Regexp then :matches_regex
261
- else :matches
262
- end
263
-
264
- assume_symbolic_keyed_data = current_raw_data.first.keys.first.is_a? Symbol
265
- field = assume_symbolic_keyed_data ? field.to_sym : field.to_s
266
-
267
- current_raw_data.find_all do |row|
268
- next unless row.key?(field)
269
-
270
- send(method_ref, row[field], desired_value)
271
- end
272
- end
273
-
274
- def decorate_symbols(thing)
275
- return thing.map { |t| decorate_symbols(t) } if thing.is_a?(Array)
276
- return ":" + thing.to_s if thing.is_a? Symbol
277
- return thing + " (String)" if thing.is_a? String
278
-
279
- thing
280
- end
281
- end
282
-
283
- class Factory
284
- CustomPropertyType = Struct.new(:field_name, :block, :opts)
285
-
286
- def initialize
287
- @filter_methods = %i{where entries raw_data}
288
- @custom_properties = {}
289
- register_custom_matcher(:exist?) { |table| !table.raw_data.empty? }
290
- register_custom_property(:count) { |table| table.raw_data.count }
291
-
292
- @resource = nil # TODO: this variable is never initialized
293
- end
294
-
295
- def install_filter_methods_on_resource(resource_class, raw_data_fetcher_method_name) # rubocop: disable Metrics/AbcSize, Metrics/MethodLength
296
- # A context in which you can access the fields as accessors
297
- non_block_struct_fields = @custom_properties.values.reject(&:block).map(&:field_name)
298
- unless non_block_struct_fields.empty?
299
- row_eval_context_type = Struct.new(*non_block_struct_fields.map(&:to_sym)) do
300
- attr_accessor :criteria_string
301
- attr_accessor :filter_table
302
- def to_s
303
- @criteria_string || super
304
- end
305
- end
306
- end
307
-
308
- properties_to_define = @custom_properties.map do |method_name, custom_property_structure|
309
- { method_name: method_name, method_body: create_custom_property_body(custom_property_structure) }
310
- end
311
-
312
- # Define the filter table subclass
313
- custom_properties = @custom_properties # We need a local var, not an instance var, for a closure below
314
- table_class = Class.new(Table) do
315
- # Install each custom property onto the FilterTable subclass
316
- properties_to_define.each do |property_info|
317
- define_method property_info[:method_name], &property_info[:method_body]
318
- end
319
-
320
- define_method :custom_properties_schema do
321
- custom_properties
322
- end
323
-
324
- # Install a method that can wrap all the fields into a context with accessors
325
- define_method :create_eval_context_for_row do |row_as_hash, criteria_string = ""|
326
- return row_eval_context_type.new if row_as_hash.nil?
327
-
328
- context = row_eval_context_type.new(*non_block_struct_fields.map { |field| row_as_hash[field] })
329
- context.criteria_string = criteria_string
330
- context.filter_table = self
331
- context
332
- end
333
- end
334
-
335
- # Now that the table class is defined and the row eval context struct is defined,
336
- # extend the row eval context struct to support triggering population of lazy fields
337
- # in where blocks. To do that, we'll need a reference to the table (which
338
- # knows which fields are populated, and how to populate them) and we'll need to
339
- # override the getter method for each lazy field, so it will trigger
340
- # population if needed. Keep in mind we don't have to adjust the constructor
341
- # args of the row struct; also the Struct class will already have provided
342
- # a setter for each field.
343
- @custom_properties.values.each do |property_info|
344
- next unless property_info.opts[:lazy]
345
-
346
- field_name = property_info.field_name.to_sym
347
- row_eval_context_type.send(:define_method, field_name) do
348
- unless filter_table.field_populated?(field_name)
349
- filter_table.populate_lazy_field(field_name, NoCriteriaProvided) # No access to criteria here
350
- # OK, the underlying raw data has the value in the first row
351
- # (because we would trigger population only on the first row)
352
- # We could just return the value, but we need to set it on this Struct in case it is referenced multiple times
353
- # in the where block.
354
- self[field_name] = filter_table.raw_data[0][field_name]
355
- end
356
- # Now return the value using the Struct getter, whether newly populated or not
357
- self[field_name]
358
- end
359
- end
360
-
361
- # Define all access methods with the parent resource
362
- # These methods will be configured to return an `ExceptionCatcher` object
363
- # that will always return the original exception, but only when called
364
- # upon. This will allow method chains in `describe` statements to pass the
365
- # `instance_eval` when loaded and only throw-and-catch the exception when
366
- # the tests are run.
367
- methods_to_install_on_resource_class = @filter_methods + @custom_properties.keys
368
- methods_to_install_on_resource_class.each do |method_name|
369
- resource_class.send(:define_method, method_name) do |*args, &block|
370
- begin
371
- # self here is the resource instance
372
- filter_table_instance = table_class.new(self, send(raw_data_fetcher_method_name), " with")
373
- filter_table_instance.send(method_name, *args, &block)
374
- rescue Inspec::Exceptions::ResourceFailed, Inspec::Exceptions::ResourceSkipped => e
375
- FilterTable::ExceptionCatcher.new(resource_class, e)
376
- end
377
- end
378
- end
379
- end
380
-
381
- alias connect install_filter_methods_on_resource
382
-
383
- # TODO: This should almost certainly be privatized. Every FilterTable client should get :entries and :where;
384
- # InSpec core resources do not define anything else, other than azure_generic_resource, which is likely a mis-use.
385
- def register_filter_method(method_name)
386
- if method_name.nil?
387
- # TODO: @resource is never initialized
388
- throw RuntimeError, "Called filter.add_accessor for resource #{@resource} with method name nil!"
389
- end
390
- if @filter_methods.include? method_name.to_sym
391
- # TODO: issue deprecation warning?
392
- else
393
- @filter_methods.push(method_name.to_sym)
394
- end
395
- self
396
- end
397
-
398
- alias add_accessor register_filter_method
399
-
400
- def register_custom_property(property_name, opts = {}, &property_implementation)
401
- if property_name.nil?
402
- # TODO: @resource is never initialized
403
- throw RuntimeError, "Called filter.add for resource #{@resource} with method name nil!"
404
- end
405
-
406
- if @custom_properties.key?(property_name.to_sym)
407
- # TODO: issue deprecation warning?
408
- else
409
- @custom_properties[property_name.to_sym] =
410
- CustomPropertyType.new(opts[:field] || property_name, property_implementation, opts)
411
- end
412
- self
413
- end
414
-
415
- alias add register_custom_property
416
- alias register_column register_custom_property
417
- alias register_custom_matcher register_custom_property
418
-
419
- private
420
-
421
- # This provides the implementation for methods requested using
422
- # register_custom_property(:some_method_name, opts, &block)
423
- # Some usage in the wild involves people passing a desired value to the generated method, like:
424
- # things.ids(23)
425
- # I'm calling this the 'filter_criterion_value'. I speculate that a default value is
426
- # provided here so that users can meaningfully query for nil.
427
- def create_custom_property_body(custom_property_struct)
428
- if !custom_property_struct.block.nil?
429
- # If the custom method provided its own block, rely on it.
430
- lambda do |filter_criteria_value = NoCriteriaProvided|
431
- # Here self is an instance of the FilterTable subclass that wraps the raw data.
432
- # Call the block with two args - the table instance, and any filter criteria value.
433
- custom_property_struct.block.call(self, filter_criteria_value)
434
- end
435
- else
436
- # No block definition, so the property was registered using (field: :some_field)
437
- # This does however support passing a block to this method, and filtering using it, like Enumerable#select.
438
- lambda do |filter_criteria_value = NoCriteriaProvided, &cond_block|
439
- if filter_criteria_value == NoCriteriaProvided && !block_given?
440
- # No second-order block given. Just return an array of the values in the selected column.
441
- result = where(nil)
442
- if custom_property_struct.opts[:lazy]
443
- result.populate_lazy_field(custom_property_struct.field_name, filter_criteria_value)
444
- end
445
- result = where(nil).get_column_values(custom_property_struct.field_name) # TODO: the where(nil). is likely unneeded
446
- result = result.flatten.uniq.compact if custom_property_struct.opts[:style] == :simple
447
- result
448
- else
449
- # A secondary block was provided. Rely on where() to execute the block, while also filtering on any single value
450
- # Suspected bug: if filter_criteria_value == NoCriteriaProvided, this is unlikely to match - see hash condition handling in where() above.
451
- where(custom_property_struct.field_name => filter_criteria_value, &cond_block)
452
- end
453
- end
454
- end
455
- end
456
- end
457
-
458
- def self.create
459
- Factory.new
460
- end
461
- end