feat(lab6): Checkov, KICS scans and custom policy - #6
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Goal
Scan the vulnerable Terraform, Pulumi, and Ansible IaC with Checkov and KICS, and add a custom Checkov policy enforcing a minimum RDS backup retention period.
Changes
submissions/lab6.md— findings tables (Checkov on Terraform, KICS on Pulumi + Ansible), module-leverage analysis, Checkov-vs-KICS comparison, and bonus custom policy writeuplabs/lab6/policies/my-custom-policy.yaml— custom Checkov policyCKV_CUSTOM_2requiringaws_db_instance.backup_retention_period > 6Testing
checkov -d labs/lab6/vulnerable-iac/terraform
--output cli --output json
--output-file-path labs/lab6/results/checkov-terraform/
docker run --rm -v "$(pwd)/labs/lab6:/path" checkmarx/kics:latest
scan -p /path/vulnerable-iac/pulumi/ -o /path/results/kics-pulumi/
--report-formats json,sarif
docker run --rm -v "$(pwd)/labs/lab6:/path" checkmarx/kics:latest
scan -p /path/vulnerable-iac/ansible/ -o /path/results/kics-ansible/
--report-formats json,sarif
checkov -d labs/lab6/vulnerable-iac/terraform
--external-checks-dir labs/lab6/policies
--output cli --output json
--output-file-path labs/lab6/results/checkov-custom/
jq '.[] | select(.check_type=="terraform") | .results.failed_checks[] | select(.check_id=="CKV_CUSTOM_2")'
labs/lab6/results/checkov-custom/results_json.json
-> CKV_CUSTOM_2 fired FAILED on 2 resources: aws_db_instance.unencrypted_db, aws_db_instance.weak_db
Artifacts & Screenshots
submissions/lab6.mdChecklist
feat(lab6): <topic>stylesubmissions/lab6.md