Commit graph

283 commits

Author SHA1 Message Date
Nikita Mathur
c9f5dcb57d Parallel breaking fix due to method usage changes after attestation merge
Signed-off-by: Nikita Mathur <nikita.mathur@chef.io>
2022-10-17 18:17:07 +05:30
Nikita Mathur
efc6f2c63a
CFINSPEC-246/CFINSPEC-247 Attestation changes for N/R outcomes (#6222)
* Added attestation file option to read attestation in various formats

Signed-off-by: Nikita Mathur <nikita.mathur@chef.io>

* Added method to add attestation data on control level

Signed-off-by: Nikita Mathur <nikita.mathur@chef.io>

* Enhanced outcomes flag to be true when attestation file is passed

Signed-off-by: Nikita Mathur <nikita.mathur@chef.io>

* Added logic for attestation for reporters

Signed-off-by: Nikita Mathur <nikita.mathur@chef.io>

* Attestation integration with streaming reporters and lots of refactoring

Signed-off-by: Nikita Mathur <nikita.mathur@chef.io>

* Support for mitre - with frequency, updated and explanation fields'

Signed-off-by: Nikita Mathur <nikita.mathur@chef.io>

* To only revise enhanced outcomes when attestation data is present for the control - fix in streaming reporter

Signed-off-by: Nikita Mathur <nikita.mathur@chef.io>

* Added test cases for attestation and also added validation warnings

Signed-off-by: Nikita Mathur <nikita.mathur@chef.io>

* Attestation test for different formats of attestation file

Signed-off-by: Nikita Mathur <nikita.mathur@chef.io>

* Validating presence of status column to be mandtory for attestation files

Signed-off-by: Nikita Mathur <nikita.mathur@chef.io>

* Build fix

Signed-off-by: Nikita Mathur <nikita.mathur@chef.io>

* Attestation build fix for windows

Signed-off-by: Nikita Mathur <nikita.mathur@chef.io>

* No justification and no status graceful handling

Signed-off-by: Nikita Mathur <nikita.mathur@chef.io>

* New class attestations added for logic and added missing test attestations file

Signed-off-by: Nikita Mathur <nikita.mathur@chef.io>

* Code comments and cli doc changes for attestation option

Signed-off-by: Nikita Mathur <nikita.mathur@chef.io>

* Moved logic of attestations and enhanced outcomes to the base of streaming reporter

Signed-off-by: Nikita Mathur <nikita.mathur@chef.io>

* Attestation documentation added

Signed-off-by: Nikita Mathur <nikita.mathur@chef.io>

* Added information on what happens if justification is missing in attestation file

Signed-off-by: Nikita Mathur <nikita.mathur@chef.io>

* Attestation doc changes as per the review

Signed-off-by: Nikita Mathur <nikita.mathur@chef.io>

* File fields doc changes in attestation doc

Signed-off-by: Nikita Mathur <nikita.mathur@chef.io>

* Content Review

Signed-off-by: Deepa Kumaraswamy <dkumaras@progress.com>

* Edits

Signed-off-by: Deepa Kumaraswamy <dkumaras@progress.com>

* Attestation test changes matching regex and separated logic for expiration using frequency and updated date

Signed-off-by: Nikita Mathur <nikita.mathur@chef.io>

* Proof-read

Signed-off-by: Deepa Kumaraswamy <dkumaras@progress.com>

* Name changes for expiry calculation method

Signed-off-by: Nikita Mathur <nikita.mathur@chef.io>

* Generic tests in attestations for cross platform

Signed-off-by: Nikita Mathur <nikita.mathur@chef.io>

Signed-off-by: Nikita Mathur <nikita.mathur@chef.io>
Signed-off-by: Deepa Kumaraswamy <dkumaras@progress.com>
Co-authored-by: Deepa Kumaraswamy <dkumaras@progress.com>
2022-09-30 09:53:32 -04:00
Nikita Mathur
b9750c0faf Added inspec parallel logs in log file in case of warn/errors
Signed-off-by: Nikita Mathur <nikita.mathur@chef.io>
2022-08-22 16:08:20 +05:30
Nikita Mathur
1c6bfa8f24 Merge branch 'main' into inspec-6 2022-08-22 14:55:01 +05:30
Nikita Mathur
82ab13dbe4 Html reporter changes for enhanced outcomes and refactoring changes
Signed-off-by: Nikita Mathur <nikita.mathur@chef.io>
2022-07-29 14:30:59 +05:30
Nikita Mathur
1fc0076f1a Enhanced outcomes changes for streaming progress bar reporter
Signed-off-by: Nikita Mathur <nikita.mathur@chef.io>
2022-07-29 14:30:58 +05:30
Nikita Mathur
4e83f395c8 enhanced outcome fix in streaming reporter - collected test based on control_id
Signed-off-by: Nikita Mathur <nikita.mathur@chef.io>
2022-07-29 14:30:58 +05:30
Nikita Mathur
f56f5ec844 enhanced outcomes logic in streaming reporter base class
Signed-off-by: Nikita Mathur <nikita.mathur@chef.io>
2022-07-29 14:30:58 +05:30
Nikita Mathur
62662d5ae0 Comment to add info for silent super class
Signed-off-by: Nikita Mathur <nikita.mathur@chef.io>
2022-06-30 13:46:58 +05:30
Nikita Mathur
c5b03be490 Enabled silent run by adding silent superreporter
Signed-off-by: Nikita Mathur <nikita.mathur@chef.io>
2022-06-29 13:43:10 +05:30
jayashrig158
542b9cc246 add ruby test 3.1 in verify pipeline (#5892)
* add ruby test 3.1 in verify pipeline

Signed-off-by: jayashri garud <jgarud@msystechnologies.com>

* updating rubygem to 3.3.3

Signed-off-by: jayashri garud <jgarud@msystechnologies.com>

* Test fixture plugin files for ABI 3.1.0

Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>

* Use kwargs to match new calling style for ERB in ruby 2.7 and 3.0

Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>

* Allow Date and Time data types, needed for waivers, since safe load is now the default for YAML

Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>

* Use Time.parse, not Time.new since the rules tightened for what you can pass the constructor for waiver dates

Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>

* Add ruby platform debug message to test parallel output

Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>

* Conditionalize permitted_classes in inputs yaml_load for <= 3.1.x only

Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>

* In ruby 3.1.0 net/pop3 is no more a default gem and that will require us to add it in Gemfile so trying with the byebug gem which we are bundling already

Signed-off-by: Vasu1105 <vasundhara.jagdale@chef.io>

* CFINSPEC-166 Updated url fetcher to handle Net::OpenTimeout Exception on Windows

Signed-off-by: Vasu1105 <vasundhara.jagdale@chef.io>

Co-authored-by: Clinton Wolfe <clintoncwolfe@gmail.com>
Co-authored-by: Vasu1105 <vasundhara.jagdale@chef.io>
2022-06-14 16:07:08 +05:30
Nikita Mathur
6eb5df2e49 Skip parallel exec tests on windows
Signed-off-by: Nikita Mathur <nikita.mathur@chef.io>
2022-06-14 15:17:02 +05:30
Nikita Mathur
d8fd959af5 Fix test cases in inspec parallel tests
Signed-off-by: Nikita Mathur <nikita.mathur@chef.io>
2022-06-14 13:46:34 +05:30
jayashrig158
ffbf2ff554
add ruby test 3.1 in verify pipeline (#5892)
* add ruby test 3.1 in verify pipeline

Signed-off-by: jayashri garud <jgarud@msystechnologies.com>

* updating rubygem to 3.3.3

Signed-off-by: jayashri garud <jgarud@msystechnologies.com>

* Test fixture plugin files for ABI 3.1.0

Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>

* Use kwargs to match new calling style for ERB in ruby 2.7 and 3.0

Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>

* Allow Date and Time data types, needed for waivers, since safe load is now the default for YAML

Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>

* Use Time.parse, not Time.new since the rules tightened for what you can pass the constructor for waiver dates

Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>

* Add ruby platform debug message to test parallel output

Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>

* Conditionalize permitted_classes in inputs yaml_load for <= 3.1.x only

Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>

* In ruby 3.1.0 net/pop3 is no more a default gem and that will require us to add it in Gemfile so trying with the byebug gem which we are bundling already

Signed-off-by: Vasu1105 <vasundhara.jagdale@chef.io>

* CFINSPEC-166 Updated url fetcher to handle Net::OpenTimeout Exception on Windows

Signed-off-by: Vasu1105 <vasundhara.jagdale@chef.io>

Co-authored-by: Clinton Wolfe <clintoncwolfe@gmail.com>
Co-authored-by: Vasu1105 <vasundhara.jagdale@chef.io>
2022-06-13 14:24:33 -04:00
Nikita Mathur
f04a31d822
CFINSPEC-120 inspec parallel feature (#5975)
* Initial commit - Inspec parallel setup

Signed-off-by: Nikita Mathur <nikita.mathur@chef.io>

* Added dry run option functionality and renamed subcommand

Signed-off-by: Nikita Mathur <nikita.mathur@chef.io>

* Runner logic parsing options file and executing cmds

Signed-off-by: Nikita Mathur <nikita.mathur@chef.io>

* Validation logic changes for dry run and run commands

Signed-off-by: Nikita Mathur <nikita.mathur@chef.io>

* Validator bug fix when using options like --sudo with no value

Signed-off-by: Nikita Mathur <nikita.mathur@chef.io>

* initial commit for using default options

Signed-off-by: Nikita Mathur <nikita.mathur@chef.io>

* Logic to not parse empty lines and comments and some cleanup

Signed-off-by: Nikita Mathur <nikita.mathur@chef.io>

* Functional test cases added

Signed-off-by: Nikita Mathur <nikita.mathur@chef.io>

* Test cases fix and bug fix in validator

Signed-off-by: Nikita Mathur <nikita.mathur@chef.io>

* Add logic to append default options passed from cli

Signed-off-by: Sonu Saha <sonu.saha@progress.com>

* Add test for default options and extend options-file-1.txt

Signed-off-by: Sonu Saha <sonu.saha@progress.com>

* Add comments in options-file-2 and 3

Signed-off-by: Sonu Saha <sonu.saha@progress.com>

* Bug fix and some refactoring

Signed-off-by: Nikita Mathur <nikita.mathur@chef.io>

* Changes from pair programming

Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>

* Fixed incorrect line no used in dry run validation & added verbose option

Signed-off-by: Nikita Mathur <nikita.mathur@chef.io>

* Initial code with parallel gem setup

Signed-off-by: Nikita Mathur <nikita.mathur@chef.io>

* Error handling and some changes in parallel running result

Signed-off-by: Nikita Mathur <nikita.mathur@chef.io>

* Working spawn and fork implementation; no pipes or error handling

Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>

* CFINSPEC-143 Child status reporter plugin

Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>

* Read status from children using pipes; Windows implementation is likely broken

Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>

* Linting

Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>

* Removed parallel gem and it's code usage

Signed-off-by: Nikita Mathur <nikita.mathur@chef.io>

* Erb templating and option file as shell/powershell option added

Signed-off-by: Nikita Mathur <nikita.mathur@chef.io>

* Added missing raise error in content reading logic

Signed-off-by: Nikita Mathur <nikita.mathur@chef.io>

* Adding for the sake of keeping bash file syntax correct

Signed-off-by: Nikita Mathur <nikita.mathur@chef.io>

* Switch to select() polling, enabling Windows support; also add a terrible hack to the child-status reporter

Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>

* Move child-status reporter into inspec-parallel plugin to reduce pollution

Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>

* Rename a bunch of things, remove some instance variables, always validate, and use Inspec::UI exit codes

Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>

* Rework validation to be Thor-based; add logic to inject child-status reporter

Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>

* Linting

Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>

* Refactor parent UI to make it object oriented

Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>

* Add a prototype 'status' super-reporter

Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>

* Improve status UI edge cases, add info to output, make default

Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>

* Error handling added when running bash instead of system check

Signed-off-by: Nikita Mathur <nikita.mathur@chef.io>

* Daemon run for background process in unix system for parallel runs

Signed-off-by: Nikita Mathur <nikita.mathur@chef.io>

* Added logic to cleanup daemon process'

Signed-off-by: Nikita Mathur <nikita.mathur@chef.io>

* Review changes for background command name and windows handling

Signed-off-by: Nikita Mathur <nikita.mathur@chef.io>

* Error raised with error handling class for options file

Signed-off-by: Nikita Mathur <nikita.mathur@chef.io>

* Fix to not intialise ui when background run is opted

Signed-off-by: Nikita Mathur <nikita.mathur@chef.io>

* typo fix in child reporter append logic in validator

Signed-off-by: Nikita Mathur <nikita.mathur@chef.io>

* Changes to trap control c and exit gracefully

Signed-off-by: Nikita Mathur <nikita.mathur@chef.io>

* Moved ctl c handling code to command class

Signed-off-by: Nikita Mathur <nikita.mathur@chef.io>

* Linter fixes

Signed-off-by: Nikita Mathur <nikita.mathur@chef.io>

* Error and runner logging added

Signed-off-by: Nikita Mathur <nikita.mathur@chef.io>

* ERB pid option to use child process id for generating result output

Signed-off-by: Nikita Mathur <nikita.mathur@chef.io>

* Renamed 38125 to Process.pid for clear notation

Signed-off-by: Nikita Mathur <nikita.mathur@chef.io>

* Log path option added for inspec parallel

Signed-off-by: Nikita Mathur <nikita.mathur@chef.io>

* Adjust ERB eval

Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>

* STDERR logging added

Signed-off-by: Nikita Mathur <nikita.mathur@chef.io>

* Fix of --bg with ui

Signed-off-by: Nikita Mathur <nikita.mathur@chef.io>

* Deleting log files if empty and status super reporter to show done

Signed-off-by: Nikita Mathur <nikita.mathur@chef.io>

* Docs for InSpec Parallel

Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>

* Doc Review

Signed-off-by: Deepa Kumaraswamy <dkumaras@progress.com>

* Grammar corrections

Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>

Co-authored-by: Sonu Saha <sonu.saha@progress.com>
Co-authored-by: Clinton Wolfe <clintoncwolfe@gmail.com>
Co-authored-by: Deepa Kumaraswamy <dkumaras@progress.com>
2022-06-13 13:58:41 -04:00
Vasu1105
04d93db068 CFINSPEC-340 Adds usage header line in the signed profile
Signed-off-by: Vasu1105 <vasundhara.jagdale@chef.io>
2022-06-08 10:35:16 +05:30
Vasu1105
078d1ce898 Updated sign and verify command to directly accept the path of the profile instead of additional option to provide those. Updated docs for the same.
Signed-off-by: Vasu1105 <vasundhara.jagdale@chef.io>
2022-06-02 10:36:50 +05:30
Vasu1105
fdb4d5c3ca Fix the --profile-content-id option not to overwrite the existing profile_content_id value in the metadata file
Signed-off-by: Vasu1105 <vasundhara.jagdale@chef.io>
2022-06-01 22:14:53 +05:30
Vasu1105
12b73a6609 Only adds or updates the profile_content_id without modifying the existing contents of the metadata file.
Signed-off-by: Vasu1105 <vasundhara.jagdale@chef.io>
2022-05-30 14:37:39 +05:30
Vasu1105
16353af6e3 Fixed the profile content id option description.
Signed-off-by: Vasu1105 <vasundhara.jagdale@chef.io>
2022-05-30 12:11:23 +05:30
Vasu1105
bee69410ca CFINSPEC-255: Add --profile-content-id option to inspec sign profile command
Signed-off-by: Vasu1105 <vasundhara.jagdale@chef.io>
2022-05-13 16:34:48 +05:30
Vasu1105
28f6eec56a Fix failing test
Signed-off-by: Vasu1105 <vasundhara.jagdale@chef.io>
2022-05-13 00:31:32 +05:30
Clinton Wolfe
47bc41cd2c Several small bugs and usability fixes
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2022-05-13 00:31:32 +05:30
Vasu1105
3f22d899fb Fixed failing test and adds test for signed dependent profile
Signed-off-by: Vasu1105 <vasundhara.jagdale@chef.io>
2022-05-13 00:31:32 +05:30
Vasu1105
56b8306e34 Fix for test failure
Signed-off-by: Vasu1105 <vasundhara.jagdale@chef.io>
2022-05-13 00:31:32 +05:30
Clinton Wolfe
0ec4461756 Look for signing and validation keys in user and source directories
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2022-05-13 00:31:32 +05:30
Clinton Wolfe
29034b6b9d Fix log output, don't use temp dir
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2022-05-13 00:31:32 +05:30
Vasu1105
9c2fa3f012 Fixed typo
Signed-off-by: Vasu1105 <vasundhara.jagdale@chef.io>
2022-05-13 00:31:32 +05:30
Vasu1105
6da6c85e54 Refactored code to use existing archive command to archive the file.
Signed-off-by: Vasu1105 <vasundhara.jagdale@chef.io>
2022-05-13 00:31:32 +05:30
Vasu1105
9ef83bfce8 Updated to generate binary format of the signed profile
Signed-off-by: Vasu1105 <vasundhara.jagdale@chef.io>
2022-05-13 00:31:32 +05:30
Vasu1105
6bb06eee5f Adds class iaf_file to validate the signed profile
Signed-off-by: Vasu1105 <vasundhara.jagdale@chef.io>
2022-05-13 00:31:32 +05:30
Vasu1105
f0c868759d Renamed the method for validating header
Signed-off-by: Vasu1105 <vasundhara.jagdale@chef.io>
2022-05-13 00:31:32 +05:30
Vasu1105
9454821d7c CFINSPEC-183: Rename artifact commands to inspec sign
Signed-off-by: Vasu1105 <vasundhara.jagdale@chef.io>
2022-05-13 00:31:32 +05:30
Vasu1105
bfa781b8ec CFINSPEC-167: Adds profile version check for signed profiles
Signed-off-by: Vasu1105 <vasundhara.jagdale@chef.io>
2022-05-13 00:31:32 +05:30
Vasu1105
cd5fde279a CFINSPEC-167: Store the signed profile in binary format
Signed-off-by: Vasu1105 <vasundhara.jagdale@chef.io>
2022-05-13 00:31:32 +05:30
Aaron Lippold
4eccdc1b5a removed excessive use of instance variables
Signed-off-by: Aaron Lippold <lippold@gmail.com>
2022-03-25 13:01:14 -04:00
Aaron Lippold
ffd4706608 refactored to remove repeated code.
Signed-off-by: Aaron Lippold <lippold@gmail.com>
2022-03-25 12:54:31 -04:00
Aaron Lippold
1150ef2d30 updates to reporting detail on progress bar
Signed-off-by: Aaron Lippold <lippold@gmail.com>
2022-03-25 12:02:29 -04:00
Nikita Mathur
a8716f8dda More build fixes and pr review changes
Signed-off-by: Nikita Mathur <nikita.mathur@chef.io>
2022-03-22 15:52:45 +05:30
Nikita Mathur
7442ef1941 Description fetch logic added for user plugin listing and test cases
Signed-off-by: Nikita Mathur <nikita.mathur@chef.io>
2022-03-21 15:04:33 +05:30
Nikita Mathur
e2d8ee1167 Text case fixes for plugin list/search
Signed-off-by: Nikita Mathur <nikita.mathur@chef.io>
2022-03-21 14:01:43 +05:30
Nikita Mathur
bcc71df9dd Test cases for plugin listing and search added
Signed-off-by: Nikita Mathur <nikita.mathur@chef.io>
2022-03-18 17:27:45 +05:30
Nikita Mathur
9ecfad0122 Added gemspec file to core plugins to be used in plugin listing for description
Signed-off-by: Nikita Mathur <nikita.mathur@chef.io>
2022-03-18 17:27:11 +05:30
Nikita Mathur
9ae93eef34 Logic to add description in plugin listing and search
Signed-off-by: Nikita Mathur <nikita.mathur@chef.io>
2022-03-18 17:25:49 +05:30
Sonu Saha
e070d0cbf3 Rename methods for cli_resource due to ambiguity with cli_plugin leading to test failure for plugin
Signed-off-by: Sonu Saha <sonu.saha@progress.com>
2022-03-11 13:08:58 +05:30
Sonu Saha
dc46fe9a73 Remove file.exists? deprecation in favor of file.exist?
Signed-off-by: Sonu Saha <sonu.saha@progress.com>
2022-03-11 13:07:55 +05:30
Sonu Saha
2c4ea72a36 CFINSPEC-128 : Modify warning message for existing directory case
Signed-off-by: Sonu Saha <sonu.saha@progress.com>
2022-03-10 20:07:32 +05:30
Clinton Wolfe
d78acc03ba Linting
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2022-03-10 20:07:32 +05:30
Clinton Wolfe
bbdbc5c6b7 Remove old TODO message
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2022-03-10 20:07:32 +05:30
Clinton Wolfe
c39329b82f Add a plural resource template
Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
2022-03-10 20:07:32 +05:30