-
Notifications
You must be signed in to change notification settings - Fork 321
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(parser): support ssl certificates and swagger files set as attributes for Ansible and Terraform #2958 #2960
feat(parser): support ssl certificates and swagger files set as attributes for Ansible and Terraform #2958 #2960
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is good stuff. But it still needs work.
Also @cosmicgirl97 (AKA @rafaela-soares) We need unit tests 😄 |
@cosmicgirl97 @rafaela-soares do you have a query to add that uses the certificate info appended to the payload? It would be great to see this new feature in action being used by a query in this same PR |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please, check comments
@cosmicgirl97 @rafaela-soares please add the new terraform samples e.g: assets/queries/terraform/aws/certificate_rsa_key_bytes_lower_than_128/test/negative2.tf to the ignore list until we fix this. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Won't affect, concurrent Scans PR since the changes are made in the parser
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
outdated
Closes #2958
Proposed Changes
The algorithm followed to access the content of the attribute 'swagger_file' in an Ansible template was:
1. Verify if any attribute in the Ansible template is 'swagger_file' in the function 'playbookParser' (\kics\pkg\parser\yaml\parser.go);
2. In a positive case, add the content of the swagger file in the attribute 'swagger_file' (through function 'AddSwaggerInfo' used in the function 'playbookParser');
Functions description:
The algorithm followed to access the content of the attribute 'certificate' in an Ansible template and the attribute 'certificate_body' in Terraform was:
1. For Ansible, verify if any attribute in the Ansible template is 'certificate' in the function 'playbookParser' (\kics\pkg\parser\yaml\parser.go); For Terraform, verify if any attribute in the Terraform template is 'certificate_body' and refers a pem file in the function 'Parse' (\kics\pkg\parser\terraform\terraform.go);
2. In a positive case, add the content of the certificate (through function 'AddCertificateInfo').
Functions description:
Analysis of consumption metrics (still work in progress)
The following table is related to the scan of "\kics\assets\queries\ansible\aws". For that, it needed to add a YAML file in queries ''API Gateway Endpoint Config is Not Private", "API Gateway Without SSL Certificate" and "API Gateway X-Ray Disabled" (the positive and negative files refer to a swagger_file that does not exist in the respective folder). In these two rounds, the results of metrics 'Total CPU usage for inspect', 'Total CPU usage for generate_report' and 'Total MEM usage for get_sources' are inconclusive.
Queries:
I submit this contribution under the Apache-2.0 license.